Skip to content

Test

Test #67

Workflow file for this run

# yaml-language-server: $schema=https://json.schemastore.org/github-workflow
name: "Test"
#
# Based on workflows from Composer:
#
# * https://github.com/composer/composer/blob/2.5.4/.github/workflows/continuous-integration.yml
# * https://github.com/composer/installers/blob/v2.2.0/.github/workflows/continuous-integration.yml
#
on:
workflow_dispatch:
push:
tags-ignore:
- '**'
pull_request:
tags-ignore:
- '**'
schedule:
# Twice monthly on 1st and 15th at 14:00 UTC.
#
# ┌───────────────── minute (0 - 59)
# │ ┌───────────── hour (0 - 23)
# │ │ ┌───────── day of the month (1 - 31)
# │ │ │ ┌──── month (1 - 12 or JAN-DEC)
# │ │ │ │ ┌─ day of the week (0 - 6 or SUN-SAT)
# │ │ │ │ │
- cron: '0 15 1,15 * *'
env:
COMPOSER_FLAGS: "--ansi --no-interaction --no-progress --prefer-dist"
COMPOSER_UPDATE_FLAGS: ""
permissions:
contents: read
jobs:
tests:
name: "PHP ${{ matrix.php-version }} / Composer ${{ matrix.composer-version }} / ${{ matrix.os }}"
strategy:
matrix:
php-version:
- "7.2"
- "7.3"
- "7.4"
- "8.0"
- "8.1"
- "8.2"
- "8.3"
composer-version:
- "2.5"
- "2.6"
- "2.7"
os:
- "ubuntu-latest"
experimental:
- false
include:
- php-version: "8.2"
composer-version: "2.3"
os: "ubuntu-latest"
experimental: false
- php-version: "8.2"
composer-version: "2.4"
os: "ubuntu-latest"
experimental: false
- php-version: "8.2"
composer-version: "preview"
os: "ubuntu-latest"
experimental: true
- php-version: "8.2"
composer-version: "snapshot"
os: "ubuntu-latest"
experimental: true
- php-version: "8.2"
composer-version: "v2"
os: "windows-latest"
experimental: false
- php-version: "8.4"
composer-version: "v2"
os: "ubuntu-latest"
experimental: true
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.experimental }}
steps:
- name: "Checkout"
uses: "actions/checkout@v4"
- name: "Prepare git environment"
run: "git config --global user.name composer && git config --global user.email [email protected]"
- name: "Setup PHP"
uses: "shivammathur/setup-php@v2"
with:
coverage: "none"
extensions: "intl, zip"
ini-values: "memory_limit=-1, phar.readonly=0, error_reporting=E_ALL, display_errors=On"
php-version: "${{ matrix.php-version }}"
tools: composer:${{ matrix.composer-version }}, phpunit-bridge
env:
fail-fast: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Retrieve Composer cache directory
id: composer-cache
shell: bash
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: "Cache dependencies installed with Composer"
uses: actions/cache@v4
with:
path: "${{ steps.composer-cache.outputs.dir }}"
key: ${{ runner.os }}-composer-${{ matrix.composer-version }}-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-${{ matrix.composer-version }}-
- name: Install Composer dependencies
shell: bash
run: |
# Resolve dependencies according to Composer: ${{ matrix.composer-version }}
if [ "${{ matrix.composer-version }}" == "snapshot" ]; then
composer config platform --unset
composer config minimum-stability dev
composer require ${{ env.COMPOSER_FLAGS }} --update-with-dependencies composer/composer="dev-main"
elif [ "${{ matrix.composer-version }}" == "preview" ]; then
composer config platform --unset
composer config minimum-stability alpha
composer require ${{ env.COMPOSER_FLAGS }} --update-with-dependencies composer/composer
elif [ "${{ matrix.composer-version }}" == "v2" ]; then
composer install ${{ env.COMPOSER_FLAGS }}
else
composer require ${{ env.COMPOSER_FLAGS }} --update-with-dependencies composer/composer="~${{ matrix.composer-version }}.0"
fi
- name: Install PHPUnit
run: "./vendor/bin/simple-phpunit install"
- name: "Run tests"
run: "./vendor/bin/simple-phpunit --verbose"