ci: add MySQL 8.4 test lane
This commit is contained in:
@@ -14,7 +14,7 @@ COPY --from=node /usr/local/lib/node_modules /usr/local/lib/node_modules
|
||||
RUN ln -s /usr/local/lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm \
|
||||
&& ln -s /usr/local/lib/node_modules/npm/bin/npx-cli.js /usr/local/bin/npx \
|
||||
&& apt-get update \
|
||||
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends postgresql-client \
|
||||
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends default-mysql-client-core postgresql-client \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& locale-gen en_AU.UTF-8 \
|
||||
&& git init /opt/moodle-plugin-ci \
|
||||
|
||||
+15
-4
@@ -13,19 +13,30 @@ permissions:
|
||||
|
||||
jobs:
|
||||
test:
|
||||
name: Test (${{ matrix.database }})
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- database: postgresql
|
||||
profile: ""
|
||||
service: ci
|
||||
- database: mysql
|
||||
profile: --profile mysql
|
||||
service: ci-mysql
|
||||
env:
|
||||
COMPOSE_PROJECT_NAME: local_webhooks_${{ gitea.run_id }}_${{ gitea.run_attempt }}
|
||||
COMPOSE_PROJECT_NAME: local_webhooks_${{ gitea.run_id }}_${{ gitea.run_attempt }}_${{ matrix.database }}
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: https://github.com/actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
|
||||
- name: Build test image
|
||||
run: docker compose build --pull ci
|
||||
run: docker compose ${{ matrix.profile }} build --pull ${{ matrix.service }}
|
||||
|
||||
- name: Test plugin
|
||||
run: docker compose up --abort-on-container-exit --exit-code-from ci
|
||||
run: docker compose ${{ matrix.profile }} up --abort-on-container-exit --exit-code-from ${{ matrix.service }} ${{ matrix.service }}
|
||||
|
||||
- name: Clean up
|
||||
if: always()
|
||||
run: docker compose down --volumes --remove-orphans
|
||||
run: docker compose ${{ matrix.profile }} down --volumes --remove-orphans --rmi local
|
||||
|
||||
@@ -10,15 +10,26 @@ The `develop` branch is unreleased modernization work toward `6.0.0` and is not
|
||||
|
||||
## Current CI baseline
|
||||
|
||||
Gitea Actions currently tests only Moodle `5.2.2` on PHP `8.4` with PostgreSQL `16`. This is a development baseline, not the final support matrix.
|
||||
Gitea Actions currently tests Moodle `5.2.2` on PHP `8.4` with PostgreSQL `16` and MySQL `8.4`. This is a development baseline, not the final support matrix.
|
||||
|
||||
Run the same checks from the repository root with Docker:
|
||||
|
||||
PostgreSQL:
|
||||
|
||||
```bash
|
||||
export COMPOSE_PROJECT_NAME=local_webhooks_local
|
||||
export COMPOSE_PROJECT_NAME=local_webhooks_local_postgresql
|
||||
docker compose build --pull ci
|
||||
docker compose up --abort-on-container-exit --exit-code-from ci
|
||||
docker compose down --volumes --remove-orphans
|
||||
docker compose up --abort-on-container-exit --exit-code-from ci ci
|
||||
docker compose down --volumes --remove-orphans --rmi local
|
||||
```
|
||||
|
||||
MySQL:
|
||||
|
||||
```bash
|
||||
export COMPOSE_PROJECT_NAME=local_webhooks_local_mysql
|
||||
docker compose --profile mysql build --pull ci-mysql
|
||||
docker compose --profile mysql up --abort-on-container-exit --exit-code-from ci-mysql ci-mysql
|
||||
docker compose --profile mysql down --volumes --remove-orphans --rmi local
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
+52
-20
@@ -1,3 +1,25 @@
|
||||
x-ci: &ci
|
||||
build:
|
||||
context: .
|
||||
dockerfile: .docker/ci/Dockerfile
|
||||
command:
|
||||
- /bin/bash
|
||||
- -lc
|
||||
- |
|
||||
set -euo pipefail
|
||||
php --version
|
||||
composer --version
|
||||
node --version
|
||||
moodle-plugin-ci --version
|
||||
moodle-plugin-ci install --plugin /plugin --branch v5.2.2 --db-host "$$DB_HOST"
|
||||
test "$$(git -C /workspace/moodle rev-parse HEAD)" = "acfa383c13dd46c83ca82894a8e95fac273fda33"
|
||||
moodle-plugin-ci phplint
|
||||
moodle-plugin-ci phpcs --max-warnings 0
|
||||
moodle-plugin-ci phpdoc --max-warnings 0
|
||||
moodle-plugin-ci validate
|
||||
moodle-plugin-ci savepoints
|
||||
moodle-plugin-ci phpunit --fail-on-warning
|
||||
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:16.13-alpine3.22@sha256:caf536ebd910e85473a9f5e2fd1aea360c965c4a911c8555ac1f61b2102006cb
|
||||
@@ -12,10 +34,22 @@ services:
|
||||
tmpfs:
|
||||
- /var/lib/postgresql/data
|
||||
|
||||
mysql:
|
||||
profiles:
|
||||
- mysql
|
||||
image: mysql:8.4.11@sha256:b3b90af2a6552ae30c266fdb7d5dd55f3afb72404bb78d37fe8a23eb857fd3fb
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: moodle_ci
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "mysql --protocol=TCP --host=127.0.0.1 --user=root --password=$$MYSQL_ROOT_PASSWORD --execute='SELECT 1' --silent"]
|
||||
interval: 2s
|
||||
timeout: 5s
|
||||
retries: 30
|
||||
tmpfs:
|
||||
- /var/lib/mysql
|
||||
|
||||
ci:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: .docker/ci/Dockerfile
|
||||
<<: *ci
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
@@ -25,20 +59,18 @@ services:
|
||||
DB_USER: postgres
|
||||
MOODLE_BRANCH: v5.2.2
|
||||
NPM_CONFIG_FETCH_RETRIES: 5
|
||||
command:
|
||||
- /bin/bash
|
||||
- -lc
|
||||
- |
|
||||
set -euo pipefail
|
||||
php --version
|
||||
composer --version
|
||||
node --version
|
||||
moodle-plugin-ci --version
|
||||
moodle-plugin-ci install --plugin /plugin --branch v5.2.2 --db-host postgres
|
||||
test "$$(git -C /workspace/moodle rev-parse HEAD)" = "acfa383c13dd46c83ca82894a8e95fac273fda33"
|
||||
moodle-plugin-ci phplint
|
||||
moodle-plugin-ci phpcs --max-warnings 0
|
||||
moodle-plugin-ci phpdoc --max-warnings 0
|
||||
moodle-plugin-ci validate
|
||||
moodle-plugin-ci savepoints
|
||||
moodle-plugin-ci phpunit --fail-on-warning
|
||||
|
||||
ci-mysql:
|
||||
<<: *ci
|
||||
profiles:
|
||||
- mysql
|
||||
depends_on:
|
||||
mysql:
|
||||
condition: service_healthy
|
||||
environment:
|
||||
DB: mysqli
|
||||
DB_HOST: mysql
|
||||
DB_PASS: moodle_ci
|
||||
DB_USER: root
|
||||
MOODLE_BRANCH: v5.2.2
|
||||
NPM_CONFIG_FETCH_RETRIES: 5
|
||||
|
||||
Reference in New Issue
Block a user