YOURLS/.github/workflows/ci.yml

80 lines
2.2 KiB
YAML

name: CI
on:
push:
pull_request:
branches: [ master ]
jobs:
test:
name: PHP ${{ matrix.php }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: ['8.0', '8.1', '8.2']
phpunit: ['9']
include:
- php: '7.4'
phpunit: '8'
coverage: xdebug
flags: '--coverage-clover clover.xml'
services:
mysql:
image: mariadb
ports:
- 3306/tcp
env:
MYSQL_ALLOW_EMPTY_PASSWORD: false
MYSQL_ROOT_PASSWORD: secret
MYSQL_DATABASE: yourls_tests
MARIADB_MYSQL_LOCALHOST_USER: 1
MARIADB_MYSQL_LOCALHOST_GRANTS: USAGE
options: --health-cmd="healthcheck.sh --su-mysql --connect --innodb_initialized" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- uses: actions/checkout@v4
- name: Use PHP ${{ matrix.php }}
uses: shivammathur/setup-php@2.30.4
with:
php-version: ${{ matrix.php }}
extensions: mbstring, curl, zip, dom, simplexml, intl, pdo_mysql
tools: phpunit:${{ matrix.phpunit }}
coverage: ${{ matrix.coverage }}
# - name: Validate composer.json and composer.lock
# run: composer validate
# - name: Cache Composer packages
# id: composer-cache
# uses: actions/cache@v2
# with:
# path: vendor
# key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
# restore-keys: |
# ${{ runner.os }}-php-
# - name: Install dependencies
# if: steps.composer-cache.outputs.cache-hit != 'true'
# run: composer install --prefer-dist --no-progress --no-suggest
# env:
# APP_ENV: testing
# - name: Lint
# run: composer run-script lint
- name: Prepare the application
run: |
git clone https://github.com/ozh/YOURLS-fr_FR.git user/languages/fr
cp user/languages/fr/fr_FR.* user/languages
cp tests/data/config/yourls-tests-config-ci.php user/config.php
- name: Test
run: phpunit --configuration phpunit.xml.dist ${{ matrix.flags }}
env:
DB_PORT: ${{ job.services.mysql.ports['3306'] }}