|
1 | 1 | name: Code Quality
|
2 | 2 |
|
3 | 3 | on:
|
4 |
| - pull_request: |
5 |
| - push: |
6 |
| - branches: |
7 |
| - - main |
| 4 | + pull_request: |
| 5 | + push: |
| 6 | + branches: |
| 7 | + - main |
8 | 8 |
|
| 9 | +# Cancel previous workflow run groups that have not completed. |
9 | 10 | concurrency:
|
10 |
| - group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.ref }} |
11 |
| - cancel-in-progress: true |
| 11 | + # Group workflow runs by workflow name, along with the head branch ref of the pull request |
| 12 | + # or otherwise the branch or tag ref. |
| 13 | + group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.ref }} |
| 14 | + cancel-in-progress: true |
12 | 15 |
|
13 | 16 | jobs:
|
14 |
| - phpcs: |
15 |
| - name: PHPCS check |
16 |
| - runs-on: ubuntu-latest |
17 |
| - steps: |
18 |
| - - name: Checkout code |
19 |
| - uses: actions/checkout@v4 |
20 |
| - |
21 |
| - - name: Setup PHP |
22 |
| - uses: shivammathur/setup-php@v2 |
23 |
| - with: |
24 |
| - php-version: '8.2' |
25 |
| - ini-values: 'memory_limit=1G' |
26 |
| - coverage: none |
27 |
| - tools: cs2pr |
28 |
| - |
29 |
| - - name: Get Composer Cache Directory |
30 |
| - id: composer-cache |
31 |
| - run: echo "::set-output name=dir::$(composer config cache-files-dir)" |
32 |
| - |
33 |
| - - name: Configure Composer cache |
34 |
| - uses: actions/cache@v4 |
35 |
| - with: |
36 |
| - path: ${{ steps.composer-cache.outputs.dir }} |
37 |
| - key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} |
38 |
| - restore-keys: | |
39 |
| - ${{ runner.os }}-composer- |
40 |
| -
|
41 |
| - - name: Install Composer dependencies |
42 |
| - uses: ramsey/composer-install@v2 |
43 |
| - with: |
44 |
| - custom-cache-suffix: $(date -u "+%Y-%m") |
45 |
| - |
46 |
| - - name: Validate composer.json |
47 |
| - run: composer --no-interaction validate --no-check-all |
48 |
| - |
49 |
| - - name: Detect coding standard violations (PHPCS) |
50 |
| - run: vendor/bin/phpcs --report-full --report-checkstyle=./phpcs-report.txt |
51 |
| - |
52 |
| - - name: Upload PHPCS report |
53 |
| - uses: actions/upload-artifact@v2 |
54 |
| - with: |
55 |
| - name: phpcs-report |
56 |
| - path: phpcs-report.txt |
57 |
| - |
58 |
| - stylelint: |
59 |
| - name: 'Lint: CSS' |
60 |
| - runs-on: ubuntu-latest |
61 |
| - steps: |
62 |
| - - name: Checkout |
63 |
| - uses: actions/checkout@v4 |
64 |
| - |
65 |
| - - name: Setup Node |
66 |
| - uses: actions/setup-node@v4 |
67 |
| - with: |
68 |
| - node-version: '20.12.2' |
69 |
| - cache: 'npm' |
70 |
| - |
71 |
| - - name: Unset npm_config_prefix |
72 |
| - run: unset npm_config_prefix |
73 |
| - |
74 |
| - - name: Check Node version |
75 |
| - run: node -v |
76 |
| - |
77 |
| - - name: Install Node dependencies |
78 |
| - run: npm ci |
79 |
| - env: |
80 |
| - CI: true |
81 |
| - |
82 |
| - - name: Lint Stylesheets |
83 |
| - run: npm run lint:css |
84 |
| - |
85 |
| - eslint: |
86 |
| - name: 'Lint: JS' |
87 |
| - runs-on: ubuntu-latest |
88 |
| - steps: |
89 |
| - - name: Checkout |
90 |
| - uses: actions/checkout@v4 |
91 |
| - |
92 |
| - - name: Setup Node |
93 |
| - uses: actions/setup-node@v4 |
94 |
| - with: |
95 |
| - node-version: '20.12.2' |
96 |
| - cache: 'npm' |
97 |
| - |
98 |
| - - name: Unset npm_config_prefix |
99 |
| - run: unset npm_config_prefix |
100 |
| - |
101 |
| - - name: Check Node version |
102 |
| - run: node -v |
103 |
| - |
104 |
| - - name: Install Node dependencies |
105 |
| - run: npm ci |
106 |
| - env: |
107 |
| - CI: true |
108 |
| - |
109 |
| - - name: Lint JavaScript |
110 |
| - run: npm run lint:js |
| 17 | + lint-css: |
| 18 | + name: 'Lint: CSS' |
| 19 | + runs-on: ubuntu-latest |
| 20 | + steps: |
| 21 | + - name: Checkout |
| 22 | + uses: actions/checkout@v4 |
| 23 | + |
| 24 | + - name: Setup Node |
| 25 | + uses: actions/setup-node@v4 |
| 26 | + with: |
| 27 | + node-version: 20 |
| 28 | + |
| 29 | + - name: Install Node dependencies |
| 30 | + run: npm ci |
| 31 | + env: |
| 32 | + CI: true |
| 33 | + |
| 34 | + - name: Detect coding standard violations (stylelint) |
| 35 | + run: npm run lint:css |
| 36 | + |
| 37 | + lint-js: |
| 38 | + name: 'Lint: JS' |
| 39 | + runs-on: ubuntu-latest |
| 40 | + |
| 41 | + steps: |
| 42 | + - name: Checkout |
| 43 | + uses: actions/checkout@v4 |
| 44 | + |
| 45 | + - name: Setup Node |
| 46 | + uses: actions/setup-node@v4 |
| 47 | + with: |
| 48 | + node-version: 20 |
| 49 | + |
| 50 | + - name: Check Node version |
| 51 | + run: node -v |
| 52 | + |
| 53 | + - name: Install Node dependencies |
| 54 | + run: npm ci |
| 55 | + env: |
| 56 | + CI: true |
| 57 | + |
| 58 | + - name: Detect coding standard violations (eslint) |
| 59 | + run: npm run lint:js |
| 60 | + |
| 61 | + lint-php: |
| 62 | + name: 'Lint: PHP' |
| 63 | + runs-on: ubuntu-latest |
| 64 | + steps: |
| 65 | + - name: Checkout |
| 66 | + uses: actions/checkout@v4 |
| 67 | + |
| 68 | + - name: Setup PHP |
| 69 | + uses: shivammathur/setup-php@v2 |
| 70 | + with: |
| 71 | + php-version: '8.2' |
| 72 | + coverage: none |
| 73 | + tools: cs2pr |
| 74 | + |
| 75 | + - name: Get Composer Cache Directory |
| 76 | + id: composer-cache |
| 77 | + run: echo "::set-output name=dir::$(composer config cache-files-dir)" |
| 78 | + |
| 79 | + - name: Configure Composer cache |
| 80 | + uses: actions/cache@v4 |
| 81 | + with: |
| 82 | + path: ${{ steps.composer-cache.outputs.dir }} |
| 83 | + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} |
| 84 | + restore-keys: | |
| 85 | + ${{ runner.os }}-composer- |
| 86 | +
|
| 87 | + - name: Install Composer dependencies |
| 88 | + run: composer install --prefer-dist --optimize-autoloader --no-progress --no-interaction |
| 89 | + |
| 90 | + - name: Validate composer.json |
| 91 | + run: composer --no-interaction validate --no-check-all |
| 92 | + |
| 93 | + - name: Detect coding standard violations (PHPCS) |
| 94 | + run: npm run lint:php |
0 commit comments