fix: add basic auth headers for non-production environments #43
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: Unit Tests | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
# Cancels all previous workflow runs for pull requests that have not completed. | |
concurrency: | |
# The concurrency group contains the workflow name and the branch name for pull requests | |
# or the commit hash for any other events. | |
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} | |
cancel-in-progress: true | |
jobs: | |
unit-php: | |
name: Unit tests on PHP ${{ matrix.php }} | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
strategy: | |
fail-fast: true | |
matrix: | |
php: [ '7.2', '7.3', '7.4', '8.0', '8.1', '8.2' ] | |
env: | |
WP_ENV_PHP_VERSION: ${{ matrix.php }} | |
steps: | |
- name: Checkout project | |
uses: actions/checkout@v3 | |
- name: Setup NodeJS | |
uses: actions/setup-node@v3 | |
with: | |
node-version-file: '.nvmrc' | |
cache: npm | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '${{ matrix.php }}' | |
extensions: mbstring, intl | |
# Ensure that Composer installs the correct versions of packages. | |
- name: Override PHP version in composer.json | |
run: | | |
composer config platform.php '${{ matrix.php }}.99' | |
composer require "composer/installers:^2.0" --no-update | |
- name: Install composer dependencies | |
uses: ramsey/composer-install@v2 | |
with: | |
dependency-versions: 'highest' | |
- name: Npm install and build | |
run: | | |
npm ci | |
npm run build | |
- name: Install WordPress | |
run: npm run env:start | |
- name: Run unit tests | |
run: npm run test:php |