ci: add Moodle 5.2 Docker checks

This commit is contained in:
2026-08-12 16:57:33 +00:00
parent 482d15db8f
commit d35ce9b445
4 changed files with 113 additions and 76 deletions
+36
View File
@@ -0,0 +1,36 @@
FROM composer:2.10.2@sha256:4d71c3c2109c61d5415544264b59ad4087e4c5b7244481723664138fd36d5040 AS composer
FROM node:22.23.2-bookworm-slim@sha256:d649c27dae7ba0137b3cef5dd75baa422c08dc3d9e3fc0c23dfb172dc3cc6436 AS node
FROM moodlehq/moodle-php-apache:8.4@sha256:07cac70e0ed3f96f334ffeece92075b98adfbe4110312a3a9308b95eab8e2080
ARG MOODLE_PLUGIN_CI_COMMIT=9276f968746960275b12190b4ef8e47b1e6af674
ARG MOODLE_PLUGIN_CI_LOCK_SHA256=e5c8ce77b90f43a057ee717c52e856bf81d43387834dab36083a1c1b17a24be4
COPY --from=composer /usr/bin/composer /usr/local/bin/composer
COPY --from=node /usr/local/bin/node /usr/local/bin/node
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 \
&& rm -rf /var/lib/apt/lists/* \
&& locale-gen en_AU.UTF-8 \
&& git init /opt/moodle-plugin-ci \
&& git -C /opt/moodle-plugin-ci remote add origin https://github.com/moodlehq/moodle-plugin-ci.git \
&& git -C /opt/moodle-plugin-ci fetch --depth 1 origin "${MOODLE_PLUGIN_CI_COMMIT}" \
&& git -C /opt/moodle-plugin-ci checkout --detach FETCH_HEAD \
&& test "$(git -C /opt/moodle-plugin-ci rev-parse HEAD)" = "${MOODLE_PLUGIN_CI_COMMIT}" \
&& echo "${MOODLE_PLUGIN_CI_LOCK_SHA256} /opt/moodle-plugin-ci/composer.lock" | sha256sum --check \
&& COMPOSER_ALLOW_SUPERUSER=1 composer install \
--working-dir=/opt/moodle-plugin-ci \
--no-dev \
--no-interaction \
--prefer-dist \
--classmap-authoritative \
&& ln -s /opt/moodle-plugin-ci/bin/moodle-plugin-ci /usr/local/bin/moodle-plugin-ci
ENV LANG=en_AU.UTF-8
WORKDIR /workspace
+31
View File
@@ -0,0 +1,31 @@
name: Moodle Plugin CI
on:
push:
branches:
- develop
- main
pull_request:
workflow_dispatch:
permissions:
contents: read
jobs:
test:
runs-on: ubuntu-latest
env:
COMPOSE_PROJECT_NAME: local_webhooks_${{ gitea.run_id }}_${{ gitea.run_attempt }}
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
- name: Test plugin
run: docker compose up --abort-on-container-exit --exit-code-from ci
- name: Clean up
if: always()
run: docker compose down --volumes --remove-orphans
-76
View File
@@ -1,76 +0,0 @@
language: php
sudo: true
addons:
firefox: "latest-esr"
postgresql: "9.6"
apt:
packages:
- "oracle-java8-installer"
- "oracle-java8-set-default"
cache:
directories:
- "$HOME/.composer/cache"
- "$HOME/.npm"
php:
- 7.0
- 7.1
- 7.2
env:
global:
- MOODLE_BRANCH=MOODLE_35_STABLE
matrix:
- DB=mysqli
- DB=pgsql
before_install:
- phpenv config-rm xdebug.ini
- nvm install 8.9
- nvm use 8.9
- cd ../..
- composer selfupdate
- composer create-project -n --no-dev --prefer-dist moodlerooms/moodle-plugin-ci ci ^2
- export PATH="$(cd ci/bin; pwd):$(cd ci/vendor/bin; pwd):$PATH"
install:
- moodle-plugin-ci install
script:
- moodle-plugin-ci phplint
- moodle-plugin-ci phpcpd
- moodle-plugin-ci phpmd
- moodle-plugin-ci codechecker
- moodle-plugin-ci validate
- moodle-plugin-ci savepoints
- moodle-plugin-ci mustache
- moodle-plugin-ci grunt
- moodle-plugin-ci phpunit
- moodle-plugin-ci behat
jobs:
include:
- stage: test old
env: DB=mysqli MOODLE_BRANCH=MOODLE_33_STABLE
php: 5.6
- stage: deploy
php: 7.2
before_deploy:
- cd "$TRAVIS_REPO_SLUG"
- git stash --all
- /bin/sh build.sh
deploy:
api_key: $GITHUB_PROJECT_TOKEN
email: "info@valentineus.link"
file: "../build/*.zip"
file_glob: true
provider: releases
skip_cleanup: true
on:
tags: true
+46
View File
@@ -0,0 +1,46 @@
services:
postgres:
image: postgres:16.13-alpine3.22@sha256:caf536ebd910e85473a9f5e2fd1aea360c965c4a911c8555ac1f61b2102006cb
environment:
POSTGRES_HOST_AUTH_METHOD: trust
POSTGRES_USER: postgres
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 2s
timeout: 5s
retries: 15
tmpfs:
- /var/lib/postgresql/data
ci:
build:
context: .
dockerfile: .docker/ci/Dockerfile
depends_on:
postgres:
condition: service_healthy
environment:
DB: pgsql
DB_HOST: postgres
DB_USER: postgres
MOODLE_BRANCH: v5.2.2
NPM_CONFIG_FETCH_RETRIES: 5
volumes:
- .:/plugin:ro
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