use two versions of ubuntu to run CI tests
authorgggeek <giunta.gaetano@gmail.com>
Thu, 24 Nov 2022 17:15:13 +0000 (17:15 +0000)
committergggeek <giunta.gaetano@gmail.com>
Thu, 24 Nov 2022 17:15:13 +0000 (17:15 +0000)
.github/workflows/ci.yml

index 5d464bf..c19c9e5 100644 (file)
@@ -21,11 +21,30 @@ jobs:
         strategy:
             fail-fast: false
             matrix:
-                # @see https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners
-                operating-system: ['ubuntu-20.04'] # @todo add 'windows-latest'. Also: run some tests on ubuntu 22
-                # @todo enable testing on php 5.3. Note that it requires use an older version of phpunit (and there is
-                #       no yoast/phpunit-polyfills support?)
-                php: ['8.1', '8.0', '7.4', '7.3', '7.2', '7.1', '7.0', '5.6', '5.5', '5.4']
+                include:
+                    # @see https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners
+                    # @todo run some tests on 'windows-latest' (needs test env setup scripts for windows to be developed)
+                    -   php: '8.1'
+                        operating-system: ubuntu-22.04
+                        code-coverage: true
+                    -   php: '8.0'
+                        operating-system: ubuntu-22.04
+                    -   php: '7.4'
+                        operating-system: ubuntu-22.04
+                    -   php: '7.3'
+                        operating-system: ubuntu-22.04
+                    -   php: '7.2'
+                        operating-system: ubuntu-20.04
+                    -   php: '7.1'
+                        operating-system: ubuntu-20.04
+                    -   php: '7.0'
+                        operating-system: ubuntu-20.04
+                    -   php: '5.6'
+                        operating-system: ubuntu-20.04
+                    -   php: '5.5'
+                        operating-system: ubuntu-22.04
+                    -   php: '5.4'
+                        operating-system: ubuntu-20.04
         steps:
             -    name: checkout code
                  uses: actions/checkout@v3
@@ -66,16 +85,19 @@ jobs:
             -   name: install dependencies
                 run: 'composer install'
 
-            -   name: run tests and upload coverage info
-                if: ${{ matrix.php == '7.4' }}
+            -   name: run tests and upload coverage info if needed
                 run: |
-                    ./tests/ci/setup/setup_code_coverage.sh enable
-                    ./vendor/bin/phpunit -v --coverage-clover=coverage.clover tests
-                    if [ -f coverage.clover ]; then wget https://uploader.codecov.io/latest/linux/codecov && chmod +x codecov && ./codecov -f coverage.clover; fi
-
-            -   name: run tests
-                if: ${{ matrix.php != '7.4' }}
-                run: './vendor/bin/phpunit -v tests'
+                    if [ "${{ matrix.code-coverage }}" != true ]; then
+                        ./vendor/bin/phpunit -v tests
+                    else
+                        ./tests/ci/setup/setup_code_coverage.sh enable
+                        ./vendor/bin/phpunit -v --coverage-clover=coverage.clover tests
+                        if [ -f coverage.clover ]; then
+                            wget https://uploader.codecov.io/latest/linux/codecov && \
+                            chmod +x codecov && \
+                            ./codecov -f coverage.clover
+                        fi
+                    fi
 
             # @todo would it be useful to run a 2nd test with composer --prefer-lowest? After all the only dependencies we have are testing tools