diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1481b8d..09320b1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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, ' ') }}; diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..27f6ce6 --- /dev/null +++ b/.github/workflows/test.yml @@ -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 + + diff --git a/apache/Dockerfile b/apache/Dockerfile index d39aff9..8cedd7f 100644 --- a/apache/Dockerfile +++ b/apache/Dockerfile @@ -60,6 +60,7 @@ RUN set -ex; \ aspell \ aspell-en \ rsync \ + unzip \ ; \ rm -rf /var/lib/apt/lists/* diff --git a/fpm-alpine/Dockerfile b/fpm-alpine/Dockerfile index 845e65d..af06558 100644 --- a/fpm-alpine/Dockerfile +++ b/fpm-alpine/Dockerfile @@ -10,7 +10,8 @@ RUN set -ex; \ rsync \ tzdata \ aspell \ - aspell-en + aspell-en \ + unzip RUN set -ex; \ \ diff --git a/fpm/Dockerfile b/fpm/Dockerfile index 773f3df..8b8dd08 100644 --- a/fpm/Dockerfile +++ b/fpm/Dockerfile @@ -60,6 +60,7 @@ RUN set -ex; \ aspell \ aspell-en \ rsync \ + unzip \ ; \ rm -rf /var/lib/apt/lists/* diff --git a/templates/Dockerfile-alpine.templ b/templates/Dockerfile-alpine.templ index cf9e64c..d7eea75 100644 --- a/templates/Dockerfile-alpine.templ +++ b/templates/Dockerfile-alpine.templ @@ -10,7 +10,8 @@ RUN set -ex; \ rsync \ tzdata \ aspell \ - aspell-en + aspell-en \ + unzip RUN set -ex; \ \ diff --git a/templates/Dockerfile-debian.templ b/templates/Dockerfile-debian.templ index 365c40d..c0196c2 100644 --- a/templates/Dockerfile-debian.templ +++ b/templates/Dockerfile-debian.templ @@ -60,6 +60,7 @@ RUN set -ex; \ aspell \ aspell-en \ rsync \ + unzip \ ; \ rm -rf /var/lib/apt/lists/* diff --git a/tests/docker-compose.test-apache-postgres.yml b/tests/docker-compose.test-apache-postgres.yml index c6b11fe..4612b25 100644 --- a/tests/docker-compose.test-apache-postgres.yml +++ b/tests/docker-compose.test-apache-postgres.yml @@ -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"] diff --git a/tests/docker-compose.test-fpm-postgres.yml b/tests/docker-compose.test-fpm-postgres.yml index c377de1..28830bf 100644 --- a/tests/docker-compose.test-fpm-postgres.yml +++ b/tests/docker-compose.test-fpm-postgres.yml @@ -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\""] @@ -91,4 +91,4 @@ networks: roundcube_test_net: volumes: - www-vol: \ No newline at end of file + www-vol: