Scope pull request workflows to paths #1093
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Pull request | |
on: pull_request | |
jobs: | |
sonar_analysis: | |
name: Sonar analysis | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: 'npm' | |
- name: Install dependencies | |
run: npm ci | |
- name: Sonar analysis | |
uses: sonarsource/sonarcloud-github-action@master | |
with: | |
projectBaseDir: . | |
env: | |
GITHUB_TOKEN: ${{ secrets.TOKEN_GITHUB }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} | |
linting: | |
name: Code style checks | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: 'npm' | |
- name: Install dependencies | |
run: npm ci | |
- name: Run linting | |
run: npm run lint | |
tests: | |
name: Javascript unit tests | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: 'npm' | |
- name: Get changed files | |
id: changed-tests | |
uses: tj-actions/changed-files@v45 | |
with: | |
files: | | |
packages/**/*.js | |
packages/**/*.scss | |
dist/app/components/**/*.html | |
- name: Install dependencies | |
if: steps.changed-tests.outputs.any_changed == 'true' | |
run: npm ci | |
- name: Run tests | |
if: steps.changed-tests.outputs.any_changed == 'true' | |
run: npm test | |
ui_tests: | |
name: Visual regression tests | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: 'npm' | |
- name: Get changed files | |
id: changed-ui_tests | |
uses: tj-actions/changed-files@v45 | |
with: | |
files: | | |
packages/** | |
tests/** | |
app/** | |
- name: Install dependencies | |
if: steps.changed-ui_tests.outputs.any_changed == 'true' | |
run: npm ci | |
- name: Run backstop | |
if: steps.changed-ui_tests.outputs.any_changed == 'true' | |
run: npm run backstop:ci |