mirror of
https://github.com/roundcube/roundcubemail-docker.git
synced 2026-02-18 04:41:07 +01:00
97 lines
3.4 KiB
YAML
97 lines
3.4 KiB
YAML
name: Build & Test
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
on:
|
|
pull_request:
|
|
paths-ignore:
|
|
- "development/**"
|
|
- .github/workflows/*-development.yml
|
|
- "nightly/**"
|
|
- "examples/**"
|
|
- "README.md"
|
|
- apache-1.5.x/**
|
|
- fpm-1.5.x/**
|
|
- fpm-alpine-1.5.x/**
|
|
- .github/workflows/*-1.5.yml
|
|
|
|
jobs:
|
|
build-and-testvariants:
|
|
name: Build image variants and run tests
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
max-parallel: 10
|
|
matrix:
|
|
include:
|
|
- variant: 'apache'
|
|
test-files: 'apache-postgres'
|
|
docker-tag: roundcube/roundcubemail:test-apache
|
|
docker-tag-nonroot: roundcube/roundcubemail:test-apache-nonroot
|
|
http-port-nonroot: '8000'
|
|
- variant: 'fpm'
|
|
test-files: 'fpm-postgres'
|
|
docker-tag: roundcube/roundcubemail:test-fpm
|
|
docker-tag-nonroot: roundcube/roundcubemail:test-fpm-nonroot
|
|
- variant: 'fpm-alpine'
|
|
test-files: 'fpm-postgres'
|
|
docker-tag: roundcube/roundcubemail:test-fpm-alpine
|
|
docker-tag-nonroot: roundcube/roundcubemail:test-fpm-alpine-nonroot
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
- name: Set up Docker
|
|
# This step is required to enable the containerd image store, which is required by the cache type=gha
|
|
uses: docker/setup-docker-action@efe9e3891a4f7307e689f2100b33a155b900a608 # v4.5.0
|
|
with:
|
|
daemon-config: |
|
|
{
|
|
"debug": true,
|
|
"features": {
|
|
"containerd-snapshotter": true
|
|
}
|
|
}
|
|
|
|
- name: Build rootful image for "${{ matrix.variant }}"
|
|
uses: docker/build-push-action@471d1dc4e07e5cdedd4c2171150001c434f0b7a4 # v6.15.0
|
|
with:
|
|
context: ${{ matrix.variant }}
|
|
load: true
|
|
tags: ${{ matrix.docker-tag }}
|
|
target: root
|
|
cache-from: type=gha
|
|
cache-to: type=gha,mode=max
|
|
- name: Test rootful image
|
|
env:
|
|
ROUNDCUBEMAIL_TEST_IMAGE: ${{ matrix.docker-tag }}
|
|
HTTP_PORT: '80'
|
|
run: |
|
|
set -exu;
|
|
for testFile in ${{ join(matrix.test-files, ' ') }};
|
|
do
|
|
docker compose -f ./tests/docker-compose.test-${testFile}.yml down -v
|
|
docker compose -f ./tests/docker-compose.test-${testFile}.yml up --exit-code-from=sut --abort-on-container-exit
|
|
done
|
|
|
|
- name: Build nonroot image for "${{ matrix.variant }}"
|
|
uses: docker/build-push-action@471d1dc4e07e5cdedd4c2171150001c434f0b7a4 # v6.15.0
|
|
with:
|
|
context: ${{ matrix.variant }}
|
|
load: true
|
|
tags: ${{ matrix.docker-tag-nonroot }}
|
|
target: nonroot
|
|
cache-from: type=gha
|
|
cache-to: type=gha,mode=max
|
|
- name: Test nonroot image
|
|
env:
|
|
ROUNDCUBEMAIL_TEST_IMAGE: ${{ matrix.docker-tag-nonroot }}
|
|
HTTP_PORT: ${{ matrix.http-port-nonroot || '80' }}
|
|
run: |
|
|
set -exu;
|
|
for testFile in ${{ join(matrix.test-files, ' ') }};
|
|
do
|
|
docker compose -f ./tests/docker-compose.test-${testFile}.yml down -v
|
|
docker compose -f ./tests/docker-compose.test-${testFile}.yml up --exit-code-from=sut --abort-on-container-exit
|
|
done
|