Skip to content

Merge pull request #6 from octobercms/warm-october-caches #67

Merge pull request #6 from octobercms/warm-october-caches

Merge pull request #6 from octobercms/warm-october-caches #67

Workflow file for this run

name: CI
on:
push:
pull_request:
workflow_call:
jobs:
image:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- id: base
image: runtime-base
dockerfile: images/base/Dockerfile
- id: dev
image: runtime-dev
dockerfile: images/dev/Dockerfile
- id: prod
image: runtime-prod
dockerfile: images/prod/Dockerfile
- id: worker
image: runtime-worker
dockerfile: images/worker/Dockerfile
steps:
- uses: actions/checkout@v6
- name: Build base image
run: docker build -t runtime-base:ci -f images/base/Dockerfile .
- name: Build image
if: matrix.id != 'base'
run: |
docker build -t ${{ matrix.image }}:ci \
--build-arg BASE_IMAGE=runtime-base:ci \
-f ${{ matrix.dockerfile }} .
- name: Smoke test PHP version
if: matrix.id == 'base'
run: docker run --rm runtime-base:ci php -v | grep -F 'PHP 8.5'
- name: Smoke test Composer
if: matrix.id == 'base'
run: docker run --rm runtime-base:ci composer --version
- name: Smoke test Node tooling
if: matrix.id == 'base'
run: |
docker run --rm runtime-base:ci node --version
docker run --rm runtime-base:ci npm --version
docker run --rm runtime-base:ci pnpm --version
docker run --rm runtime-base:ci yarn --version
- name: Smoke test base extensions
if: matrix.id == 'base'
run: |
docker run --rm runtime-base:ci php -r '
$required = ["curl", "gd", "mbstring", "pdo_mysql", "simplexml", "xml", "zip"];
foreach ($required as $extension) {
if (!extension_loaded($extension)) {
fwrite(STDERR, "Missing extension: {$extension}\n");
exit(1);
}
}
echo "All required extensions loaded\n";
'
- name: Smoke test PHP-FPM
if: matrix.id == 'base' || matrix.id == 'dev' || matrix.id == 'prod'
run: docker run --rm ${{ matrix.image }}:ci php-fpm -t
- name: Smoke test dev extensions
if: matrix.id == 'dev'
run: |
docker run --rm runtime-dev:ci php -r '
$required = ["pdo_pgsql", "pdo_sqlite"];
foreach ($required as $extension) {
if (!extension_loaded($extension)) {
fwrite(STDERR, "Missing extension: {$extension}\n");
exit(1);
}
}
echo "All dev extensions loaded\n";
'
- name: Smoke test nginx
if: matrix.id == 'dev' || matrix.id == 'prod'
run: |
docker run --rm ${{ matrix.image }}:ci nginx -v
docker run --rm ${{ matrix.image }}:ci nginx -t
- name: Build devcontainer image
if: matrix.id == 'dev'
run: |
docker build -t runtime-devcontainer:ci \
--build-arg DEV_IMAGE=runtime-dev:ci \
-f .devcontainer/Dockerfile .
- name: Smoke test devcontainer
if: matrix.id == 'dev'
run: bash scripts/devcontainer-smoke-test.sh runtime-devcontainer:ci
- name: Smoke test prod extensions
if: matrix.id == 'prod'
run: |
docker run --rm runtime-prod:ci php -r '
$required = ["pdo_pgsql"];
foreach ($required as $extension) {
if (!extension_loaded($extension)) {
fwrite(STDERR, "Missing extension: {$extension}\n");
exit(1);
}
}
echo "All prod extensions loaded\n";
'
- name: Smoke test supervisor
if: matrix.id == 'prod'
run: docker run --rm runtime-prod:ci supervisord --version
- name: Smoke test health endpoint
if: matrix.id == 'prod'
run: |
cid=$(docker run -d runtime-prod:ci)
trap 'docker rm -f "$cid"' EXIT
for i in $(seq 1 30); do
if docker exec "$cid" /usr/local/bin/healthcheck.sh; then
exit 0
fi
sleep 1
done
echo "Health check failed"
docker logs "$cid"
exit 1
- name: Smoke test production scheduler
if: matrix.id == 'prod'
run: bash scripts/prod-scheduler-smoke-test.sh runtime-prod:ci
- name: Smoke test prod cache warm
if: matrix.id == 'prod'
run: bash scripts/cache-warm-smoke-test.sh runtime-prod:ci
- name: Smoke test prod libpq SSL home
if: matrix.id == 'prod'
run: bash scripts/libpq-ssl-home-smoke-test.sh runtime-prod:ci
- name: Smoke test worker extensions
if: matrix.id == 'worker'
run: |
docker run --rm runtime-worker:ci php -r '
$required = ["pcntl", "pdo_pgsql", "pdo_sqlite", "posix"];
foreach ($required as $extension) {
if (!extension_loaded($extension)) {
fwrite(STDERR, "Missing extension: {$extension}\n");
exit(1);
}
}
echo "All worker extensions loaded\n";
'
- name: Smoke test worker excludes web stack
if: matrix.id == 'worker'
run: |
if docker run --rm --entrypoint bash runtime-worker:ci -lc 'command -v nginx'; then
echo "nginx should not be installed in runtime-worker"
exit 1
fi
if docker run --rm --entrypoint bash runtime-worker:ci -lc 'command -v supervisord'; then
echo "supervisord should not be installed in runtime-worker"
exit 1
fi
- name: Smoke test worker queue processing
if: matrix.id == 'worker'
run: bash scripts/worker-queue-smoke-test.sh runtime-worker:ci
- name: Smoke test worker cache warm
if: matrix.id == 'worker'
run: bash scripts/cache-warm-smoke-test.sh runtime-worker:ci
- name: Smoke test worker libpq SSL home
if: matrix.id == 'worker'
run: bash scripts/libpq-ssl-home-smoke-test.sh runtime-worker:ci