|
1 | 1 | # https://help.github.com/en/categories/automating-your-workflow-with-github-actions
|
2 | 2 |
|
3 | 3 | on:
|
4 |
| - pull_request: |
5 |
| - push: |
6 |
| - schedule: |
7 |
| - - cron: '3 3 * * 1' |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + pull_request: |
| 8 | + schedule: |
| 9 | + - cron: '3 3 * * 1' |
8 | 10 |
|
9 | 11 | name: CI
|
10 | 12 |
|
11 | 13 | jobs:
|
12 |
| - php-lint: |
13 |
| - name: PHP Lint |
14 |
| - runs-on: ubuntu-22.04 |
15 |
| - strategy: |
16 |
| - matrix: |
17 |
| - php-version: [ '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2' ] |
18 |
| - |
19 |
| - steps: |
20 |
| - - name: Checkout |
21 |
| - uses: actions/checkout@v3 |
22 |
| - |
23 |
| - - name: Install PHP |
24 |
| - uses: shivammathur/setup-php@v2 |
25 |
| - with: |
26 |
| - php-version: ${{ matrix.php-version }} |
27 |
| - coverage: none |
28 |
| - |
29 |
| - - name: PHP Lint |
30 |
| - run: find src tests -name '*.php' -print0 | xargs -0 -n 1 -P 4 php -l |
31 |
| - |
32 |
| - unit-tests: |
33 |
| - name: Unit tests |
34 |
| - |
35 |
| - runs-on: ubuntu-22.04 |
36 |
| - |
37 |
| - needs: [ php-lint ] |
38 |
| - |
39 |
| - strategy: |
40 |
| - fail-fast: false |
41 |
| - matrix: |
42 |
| - php-version: [ '5.6', '7.0', '7.1', '7.2', '7.3' ] |
43 |
| - coverage: [ 'none' ] |
44 |
| - include: |
45 |
| - - php-version: '7.4' |
46 |
| - coverage: xdebug |
47 |
| - |
48 |
| - steps: |
49 |
| - - name: Checkout |
50 |
| - uses: actions/checkout@v3 |
51 |
| - |
52 |
| - - name: Install PHP |
53 |
| - uses: shivammathur/setup-php@v2 |
54 |
| - with: |
55 |
| - php-version: ${{ matrix.php-version }} |
56 |
| - ini-values: error_reporting=E_ALL |
57 |
| - tools: composer:v2 |
58 |
| - coverage: "${{ matrix.coverage }}" |
59 |
| - |
60 |
| - - name: Show the Composer configuration |
61 |
| - run: composer config --global --list |
62 |
| - |
63 |
| - - name: Cache dependencies installed with composer |
64 |
| - uses: actions/cache@v3 |
65 |
| - with: |
66 |
| - path: ~/.cache/composer |
67 |
| - key: php${{ matrix.php-version }}-composer-${{ hashFiles('**/composer.json') }} |
68 |
| - restore-keys: | |
69 |
| - php${{ matrix.php-version }}-composer- |
70 |
| -
|
71 |
| - - name: Install Composer dependencies |
72 |
| - run: | |
73 |
| - composer update --with-dependencies --no-progress; |
74 |
| - composer show; |
75 |
| -
|
76 |
| - - name: Run Tests |
77 |
| - run: ./vendor/bin/phpunit --coverage-clover build/coverage/xml |
78 |
| - |
79 |
| - - name: Upload coverage results to Codacy |
80 |
| - env: |
81 |
| - CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }} |
82 |
| - if: "${{ matrix.coverage != 'none' && env.CODACY_PROJECT_TOKEN != '' }}" |
83 |
| - run: | |
84 |
| - ./vendor/bin/codacycoverage clover build/coverage/xml |
85 |
| -
|
86 |
| - static-analysis: |
87 |
| - name: Static Analysis |
88 |
| - |
89 |
| - runs-on: ubuntu-22.04 |
90 |
| - |
91 |
| - needs: [ php-lint ] |
92 |
| - |
93 |
| - strategy: |
94 |
| - fail-fast: false |
95 |
| - matrix: |
96 |
| - include: |
97 |
| - - command: sniffer |
98 |
| - php-version: '7.4' |
99 |
| - - command: fixer |
100 |
| - php-version: '7.4' |
101 |
| - - command: stan |
102 |
| - php-version: '7.4' |
103 |
| - |
104 |
| - steps: |
105 |
| - - name: Checkout |
106 |
| - uses: actions/checkout@v3 |
107 |
| - |
108 |
| - - name: Install PHP |
109 |
| - uses: shivammathur/setup-php@v2 |
110 |
| - with: |
111 |
| - php-version: ${{ matrix.php-version }} |
112 |
| - tools: "composer:v2, phive" |
113 |
| - coverage: none |
114 |
| - |
115 |
| - - name: Show the Composer configuration |
116 |
| - run: composer config --global --list |
117 |
| - |
118 |
| - - name: Cache dependencies installed with composer |
119 |
| - uses: actions/cache@v3 |
120 |
| - with: |
121 |
| - path: ~/.cache/composer |
122 |
| - key: php${{ matrix.php-version }}-composer-${{ hashFiles('**/composer.json') }} |
123 |
| - restore-keys: | |
124 |
| - php${{ matrix.php-version }}-composer- |
125 |
| -
|
126 |
| - - name: Install Composer dependencies |
127 |
| - run: | |
128 |
| - composer update --with-dependencies --no-progress; |
129 |
| - composer show; |
130 |
| -
|
131 |
| - - name: Install development tools |
132 |
| - run: | |
133 |
| - phive --no-progress install --trust-gpg-keys BBAB5DF0A0D6672989CF1869E82B2FB314E9906E,A972B9ABB95D0B760B51442231C7E470E2138192,D32680D5957DC7116BE29C14CF1A108D0E7AE720 |
134 |
| -
|
135 |
| - - name: Run Command |
136 |
| - run: composer ci:php:${{ matrix.command }} |
| 14 | + php-lint: |
| 15 | + name: PHP Lint |
| 16 | + runs-on: ubuntu-22.04 |
| 17 | + strategy: |
| 18 | + matrix: |
| 19 | + php-version: [ '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3' ] |
| 20 | + |
| 21 | + steps: |
| 22 | + - name: Checkout |
| 23 | + uses: actions/checkout@v4 |
| 24 | + |
| 25 | + - name: Install PHP |
| 26 | + uses: shivammathur/setup-php@v2 |
| 27 | + with: |
| 28 | + php-version: ${{ matrix.php-version }} |
| 29 | + ini-file: development |
| 30 | + tools: composer:v2 |
| 31 | + coverage: none |
| 32 | + |
| 33 | + - name: Show the Composer configuration |
| 34 | + run: composer config --global --list |
| 35 | + |
| 36 | + - name: Cache dependencies installed with composer |
| 37 | + uses: actions/cache@v4 |
| 38 | + with: |
| 39 | + path: ~/.cache/composer |
| 40 | + key: php${{ matrix.php-version }}-composer-${{ hashFiles('**/composer.json') }} |
| 41 | + restore-keys: | |
| 42 | + php${{ matrix.php-version }}-composer- |
| 43 | +
|
| 44 | + - name: Install Composer dependencies |
| 45 | + run: | |
| 46 | + composer update --with-dependencies --no-progress; |
| 47 | + composer show; |
| 48 | +
|
| 49 | + - name: PHP Lint |
| 50 | + run: composer ci:php:lint |
| 51 | + |
| 52 | + unit-tests: |
| 53 | + name: Unit tests |
| 54 | + |
| 55 | + runs-on: ubuntu-22.04 |
| 56 | + |
| 57 | + needs: [ php-lint ] |
| 58 | + |
| 59 | + strategy: |
| 60 | + fail-fast: false |
| 61 | + matrix: |
| 62 | + php-version: [ '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3' ] |
| 63 | + |
| 64 | + steps: |
| 65 | + - name: Checkout |
| 66 | + uses: actions/checkout@v4 |
| 67 | + |
| 68 | + - name: Install PHP |
| 69 | + uses: shivammathur/setup-php@v2 |
| 70 | + with: |
| 71 | + php-version: ${{ matrix.php-version }} |
| 72 | + ini-file: development |
| 73 | + tools: composer:v2 |
| 74 | + coverage: none |
| 75 | + |
| 76 | + - name: Show the Composer configuration |
| 77 | + run: composer config --global --list |
| 78 | + |
| 79 | + - name: Cache dependencies installed with composer |
| 80 | + uses: actions/cache@v4 |
| 81 | + with: |
| 82 | + path: ~/.cache/composer |
| 83 | + key: php${{ matrix.php-version }}-composer-${{ hashFiles('**/composer.json') }} |
| 84 | + restore-keys: | |
| 85 | + php${{ matrix.php-version }}-composer- |
| 86 | +
|
| 87 | + - name: Install Composer dependencies |
| 88 | + run: | |
| 89 | + composer update --with-dependencies --no-progress; |
| 90 | + composer show; |
| 91 | +
|
| 92 | + - name: Run Tests |
| 93 | + run: ./vendor/bin/phpunit |
| 94 | + |
| 95 | + static-analysis: |
| 96 | + name: Static Analysis |
| 97 | + |
| 98 | + runs-on: ubuntu-22.04 |
| 99 | + |
| 100 | + needs: [ php-lint ] |
| 101 | + |
| 102 | + strategy: |
| 103 | + fail-fast: false |
| 104 | + matrix: |
| 105 | + command: |
| 106 | + - fixer |
| 107 | + - stan |
| 108 | + - rector |
| 109 | + php-version: |
| 110 | + - '8.3' |
| 111 | + |
| 112 | + steps: |
| 113 | + - name: Checkout |
| 114 | + uses: actions/checkout@v4 |
| 115 | + |
| 116 | + - name: Install PHP |
| 117 | + uses: shivammathur/setup-php@v2 |
| 118 | + with: |
| 119 | + php-version: ${{ matrix.php-version }} |
| 120 | + ini-file: development |
| 121 | + tools: "composer:v2, phive" |
| 122 | + coverage: none |
| 123 | + |
| 124 | + - name: Show the Composer configuration |
| 125 | + run: composer config --global --list |
| 126 | + |
| 127 | + - name: Cache dependencies installed with composer |
| 128 | + uses: actions/cache@v4 |
| 129 | + with: |
| 130 | + path: ~/.cache/composer |
| 131 | + key: php${{ matrix.php-version }}-composer-${{ hashFiles('**/composer.json') }} |
| 132 | + restore-keys: | |
| 133 | + php${{ matrix.php-version }}-composer- |
| 134 | +
|
| 135 | + - name: Install Composer dependencies |
| 136 | + run: | |
| 137 | + composer update --with-dependencies --no-progress; |
| 138 | + composer show; |
| 139 | +
|
| 140 | + - name: Install development tools |
| 141 | + run: | |
| 142 | + phive --no-progress install --trust-gpg-keys BBAB5DF0A0D6672989CF1869E82B2FB314E9906E |
| 143 | +
|
| 144 | + - name: Run Command |
| 145 | + run: composer ci:php:${{ matrix.command }} |
0 commit comments