Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
167 changes: 167 additions & 0 deletions .github/workflows/continuous-integration.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
name: "Continuous Integration"

on:
push:

concurrency:
group: ci-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

env:
DB_ROOT_NAME: root
DB_ROOT_PASS: root

jobs:
ci:
strategy:
matrix:
php-versions:
- "8.1"
- "8.2"
- "8.3"
- "8.4"
#- "8.5"
prefer:
- lowest
- highest

runs-on: ubuntu-latest

permissions:
contents: read

services:
mysql57:
image: mirror.gcr.io/mysql:5.7
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: nori57
MYSQL_USER: nori
MYSQL_PASSWORD: nori
ports:
- 3306/tcp
options: --health-cmd="mysqladmin ping -h localhost" --health-start-period=10s --health-interval=10s --health-timeout=5s --health-retries=3
mysql80:
image: mirror.gcr.io/mysql:8.0
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: nori80
MYSQL_USER: nori
MYSQL_PASSWORD: nori
ports:
- 3306/tcp
options: --health-cmd="mysqladmin ping -h localhost" --health-start-period=10s --health-interval=10s --health-timeout=5s --health-retries=3
mysql84:
image: mirror.gcr.io/mysql:8.4
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: nori84
MYSQL_USER: nori
MYSQL_PASSWORD: nori
ports:
- 3306/tcp
options: --health-cmd="mysqladmin ping -h localhost" --health-start-period=10s --health-interval=10s --health-timeout=5s --health-retries=3
mariadb10:
image: mirror.gcr.io/mariadb:10
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: mariadb10
MYSQL_USER: nori
MYSQL_PASSWORD: nori
ports:
- 3306/tcp
options: --health-cmd="healthcheck.sh --connect --innodb_initialized" --health-start-period=10s --health-interval=10s --health-timeout=5s --health-retries=3
mariadb11:
image: mirror.gcr.io/mariadb:11
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: mariadb11
MYSQL_USER: nori
MYSQL_PASSWORD: nori
ports:
- 3306/tcp
options: --health-cmd="healthcheck.sh --connect --innodb_initialized" --health-start-period=10s --health-interval=10s --health-timeout=5s --health-retries=3
mariadb12:
image: mirror.gcr.io/mariadb:12
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: mariadb12
MYSQL_USER: nori
MYSQL_PASSWORD: nori
ports:
- 3306/tcp
options: --health-cmd="healthcheck.sh --connect --innodb_initialized" --health-start-period=10s --health-interval=10s --health-timeout=5s --health-retries=3

steps:
- uses: actions/checkout@v5

- name: Setup PHP
uses: shivammathur/setup-php@ec406be512d7077f68eed36e63f4d91bc006edc4 # v2.35.4
with:
php-version: ${{ matrix.php-versions }}
extensions: mysqli, pdo_mysql, xsl, opcache, zip
tools: composer
coverage: xdebug
ini-values: opcache.enable_cli=1, opcache.jit_buffer_size=0

- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: Cache dependencies
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ matrix.php-versions }}-${{ matrix.prefer }}-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-${{ matrix.php-versions }}-${{ matrix.prefer }}-

- name: Install dependencies
run: composer install --no-progress --audit

- name: Update dependencies to lowest
if: ${{ matrix.prefer == 'lowest' }}
run: composer update --no-progress --prefer-stable
env:
COMPOSER_PREFER_LOWEST: 1

- name: Run composer validate
run: composer validate --strict

- name: Run PHP CS Fixer
run: composer lint

- name: Run PHPUnit 10
if: ${{ matrix.php-versions == '8.1' || matrix.prefer == 'lowest' }}
run: composer test -- --configuration=phpunit10.xml --coverage-text
env:
XDEBUG_MODE: coverage
MYSQL57_DB_PORT: ${{ job.services.mysql57.ports['3306'] }}
MYSQL80_DB_PORT: ${{ job.services.mysql80.ports['3306'] }}
MYSQL84_DB_PORT: ${{ job.services.mysql84.ports['3306'] }}
MARIADB10_DB_PORT: ${{ job.services.mariadb10.ports['3306'] }}
MARIADB11_DB_PORT: ${{ job.services.mariadb11.ports['3306'] }}
MARIADB12_DB_PORT: ${{ job.services.mariadb12.ports['3306'] }}

- name: Run PHPUnit 11
if: ${{ matrix.php-versions == '8.2' && matrix.prefer == 'highest' }}
run: composer test -- --configuration=phpunit11.xml --coverage-text
env:
XDEBUG_MODE: coverage
MYSQL57_DB_PORT: ${{ job.services.mysql57.ports['3306'] }}
MYSQL80_DB_PORT: ${{ job.services.mysql80.ports['3306'] }}
MYSQL84_DB_PORT: ${{ job.services.mysql84.ports['3306'] }}
MARIADB10_DB_PORT: ${{ job.services.mariadb10.ports['3306'] }}
MARIADB11_DB_PORT: ${{ job.services.mariadb11.ports['3306'] }}
MARIADB12_DB_PORT: ${{ job.services.mariadb12.ports['3306'] }}

- name: Run PHPUnit 12
if: ${{ matrix.php-versions >= '8.3' && matrix.prefer == 'highest' }}
run: composer test -- --configuration=phpunit12.xml --coverage-text
env:
XDEBUG_MODE: coverage
MYSQL57_DB_PORT: ${{ job.services.mysql57.ports['3306'] }}
MYSQL80_DB_PORT: ${{ job.services.mysql80.ports['3306'] }}
MYSQL84_DB_PORT: ${{ job.services.mysql84.ports['3306'] }}
MARIADB10_DB_PORT: ${{ job.services.mariadb10.ports['3306'] }}
MARIADB11_DB_PORT: ${{ job.services.mariadb11.ports['3306'] }}
MARIADB12_DB_PORT: ${{ job.services.mariadb12.ports['3306'] }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/vendor/
/build/
composer.lock
.phpunit.result.cache
16 changes: 0 additions & 16 deletions .travis.yml

This file was deleted.

35 changes: 35 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# syntax=docker/dockerfile:1.6
# check=error=true

ARG PHP_VERSION=8.1

FROM mirror.gcr.io/php:${PHP_VERSION}-cli

# Set up php
RUN \
--mount=type=bind,from=ghcr.io/mlocati/php-extension-installer:latest,source=/usr/bin/install-php-extensions,target=/usr/local/bin/install-php-extensions \
--mount=type=cache,sharing=locked,target=/var/lib/apt \
--mount=type=cache,target=/var/cache/apt \
<<EOL
export DEBIAN_FRONTEND=noninteractive
rm -f /etc/apt/apt.conf.d/docker-clean
echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache
apt-get update
apt-get install -y --no-install-recommends default-mysql-client sudo
install-php-extensions \
@composer-2 \
mysqli \
pdo_mysql \
xdebug \
xsl \
zip

groupadd --gid 1000 phpuser
useradd --gid phpuser --shell /bin/bash --create-home --uid 1000 phpuser
echo "phpuser ALL=(root) NOPASSWD:ALL" > "/etc/sudoers.d/phpuser"
chmod 0440 "/etc/sudoers.d/phpuser"
EOL

USER phpuser
VOLUME [ "/usr/src/app" ]
WORKDIR /usr/src/app
Loading