Add unzip binary + separate actions to test and publish (#209)

* Include unzip package to avoid composer warnings
* Separate actions to test and publish
* Exclude builds on changes to README.md and examples
This commit is contained in:
Thomas B 2023-03-12 22:40:22 +01:00 committed by GitHub
parent d442c900e3
commit c744ce9dc7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 71 additions and 9 deletions

View File

@ -1,5 +1,13 @@
name: Build Docker image
on: [push, pull_request]
name: Build & Publish
on:
push:
branches:
- 'master'
paths:
- '!README.md'
- '!examples/**'
tags:
- '*'
jobs:
build-and-testvariants:
name: Build image variants and run tests
@ -47,8 +55,6 @@ jobs:
tags: ${{ matrix.docker-tag }}
# does not work linux/arm/v5 AND linux/mips64le - composer does not support mips64le or armv5 nor does the php image support them on the alpine variant
- name: Run tests
env:
ROUNDCUBEMAIL_TEST_IMAGE: ${{ matrix.docker-tag }}
run: |
set -exu;
for testFile in ${{ join(matrix.test-files, ' ') }};

51
.github/workflows/test.yml vendored Normal file
View File

@ -0,0 +1,51 @@
name: Build & Test
on:
pull_request: {}
push:
branches:
- '!master'
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
- variant: 'fpm'
test-files: 'fpm-postgres'
docker-tag: roundcube/roundcubemail:test-fpm
- variant: 'fpm-alpine'
test-files: 'fpm-postgres'
docker-tag: roundcube/roundcubemail:test-fpm-alpine
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Get docker hub username
id: creds
run: echo '::set-output name=username::${{ secrets.DOCKER_PULL_USERNAME }}'
- name: Login to Docker Hub
if: steps.creds.outputs.username != ''
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_PULL_USERNAME }}
password: ${{ secrets.DOCKER_PULL_PASSWORD }}
- name: Build image for "${{ matrix.variant }}"
run: cd ${{ matrix.variant }} && docker buildx build ./ -t ${{ matrix.docker-tag }}
- name: Run tests
env:
ROUNDCUBEMAIL_TEST_IMAGE: ${{ matrix.docker-tag }}
run: |
set -exu;
for testFile in ${{ join(matrix.test-files, ' ') }};
do
docker-compose -f ./tests/docker-compose.test-${testFile}.yml \
up --exit-code-from=sut --abort-on-container-exit
done

View File

@ -60,6 +60,7 @@ RUN set -ex; \
aspell \
aspell-en \
rsync \
unzip \
; \
rm -rf /var/lib/apt/lists/*

View File

@ -10,7 +10,8 @@ RUN set -ex; \
rsync \
tzdata \
aspell \
aspell-en
aspell-en \
unzip
RUN set -ex; \
\

View File

@ -60,6 +60,7 @@ RUN set -ex; \
aspell \
aspell-en \
rsync \
unzip \
; \
rm -rf /var/lib/apt/lists/*

View File

@ -10,7 +10,8 @@ RUN set -ex; \
rsync \
tzdata \
aspell \
aspell-en
aspell-en \
unzip
RUN set -ex; \
\

View File

@ -60,6 +60,7 @@ RUN set -ex; \
aspell \
aspell-en \
rsync \
unzip \
; \
rm -rf /var/lib/apt/lists/*

View File

@ -2,7 +2,7 @@ version: "2"
services:
roundcubemail:
image: roundcube/roundcubemail:1.6.0-apache
image: ${ROUNDCUBEMAIL_TEST_IMAGE:-roundcube/roundcubemail:latest-apache}
healthcheck:
# To make it obvious in logs "ping=ping" is added
test: ["CMD", "curl", "--fail", "http://localhost/?ping=ping"]

View File

@ -2,7 +2,7 @@ version: "2"
services:
roundcubemail-fpm:
image: roundcube/roundcubemail:1.6.0-fpm
image: ${ROUNDCUBEMAIL_TEST_IMAGE:-roundcube/roundcubemail:latest-fpm}
healthcheck:
# Check until the FPM port is in in the LISTEN list
# test: ["CMD-SHELL", "netstat -an | grep -q -F \":9000\""]