diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6560d8b..400f10c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,14 +6,13 @@ on: name: CI env: SYMFONY_DEPRECATIONS_HELPER: disabled - BROWSERTEST_OUTPUT_DIRECTORY: 'public/sites/simpletest' COMPOSER_DEPENDENCIES: drupal/redirect drupal/helfi_tunnistamo drupal/simple_sitemap drupal/varnish_purger jobs: tests: runs-on: ubuntu-latest strategy: matrix: - php-versions: ['8.1', '8.2'] + php-versions: ['8.1', '8.2', '8.3'] container: image: ghcr.io/city-of-helsinki/drupal-php-docker:${{ matrix.php-versions }}-alpine @@ -29,9 +28,9 @@ jobs: - 3306:3306 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: - fetch-depth: 1 + fetch-depth: 0 - name: Parse $MODULE_NAME from composer.json run: echo "MODULE_NAME=$(cat composer.json | jq -r .name | awk -F/ '{print $NF}')" >> $GITHUB_ENV @@ -40,7 +39,9 @@ jobs: run: echo "DRUPAL_ROOT=$HOME/drupal" >> $GITHUB_ENV - name: Set module folder - run: echo "MODULE_FOLDER=$DRUPAL_ROOT/public/modules/contrib/$MODULE_NAME" >> $GITHUB_ENV + run: | + echo "MODULE_FOLDER=$DRUPAL_ROOT/public/modules/contrib/$MODULE_NAME" >> $GITHUB_ENV + echo "BROWSERTEST_OUTPUT_DIRECTORY=$DRUPAL_ROOT/public/sites/simpletest" >> $GITHUB_ENV - name: Clone platform run: | @@ -67,7 +68,7 @@ jobs: - name: Run PHPCS working-directory: ${{ env.DRUPAL_ROOT }} - run: vendor/bin/phpcs $MODULE_FOLDER --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,info + run: vendor/bin/phpcs $MODULE_FOLDER --standard=Drupal,DrupalPractice --extensions=php,module,install - name: Run phpstan working-directory: ${{ env.DRUPAL_ROOT }} @@ -75,9 +76,7 @@ jobs: - name: Start services working-directory: ${{ env.DRUPAL_ROOT }} - run: | - vendor/bin/drush runserver $SIMPLETEST_BASE_URL > /dev/null 2>&1 & - chromedriver --port=4444 > /dev/null 2>&1 & + run: vendor/bin/drush runserver $SIMPLETEST_BASE_URL --dns & - name: Run PHPUnit tests working-directory: ${{ env.DRUPAL_ROOT }} @@ -87,14 +86,15 @@ jobs: -c $MODULE_FOLDER/phpunit.xml \ --coverage-clover=$MODULE_FOLDER/coverage.xml \ $MODULE_FOLDER - codecov --rootDir $MODULE_FOLDER + + - name: Run codecov + working-directory: ${{ env.MODULE_FOLDER }} + run: codecov - name: Create an artifact from test report - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: always() with: - name: results - path: | - ${{ env.DRUPAL_ROOT }}/sites/simpletest/browser_output/ - ${{ env.DRUPAL_ROOT }}/coverage.xml + name: results-${{ matrix.php-versions }} + path: ${{ env.BROWSERTEST_OUTPUT_DIRECTORY }} retention-days: 1