diff --git a/.github/workflows/lint-test.yml b/.github/workflows/lint-test.yml index 245871a8..e8498563 100644 --- a/.github/workflows/lint-test.yml +++ b/.github/workflows/lint-test.yml @@ -39,8 +39,10 @@ jobs: php-version: 8.3 - name: Install dependencies run: composer install -n --prefer-dist - - name: Run PHPCS + - name: Lint run: composer lint + - name: Codesniffer + run: composer phpcs php8-compatibility: name: PHP 8.x Compatibility runs-on: ubuntu-latest diff --git a/.github/workflows/test-behat.yml b/.github/workflows/test-behat.yml index 476610ff..cb271f2a 100644 --- a/.github/workflows/test-behat.yml +++ b/.github/workflows/test-behat.yml @@ -2,12 +2,9 @@ name: Behat CI on: push: - branches: [ master, main ] + branches: [ develop, main, release ] pull_request: workflow_dispatch: - schedule: - # Nightly at 00:00 UTC (CircleCI had cron "0 0 * * *" with branch filter=master) - - cron: "0 0 * * *" permissions: contents: read @@ -20,10 +17,16 @@ jobs: runs-on: ubuntu-latest + strategy: + matrix: + php-version: ['7.4', '8.1', '8.3'] + fail-fast: false + env: RUN_NUM: ${{ github.run_number }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} TERMINUS_TOKEN: ${{ secrets.TERMINUS_TOKEN }} + PHP_VERSION_OVERRIDE: ${{ matrix.php-version }} steps: - name: Checkout @@ -41,9 +44,6 @@ jobs: - name: Install dependencies run: composer install -n --prefer-dist - - name: Run PHP Lint - run: composer phpcs - - name: Install Terminus uses: pantheon-systems/terminus-github-actions@v1 with: @@ -62,10 +62,11 @@ jobs: - name: Export env run: | + PHP_VERSION_CLEAN=$(echo "${{ matrix.php-version }}" | tr -d '.') { - echo "TERMINUS_ENV=ci-${RUN_NUM}" + echo "TERMINUS_ENV=ci-${RUN_NUM}-php${PHP_VERSION_CLEAN}" echo "TERMINUS_SITE=wp-native-php-sessions" - echo "SITE_ENV=wp-native-php-sessions.ci-${RUN_NUM}" + echo "SITE_ENV=wp-native-php-sessions.ci-${RUN_NUM}-php${PHP_VERSION_CLEAN}" echo "WORDPRESS_ADMIN_USERNAME=pantheon" echo "WORDPRESS_ADMIN_EMAIL=no-reply@getpantheon.com" echo "WORDPRESS_ADMIN_PASSWORD=$(cat /tmp/WORDPRESS_ADMIN_PASSWORD)" @@ -100,6 +101,6 @@ jobs: - name: Behat tests (strict) run: ./bin/behat-test.sh --strict - - name: Cleanup (always) - if: always() - run: ./bin/behat-cleanup.sh + # - name: Cleanup (always) + # if: always() + # run: ./bin/behat-cleanup.sh diff --git a/bin/behat-prepare.sh b/bin/behat-prepare.sh index def5a4a6..147b98e0 100755 --- a/bin/behat-prepare.sh +++ b/bin/behat-prepare.sh @@ -63,12 +63,33 @@ rm -rf "$PREPARE_DIR"/wp-content/mu-plugins/sessions-debug.php cp "$BASH_DIR"/fixtures/sessions-debug.php "$PREPARE_DIR"/wp-content/mu-plugins/sessions-debug.php ### -# Push files to the environment +# Configure PHP version if specified ### cd "$PREPARE_DIR" -git add wp-content git config user.email "wp-native-php-sessions@getpantheon.com" git config user.name "Pantheon" + +if [ -n "${PHP_VERSION_OVERRIDE:-}" ]; then + echo "Setting PHP version to: $PHP_VERSION_OVERRIDE" + + # Check current PHP version in pantheon.yml + CURRENT_PHP_VERSION=$(grep "^php_version:" pantheon.yml | cut -d' ' -f2) + + if [ "$CURRENT_PHP_VERSION" != "$PHP_VERSION_OVERRIDE" ]; then + # Update the existing pantheon.yml file with the new PHP version + sed -i.bak "s/^php_version:.*/php_version: $PHP_VERSION_OVERRIDE/" pantheon.yml + git add pantheon.yml + git commit -m "Set PHP version to $PHP_VERSION_OVERRIDE" + echo "PHP version changed from $CURRENT_PHP_VERSION to $PHP_VERSION_OVERRIDE" + else + echo "PHP version already set to $PHP_VERSION_OVERRIDE, no change needed" + fi +fi + +### +# Push files to the environment +### +git add wp-content git commit -m "Include WP Native PHP Sessions and its configuration files" git push