Bump gh actions and update artifacts/cache keys #23
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: cyberspectrum/i18n | |
on: | |
push: | |
pull_request: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
name: PHP ${{ matrix.php }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- php: '8.1' | |
phpcq_install: 'install' | |
phpcq_flags: '' | |
composer_install: 'update --prefer-lowest' | |
- php: '8.1' | |
phpcq_install: 'update' | |
phpcq_flags: '' | |
composer_install: 'update' | |
- php: '8.2' | |
phpcq_install: 'update' | |
phpcq_flags: '' | |
composer_install: 'update' | |
- php: '8.3' | |
phpcq_install: 'update' | |
phpcq_flags: '' | |
composer_install: 'update' | |
steps: | |
- name: PHP ${{ matrix.php }} Pull source | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
# see https://github.com/shivammathur/setup-php | |
- name: PHP ${{ matrix.php }} Setup PHP. | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
- name: PHP ${{ matrix.php }} Cache composer cache directory | |
uses: actions/cache@v4 | |
env: | |
cache-name: composer-cache-dir-${{ matrix.php }} | |
with: | |
path: ~/.cache/composer | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ matrix.phpcq_install }}-${{ matrix.phpcq_flags }}-${{ matrix.composer_install }} | |
- name: PHP ${{ matrix.php }} Cache vendor directory | |
uses: actions/cache@v4 | |
env: | |
cache-name: composer-vendor-${{ matrix.php }} | |
with: | |
path: vendor | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/composer.lock') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-name }}- | |
- name: PHP ${{ matrix.php }} Install composer dependencies | |
run: composer ${{ matrix.composer_install }} --prefer-stable --no-interaction --no-progress | |
- name: PHP ${{ matrix.php }} Update phpcq | |
run: ./vendor/bin/phpcq self-update --unsigned | |
- name: PHP ${{ matrix.php }} Install phpcq toolchain | |
run: ./vendor/bin/phpcq ${{ matrix.phpcq_install }} -v | |
- name: PHP ${{ matrix.php }} Run tests | |
run: ./vendor/bin/phpcq run -v -o github-action -o default ${{ matrix.phpcq_flags }} | |
- name: PHP ${{ matrix.php }} Upload build directory to artifact | |
uses: actions/upload-artifact@v4 | |
if: ${{ success() }} || ${{ failure() }} | |
with: | |
name: phpcq-builds-php-${{ matrix.php }}-${{ matrix.phpcq_install }}-${{ matrix.phpcq_flags }}-${{ matrix.composer_install }} | |
path: .phpcq/build/ |