GH Actions: work around intermittent apt-get errors #259
Workflow file for this run
This file contains 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: Quicktest | |
on: | |
# Run on pushes, including merges, to all branches except `main`. | |
push: | |
branches-ignore: | |
- main | |
paths-ignore: | |
- '**.md' | |
# Allow manually triggering the workflow. | |
workflow_dispatch: | |
# Cancels all previous workflow runs for the same branch that have not yet completed. | |
concurrency: | |
# The concurrency group contains the workflow name and the branch name. | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
#### QUICK TEST STAGE #### | |
# This is a much quicker test which only runs the unit tests and linting against the low/high | |
# supported PHP/PHPCS combinations. | |
quicktest: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
include: | |
- php: '5.4' | |
dependencies: 'stable' | |
- php: '5.4' | |
dependencies: 'lowest' | |
- php: 'latest' | |
dependencies: 'stable' | |
- php: 'latest' | |
dependencies: 'lowest' | |
name: "QTest${{ matrix.dependencies == 'stable' && ' + Lint' || '' }}: PHP ${{ matrix.php }} - PHPCS ${{ matrix.dependencies }}" | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
# With stable PHPCS dependencies, allow for PHP deprecation notices. | |
# Unit tests shouldn't fail on those for stable releases where those issues won't get fixed anymore. | |
ini-values: error_reporting=E_ALL & ~E_DEPRECATED, display_errors=On | |
coverage: none | |
# Install dependencies and handle caching in one go. | |
# @link https://github.com/marketplace/actions/install-php-dependencies-with-composer | |
- name: Install Composer dependencies | |
uses: "ramsey/composer-install@v3" | |
with: | |
# Bust the cache at least once a month - output format: YYYY-MM. | |
custom-cache-suffix: $(date -u "+%Y-%m") | |
- name: "Composer: downgrade PHPCS dependencies for tests (lowest)" | |
if: ${{ matrix.dependencies == 'lowest' }} | |
run: > | |
composer update --prefer-lowest --no-scripts --no-interaction | |
squizlabs/php_codesniffer | |
phpcsstandards/phpcsutils | |
phpcsstandards/phpcsextra | |
sirbrillig/phpcs-variable-analysis | |
wp-coding-standards/wpcs | |
- name: Display PHPCS installed standards | |
run: ./vendor/bin/phpcs -i | |
- name: Lint against parse errors | |
if: matrix.dependencies == 'stable' | |
run: ./bin/php-lint | |
- name: Run the unit tests | |
run: ./bin/unit-tests | |
- name: Run the ruleset tests | |
run: ./bin/ruleset-tests |