diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d5d27f1..285a466 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,9 +1,13 @@ -on: [push] +on: + pull_request: + push: + branches: + - main name: CI env: SIMPLETEST_DB: "mysql://drupal:drupal@db:3306/drupal" SIMPLETEST_BASE_URL: "http://127.0.0.1:8888" - DRUPAL_CORE_VERSION: 9.3.x + DRUPAL_CORE_VERSION: 9.5.x SYMFONY_DEPRECATIONS_HELPER: disabled BROWSERTEST_OUTPUT_DIRECTORY: 'sites/simpletest' OPTIONAL_DEPENDENCIES: drupal/helfi_tunnistamo drupal/redirect @@ -32,11 +36,14 @@ jobs: with: fetch-depth: 1 + - name: Parse $MODULE_NAME from composer.json + run: echo "MODULE_NAME=$(cat composer.json | jq -r .name | awk -F/ '{print $NF}')" >> $GITHUB_ENV + - name: Set Drupal root run: echo "DRUPAL_ROOT=$HOME/drupal" >> $GITHUB_ENV - name: Set module folder - run: echo "MODULE_FOLDER=$DRUPAL_ROOT/modules/contrib/${{ secrets.MODULE_NAME }}" >> $GITHUB_ENV + run: echo "MODULE_FOLDER=$DRUPAL_ROOT/modules/contrib/$MODULE_NAME" >> $GITHUB_ENV - name: Clone drupal run: git clone --depth 1 --branch "$DRUPAL_CORE_VERSION" http://git.drupal.org/project/drupal.git/ $DRUPAL_ROOT @@ -47,9 +54,9 @@ jobs: composer config platform.php ${{ matrix.php-versions }} composer config repositories.4 composer https://repository.drupal.hel.ninja/ composer config repositories.5 path $GITHUB_WORKSPACE - composer require drupal/${{ secrets.MODULE_NAME }} -W + composer require drupal/$MODULE_NAME -W composer run-script drupal-phpunit-upgrade - composer require "drush/drush ^10.0" + composer require "drush/drush ^11.0" composer config --no-plugins allow-plugins.dealerdirect/phpcodesniffer-composer-installer true composer require --dev donatj/mock-webserver composer require --dev "drupal/coder" @@ -60,7 +67,7 @@ jobs: run: | cd $DRUPAL_ROOT php -d sendmail_path=$(which true); vendor/bin/drush --yes -v site-install minimal --db-url="$SIMPLETEST_DB" - vendor/bin/drush en ${{ secrets.MODULE_NAME }} -y + vendor/bin/drush en $MODULE_NAME -y - name: Run PHPCS run: | @@ -86,7 +93,7 @@ jobs: - name: Create an artifact from test report uses: actions/upload-artifact@v2 - if: failure() + if: always() with: name: results path: |