chore(deps): update actions/upload-artifact action to v4 #172
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: "Continuous Integration" | |
on: | |
push: | |
pull_request: | |
env: | |
COMPOSER_FLAGS: "--ansi --no-interaction --no-progress --prefer-dist" | |
COMPOSER_UPDATE_FLAGS: "" | |
jobs: | |
phpunit: | |
name: PHPUnit (PHP ${{ matrix.php }}) | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
services: | |
mariadb: | |
image: mariadb:11.2.2 | |
env: | |
MARIADB_USER: dbtest | |
MARIADB_PASSWORD: dbtest | |
MARIADB_DATABASE: dbtest | |
MARIADB_ALLOW_EMPTY_ROOT_PASSWORD: true | |
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 | |
ports: | |
- 3306:3306 | |
mysql: | |
image: mysql:8 | |
env: | |
MYSQL_USER: dbtest | |
MYSQL_PASSWORD: dbtest | |
MYSQL_DATABASE: dbtest | |
MYSQL_ROOT_PASSWORD: root | |
options: >- | |
--health-cmd="mysqladmin ping" | |
--health-interval=10s | |
--health-timeout=5s | |
--health-retries=3 | |
ports: | |
- 3307:3306 | |
postgres: | |
image: postgres:16 | |
ports: | |
- "5432:5432" | |
env: | |
POSTGRES_USER: dbtest | |
POSTGRES_PASSWORD: dbtest | |
POSTGRES_DB: dbtest | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
strategy: | |
matrix: | |
php: | |
- '8.2' | |
- '8.3' | |
- '8.4' | |
dependencies: [lowest, highest] | |
database: [sqlite] | |
include: | |
- php: '8.3' | |
dependencies: highest | |
coverage: true | |
- php: '8.3' | |
database: mariadb | |
dependencies: highest | |
- php: '8.3' | |
database: mysql | |
dependencies: highest | |
- php: '8.3' | |
database: postgres | |
dependencies: highest | |
fail-fast: false | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
tools: pecl, composer | |
extensions: intl, json, mbstring, pdo_mysql, pdo_pgsql | |
coverage: pcov | |
ini-values: memory_limit=-1 | |
- name: "Handle lowest dependencies update" | |
if: "contains(matrix.dependencies, 'lowest')" | |
run: "echo \"COMPOSER_UPDATE_FLAGS=$COMPOSER_UPDATE_FLAGS --prefer-lowest\" >> $GITHUB_ENV" | |
- name: Get composer cache directory | |
id: composercache | |
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
- name: Cache dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ${{ steps.composercache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} | |
restore-keys: ${{ runner.os }}-composer- | |
- name: Enable code coverage | |
if: matrix.coverage | |
run: echo "COVERAGE=1" >> $GITHUB_ENV | |
- name: "Update dependencies from composer.json using composer binary provided by system" | |
run: "composer update ${{ env.COMPOSER_UPDATE_FLAGS }} ${{ env.COMPOSER_FLAGS }}" | |
- name: Run PHPUnit tests | |
if: matrix.database == 'sqlite' | |
env: | |
DATABASE_URL: sqlite:///%kernel.project_dir%/var/data.db | |
run: | | |
mkdir -p build/logs/phpunit | |
if [ "$COVERAGE" = '1' ]; then | |
vendor/bin/phpunit --coverage-clover build/logs/phpunit/clover.xml --log-junit build/logs/phpunit/junit.xml | |
else | |
vendor/bin/phpunit --log-junit build/logs/phpunit/junit.xml | |
fi | |
- name: Run tests on MariaDB | |
if: matrix.database == 'mariadb' | |
env: | |
DATABASE_URL: mysql://dbtest:dbtest@127.0.0.1:3306/dbtest?serverVersion=mariadb-11.0.2 | |
run: | | |
vendor/bin/phpunit --group=database | |
- name: Run tests on MySQL | |
if: matrix.database == 'mysql' | |
env: | |
DATABASE_URL: mysql://dbtest:dbtest@127.0.0.1:3307/dbtest?serverVersion=8.0 | |
run: | | |
vendor/bin/phpunit --group=database | |
- name: Run tests on Postgres | |
if: matrix.database == 'postgres' | |
env: | |
DATABASE_URL: pgsql://dbtest:dbtest@127.0.0.1:5432/dbtest?serverVersion=13 | |
run: | | |
vendor/bin/phpunit --group=database | |
- name: Upload test artifacts | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: phpunit-logs-php${{ matrix.php }} | |
path: build/logs/phpunit | |
continue-on-error: true | |
- name: Upload coverage results to Coveralls | |
if: matrix.coverage | |
env: | |
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
composer global require --prefer-dist --no-interaction --no-progress --ansi php-coveralls/php-coveralls | |
php-coveralls --coverage_clover=build/logs/phpunit/clover.xml -v | |
continue-on-error: true |