Add unzip binary + separate actions to test and publish (#209)
authorThomas B <redacted>
Sun, 12 Mar 2023 21:40:22 +0000 (22:40 +0100)
committerGitHub <redacted>
Sun, 12 Mar 2023 21:40:22 +0000 (22:40 +0100)
* Include unzip package to avoid composer warnings
* Separate actions to test and publish
* Exclude builds on changes to README.md and examples

.github/workflows/build.yml
.github/workflows/test.yml [new file with mode: 0644]
apache/Dockerfile
fpm-alpine/Dockerfile
fpm/Dockerfile
templates/Dockerfile-alpine.templ
templates/Dockerfile-debian.templ
tests/docker-compose.test-apache-postgres.yml
tests/docker-compose.test-fpm-postgres.yml

index 1481b8d5f158363132ecdbb9592f637eaf15afff..09320b1623edde940b6f51a1557c87841ba9a602 100644 (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, ' ') }};
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
new file mode 100644 (file)
index 0000000..27f6ce6
--- /dev/null
@@ -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
+          
+
index d39aff9eaf30b5e37c8d123c06f038de444b693b..8cedd7f578250846b6441639b238a6f946b6a97e 100644 (file)
@@ -60,6 +60,7 @@ RUN set -ex; \
                        aspell \
                        aspell-en \
                        rsync \
+                       unzip \
        ; \
        rm -rf /var/lib/apt/lists/*
 
index 845e65d4d21c5aaab8fc9d7d663d8de6a6a8aa8f..af06558c5c2e9d721cdb30b94678e8a4e6b4c83f 100644 (file)
@@ -10,7 +10,8 @@ RUN set -ex; \
                rsync \
                tzdata \
                aspell \
-               aspell-en
+               aspell-en \
+               unzip
 
 RUN set -ex; \
        \
index 773f3df7e3e74145d722cd622588b45747b16f36..8b8dd08431950c71b80e7e97146b184a8bb7defe 100644 (file)
@@ -60,6 +60,7 @@ RUN set -ex; \
                        aspell \
                        aspell-en \
                        rsync \
+                       unzip \
        ; \
        rm -rf /var/lib/apt/lists/*
 
index cf9e64c3369e5d55e36180309aa28457279ffaa7..d7eea757b0e4e844cb9c605aeb1a58b0da58fcd4 100644 (file)
@@ -10,7 +10,8 @@ RUN set -ex; \
                rsync \
                tzdata \
                aspell \
-               aspell-en
+               aspell-en \
+               unzip
 
 RUN set -ex; \
        \
index 365c40d07fbb734a71dd2e3493eaf0fbf6087031..c0196c276b2fa330d8708e3bccc1409c474e5b6a 100644 (file)
@@ -60,6 +60,7 @@ RUN set -ex; \
                        aspell \
                        aspell-en \
                        rsync \
+                       unzip \
        ; \
        rm -rf /var/lib/apt/lists/*
 
index c6b11fe4b13c70f3305db8d2734156b8b9d9952d..4612b25a0444a780b173a3993d943c481d0856fc 100644 (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"]
index c377de129f5e124c5b1427f1014d1fe2c5813507..28830bfc5461acf2b54c0fc86013171d334fdba2 100644 (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\""]
@@ -91,4 +91,4 @@ networks:
   roundcube_test_net:
 
 volumes:
-  www-vol:
\ No newline at end of file
+  www-vol:
git clone https://git.99rst.org/PROJECT