Skip to content

Fix/actions

Fix/actions #49

Workflow file for this run

name: Tests
on:
push:
branches: ["master", "main"]
pull_request:
branches: ["master", "main"]
permissions:
contents: read
env:
NODE_VERSION: latest
jobs:
build:
strategy:
fail-fast: false
matrix:
operating-system: ["ubuntu-latest", "macos-latest", "windows-latest"]
php-versions: ["8.0", "8.1", "8.2", "8.3"]
include:
- php-versions: "8.0"
phpunit-versions: 9
- php-versions: "8.1"
phpunit-versions: 10
- php-versions: "8.2"
phpunit-versions: 11
- php-versions: "8.3"
phpunit-versions: 11
runs-on: ${{ matrix.operating-system }}
steps:
- name: Setup PHP ${{ matrix.php-versions }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: mbstring, intl, xdebug, json, sockets
ini-values: max_execution_time=360
coverage: xdebug
tools: php-cs-fixer, phpunit:${{ matrix.phpunit-versions }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: PHP info
run: php -v
- name: Set git to use LF
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- uses: actions/checkout@v4
- name: Validate composer.json and composer.lock
run: composer validate --strict
- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v4
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Validate composer.json and composer.lock
run: composer validate --strict
- name: Install dependencies
run: composer install --prefer-dist --no-progress
- name: Install Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: "npm"
- name: Install Node.js dependencies
run: npm ci
- name: Starting local web server
# bash shell is required for Windows, otherwise the background
# server does not start and work properly
shell: bash
run: npm run start-server &
- name: Wait for server to start up
run: npx wait-on --timeout 15000 http://127.0.0.1:3000
- name: Server warm up
run: sleep 5
# TODO: the problem is that Prettier does not work properly on Windows. Good to fix this in the future.
- if: matrix.operating-system == 'windows-latest'
name: Run short test suite
run: npm run test:small
- if: matrix.operating-system != 'windows-latest'
name: Run full test suite
run: npm run test