|
1 | | -name: Tests |
| 1 | +name: "Integrate" |
2 | 2 |
|
3 | 3 | # Run this workflow every time a new commit pushed to your repository |
4 | 4 | on: |
5 | 5 | push: |
6 | 6 | paths-ignore: |
7 | 7 | - '**/*.md' |
| 8 | + - 'public/dist/*.js' |
| 9 | + - 'public/dist/**/*.js' |
8 | 10 | pull_request: |
9 | 11 | paths-ignore: |
10 | 12 | - '**/*.md' |
| 13 | + - 'public/dist/*.js' |
| 14 | + - 'public/dist/**/*.js' |
| 15 | + # Allow manually triggering the workflow. |
| 16 | + workflow_dispatch: |
11 | 17 |
|
12 | 18 | jobs: |
13 | | - tests: |
14 | | - runs-on: ${{ matrix.operating-system }} |
| 19 | + kill_previous: |
| 20 | + name: "0️⃣ Kill previous runs" |
| 21 | + runs-on: "ubuntu-latest" |
15 | 22 | # We want to run on external PRs, but not on our own internal PRs as they'll be run by the push to the branch. |
16 | 23 | if: (github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository) |
| 24 | + steps: |
| 25 | + - name: Cancel Previous Runs |
| 26 | + |
| 27 | + with: |
| 28 | + access_token: ${{ github.token }} |
| 29 | + |
| 30 | + php_syntax_errors: |
| 31 | + name: "1️⃣ PHP: Syntax errors" |
| 32 | + runs-on: "ubuntu-latest" |
| 33 | + needs: |
| 34 | + - "kill_previous" |
| 35 | + steps: |
| 36 | + - name: "Set up PHP" |
| 37 | + uses: "shivammathur/setup-php@v2" |
| 38 | + with: |
| 39 | + php-version: "latest" |
| 40 | + |
| 41 | + - name: "Checkout code" |
| 42 | + uses: "actions/checkout@v3" |
| 43 | + |
| 44 | + - name: "Install dependencies" |
| 45 | + uses: "ramsey/composer-install@v2" |
| 46 | + |
| 47 | + - name: Validate files |
| 48 | + run: composer validate-files |
| 49 | + |
| 50 | + code_style_errors: |
| 51 | + name: "1️⃣ PHP: Code Style errors" |
| 52 | + runs-on: "ubuntu-latest" |
| 53 | + needs: |
| 54 | + - "kill_previous" |
| 55 | + steps: |
| 56 | + - name: "Set up PHP" |
| 57 | + uses: "shivammathur/setup-php@v2" |
| 58 | + with: |
| 59 | + php-version: "latest" |
| 60 | + |
| 61 | + - name: "Checkout code" |
| 62 | + uses: "actions/checkout@v3" |
| 63 | + |
| 64 | + - name: "Install dependencies" |
| 65 | + uses: "ramsey/composer-install@v2" |
| 66 | + |
| 67 | + - name: Check Style |
| 68 | + run: composer check-code-style |
| 69 | + |
| 70 | + phpstan: |
| 71 | + name: "2️⃣ PHP: PHPStan" |
| 72 | + runs-on: "ubuntu-latest" |
| 73 | + needs: |
| 74 | + - "php_syntax_errors" |
| 75 | + steps: |
| 76 | + - name: Checkout code |
| 77 | + uses: actions/checkout@v3 |
| 78 | + |
| 79 | + - name: Setup PHP |
| 80 | + uses: shivammathur/[email protected] |
| 81 | + with: |
| 82 | + php-version: "latest" |
| 83 | + coverage: none |
| 84 | + tools: phpstan |
| 85 | + |
| 86 | + - name: Install Composer dependencies |
| 87 | + uses: "ramsey/composer-install@v2" |
| 88 | + |
| 89 | + - name: Run PHPStan |
| 90 | + run: vendor/bin/phpstan analyze |
17 | 91 |
|
| 92 | + tests: |
| 93 | + name: "2️⃣ PHP ${{ matrix.php-version }}: ${{ matrix.beta }} ${{ matrix.dependencies }}" |
| 94 | + needs: |
| 95 | + - "php_syntax_errors" |
| 96 | + runs-on: "ubuntu-latest" |
18 | 97 | strategy: |
19 | 98 | fail-fast: false |
20 | 99 | matrix: |
21 | | - operating-system: [ubuntu-20.04] |
22 | | - php-versions: ['8.0', '8.1'] |
23 | | - beta: ['beta', ''] |
24 | | - dependencies: ['locked', 'lowest', 'highest'] |
| 100 | + php-version: |
| 101 | + - "8.0" |
| 102 | + - "8.1" |
| 103 | + dependencies: |
| 104 | + - "locked" |
| 105 | + - "lowest" |
| 106 | + - "highest" |
| 107 | + beta: |
| 108 | + - "beta" |
| 109 | + - "" |
25 | 110 | exclude: |
26 | | - - beta: 'beta' |
27 | | - dependencies: 'locked' |
28 | | - - beta: 'beta' |
29 | | - dependencies: 'lowest' |
30 | | - |
31 | | - name: PHP ${{ matrix.php-versions }} -- ${{ matrix.beta }} ${{ matrix.dependencies }} |
| 111 | + - beta: "beta" |
| 112 | + dependencies: "locked" |
| 113 | + - beta: "beta" |
| 114 | + dependencies: "lowest" |
32 | 115 |
|
33 | 116 | env: |
34 | 117 | extensions: curl, dom, imagick, json, libxml, mbstring |
35 | | - key: cache-v1 # can be any string, change to clear the extension cache. |
36 | 118 |
|
37 | 119 | steps: |
38 | | - # Checks out a copy of your repository on the ubuntu machine |
39 | 120 | - name: Checkout code |
40 | 121 | uses: actions/checkout@v3 |
41 | 122 |
|
|
48 | 129 | - name: Setup PHP Action |
49 | 130 | uses: shivammathur/[email protected] |
50 | 131 | with: |
51 | | - php-version: ${{ matrix.php-versions }} |
| 132 | + php-version: ${{ matrix.php-version }} |
52 | 133 | extensions: ${{ env.extensions }} |
53 | 134 | coverage: xdebug |
54 | 135 | tools: pecl, composer |
@@ -79,3 +160,44 @@ jobs: |
79 | 160 |
|
80 | 161 | - name: Run tests |
81 | 162 | run: composer run-tests |
| 163 | + |
| 164 | + - name: Codecov |
| 165 | + uses: codecov/codecov-action@v1 |
| 166 | + |
| 167 | + # support for mutation testing. |
| 168 | + # |
| 169 | + # This section is disabled because Mutation testing is a rather slow process |
| 170 | + # and furthermore adds lots of noise into the pull request review panel by Github. |
| 171 | + # While it is an intersting set of tests to have, this does not constitute major |
| 172 | + # improvements to the full code base. |
| 173 | + # |
| 174 | + # TODO: This section can be uncommented once ALL the code paths are evaluted. |
| 175 | + # This unfortunately includes changes such as in_array(...,..., true) into in_array(...,..., false) |
| 176 | + # and other behaviours which are very edge cases |
| 177 | + # |
| 178 | + # infection: |
| 179 | + # name: "3️⃣ PHP: Mutation testing" |
| 180 | + # runs-on: "ubuntu-latest" |
| 181 | + # needs: |
| 182 | + # - "tests" |
| 183 | + # steps: |
| 184 | + # - name: Checkout code |
| 185 | + # uses: actions/checkout@v3 |
| 186 | + |
| 187 | + # - name: Set Up Imagick, FFmpeg & Exiftools |
| 188 | + # run: | |
| 189 | + # sudo apt-get update |
| 190 | + # sudo apt-get --fix-broken install |
| 191 | + # sudo apt-get -y install ffmpeg libimage-exiftool-perl libmagickwand-dev |
| 192 | + |
| 193 | + # - name: Setup PHP |
| 194 | + # uses: shivammathur/[email protected] |
| 195 | + # with: |
| 196 | + # php-version: "latest" |
| 197 | + # coverage: xdebug |
| 198 | + |
| 199 | + # - name: Install Composer dependencies |
| 200 | + # uses: "ramsey/composer-install@v2" |
| 201 | + |
| 202 | + # - name: Run Infection |
| 203 | + # run: vendor/bin/infection |
0 commit comments