[#205] Added selenium-less headless Chrome driver for JavaScript steps. #662
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Test | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| types: | |
| - opened | |
| - synchronize | |
| - reopened | |
| branches: | |
| - main | |
| defaults: | |
| run: | |
| shell: bash | |
| env: | |
| CI: "1" | |
| jobs: | |
| lint: | |
| name: Lint | |
| runs-on: ubuntu-latest | |
| container: | |
| image: drevops/ci-runner:26.6.0@sha256:190027056cac7b7ce28c29a1e5494779ebadc4ee8e95d468b75bc56e7be5aabd | |
| env: | |
| TERM: xterm-256color | |
| PHP_VERSION: '8.3' | |
| DRUPAL_VERSION: '11' | |
| DEPS: 'normal' | |
| PACKAGE_TOKEN: ${{ secrets.PACKAGE_TOKEN }} | |
| steps: | |
| - name: Check out code | |
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7 | |
| - name: Process the codebase to run in CI | |
| run: | | |
| sed -i -e "/###/d" docker-compose.yml | |
| sed -i -e "s/##//" docker-compose.yml | |
| - name: Build stack | |
| run: | | |
| docker compose up -d --build | |
| docker cp -L . "$(docker compose ps -q cli)":/app/ | |
| timeout-minutes: 30 | |
| - name: Install development dependencies | |
| run: | | |
| docker compose exec $(env | cut -f1 -d= | sed 's/^/-e /') -T cli bash -c " \ | |
| if [ -n \"${PACKAGE_TOKEN:-}\" ]; then export COMPOSER_AUTH='{\"github-oauth\": {\"github.com\": \"${PACKAGE_TOKEN-}\"}}'; fi && \ | |
| COMPOSER_MEMORY_LIMIT=-1 composer --ansi install --prefer-dist" | |
| - name: Provision application | |
| run: docker compose exec -e DRUPAL_VERSION=${DRUPAL_VERSION} -e DEPS=${DEPS} -T cli bash scripts/provision.sh | |
| - name: Validate Composer configuration is normalized | |
| run: docker compose exec -T cli composer normalize --dry-run | |
| continue-on-error: ${{ vars.CI_COMPOSER_NORMALIZE_IGNORE_FAILURE == '1' }} | |
| - name: Install Ahoy CLI | |
| run: | | |
| version=2.4.0 && \ | |
| set -x && curl -L -o "/usr/local/bin/ahoy" "https://github.com/ahoy-cli/ahoy/releases/download/v${version}/ahoy-bin-$(uname -s)-amd64" && \ | |
| chmod +x /usr/local/bin/ahoy && \ | |
| ahoy --version | |
| - name: Lint code | |
| run: ahoy lint | |
| continue-on-error: ${{ vars.CI_LINT_IGNORE_FAILURE == '1' }} | |
| - name: Lint documentation | |
| run: ahoy lint-docs | |
| continue-on-error: ${{ vars.CI_LINT_DOCS_IGNORE_FAILURE == '1' }} | |
| test: | |
| name: Test PHP ${{ matrix.php_version }}, Drupal ${{ matrix.drupal_version }}, Deps ${{ matrix.deps }}${{ matrix.driver && format(', Driver {0}', matrix.driver) || '' }} | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - php_version: '8.2' | |
| drupal_version: '10' | |
| deps: 'normal' | |
| - php_version: '8.2' | |
| drupal_version: '10' | |
| deps: 'lowest' | |
| - php_version: '8.3' | |
| drupal_version: '10' | |
| deps: 'normal' | |
| - php_version: '8.3' | |
| drupal_version: '10' | |
| deps: 'lowest' | |
| - php_version: '8.3' | |
| drupal_version: '11' | |
| deps: 'normal' | |
| - php_version: '8.3' | |
| drupal_version: '11' | |
| deps: 'lowest' | |
| - php_version: '8.4' | |
| drupal_version: '10' | |
| deps: 'normal' | |
| - php_version: '8.4' | |
| drupal_version: '10' | |
| deps: 'lowest' | |
| - php_version: '8.4' | |
| drupal_version: '11' | |
| deps: 'normal' | |
| - php_version: '8.4' | |
| drupal_version: '11' | |
| deps: 'lowest' | |
| # Selenium-less driver legs: run the same suite through headless | |
| # Chrome over the DevTools Protocol to prove the steps are driver | |
| # portable. The browser driver is Drupal-version independent, so a | |
| # single normal-deps leg per Drupal version is enough. | |
| - php_version: '8.3' | |
| drupal_version: '10' | |
| deps: 'normal' | |
| driver: 'chrome_headless' | |
| - php_version: '8.3' | |
| drupal_version: '11' | |
| deps: 'normal' | |
| driver: 'chrome_headless' | |
| container: | |
| image: drevops/ci-runner:26.6.0@sha256:190027056cac7b7ce28c29a1e5494779ebadc4ee8e95d468b75bc56e7be5aabd | |
| env: | |
| TERM: xterm-256color | |
| PHP_VERSION: ${{ matrix.php_version }} | |
| DRUPAL_VERSION: ${{ matrix.drupal_version }} | |
| DEPS: ${{ matrix.deps }} | |
| PACKAGE_TOKEN: ${{ secrets.PACKAGE_TOKEN }} | |
| steps: | |
| - name: Check out code | |
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7 | |
| - name: Process the codebase to run in CI | |
| run: | | |
| sed -i -e "/###/d" docker-compose.yml | |
| sed -i -e "s/##//" docker-compose.yml | |
| cat docker-compose.yml | |
| - name: Build stack | |
| run: | | |
| docker compose up -d --build | |
| docker cp -L . "$(docker compose ps -q cli)":/app/ | |
| timeout-minutes: 30 | |
| - name: Install development dependencies | |
| run: | | |
| docker compose exec $(env | cut -f1 -d= | sed 's/^/-e /') -T cli bash -c " \ | |
| if [ -n \"${PACKAGE_TOKEN:-}\" ]; then export COMPOSER_AUTH='{\"github-oauth\": {\"github.com\": \"${PACKAGE_TOKEN-}\"}}'; fi && \ | |
| COMPOSER_MEMORY_LIMIT=-1 composer --ansi install --prefer-dist" | |
| - name: Provision application | |
| run: docker compose exec -e DRUPAL_VERSION=${DRUPAL_VERSION} -e DEPS=${DEPS} -T cli bash scripts/provision.sh | |
| - name: Install Ahoy CLI | |
| run: | | |
| version=2.4.0 && \ | |
| set -x && curl -L -o "/usr/local/bin/ahoy" "https://github.com/ahoy-cli/ahoy/releases/download/v${version}/ahoy-bin-$(uname -s)-amd64" && \ | |
| chmod +x /usr/local/bin/ahoy && \ | |
| ahoy --version | |
| - name: Run Unit tests with coverage | |
| if: "matrix.driver != 'chrome_headless' && matrix.php_version == '8.3' && matrix.drupal_version == '11' && matrix.deps == 'normal'" | |
| run: ahoy test-unit-coverage | |
| continue-on-error: ${{ vars.CI_TEST_IGNORE_FAILURE == '1' }} | |
| - name: Run Unit tests | |
| if: "matrix.driver != 'chrome_headless' && !(matrix.php_version == '8.3' && matrix.drupal_version == '11' && matrix.deps == 'normal')" | |
| run: ahoy test-unit | |
| continue-on-error: ${{ vars.CI_TEST_IGNORE_FAILURE == '1' }} | |
| - name: Run BDD tests with coverage | |
| if: "matrix.driver != 'chrome_headless' && matrix.php_version == '8.3' && matrix.drupal_version == '11' && matrix.deps == 'normal'" | |
| run: ahoy test-bdd-coverage | |
| continue-on-error: ${{ vars.CI_TEST_IGNORE_FAILURE == '1' }} | |
| - name: Run BDD tests | |
| if: "matrix.driver != 'chrome_headless' && !(matrix.php_version == '8.3' && matrix.drupal_version == '11' && matrix.deps == 'normal')" | |
| run: ahoy test-bdd | |
| continue-on-error: ${{ vars.CI_TEST_IGNORE_FAILURE == '1' }} | |
| # Selenium-less leg: the same BDD suite driven through headless Chrome | |
| # over the DevTools Protocol, proving the steps work without Selenium. | |
| - name: Run BDD tests with the chrome_headless driver | |
| if: "matrix.driver == 'chrome_headless'" | |
| run: ahoy test-bdd -- -p chrome_headless | |
| continue-on-error: ${{ vars.CI_TEST_IGNORE_FAILURE == '1' }} | |
| - name: Process test logs and artifacts | |
| if: always() | |
| run: | | |
| mkdir -p .logs | |
| if docker compose ps --services --filter "status=running" | \ | |
| grep -q cli && docker compose exec -T cli test -d /app/.logs; then | |
| docker compose cp cli:/app/.logs/. ".logs/" | |
| fi | |
| - name: Upload test artifacts | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7 | |
| if: always() | |
| with: | |
| name: test-artifacts-php${{ matrix.php_version }}-drupal${{ matrix.drupal_version }}-${{ matrix.deps }} | |
| path: .logs | |
| include-hidden-files: true | |
| retention-days: 30 | |
| - name: Upload code coverage reports to Codecov | |
| uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7 | |
| if: matrix.php_version == '8.3' && matrix.drupal_version == '11' && matrix.deps == 'normal' && env.CODECOV_TOKEN != '' && !startsWith(github.head_ref, 'deps/') | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| directory: .logs/coverage | |
| fail_ci_if_error: false | |
| env: | |
| CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |