Browse Source

ci: split unstable build and test workflows (#1601)

* ci: split unstable build and test workflows

In order to make multi-arch builds the buildx action will use the
docker-container driver, which does not support loading images, and thus
the jvb image won't be built based on the "base-java" image, in turn based
on the "base" image. That works only when pushing.

If we setup buildx to use the "docker" driver it will just build for the
current architecture, but it will properly load images and the base
images will be used correctly.

One downside is that jobs cannot be run in parallel, but it seems to be Fast Enough (R) for now.
Saúl Ibarra Corretgé 1 year ago
parent
commit
b3abfc0
2 changed files with 84 additions and 134 deletions
  1. 84 0
      .github/workflows/ci.yml
  2. 0 134
      .github/workflows/unstable.yml

+ 84 - 0
.github/workflows/ci.yml

@@ -0,0 +1,84 @@
+name: CI Test Build
+
+on:
+  pull_request:
+  push:
+    branches:
+    - master
+
+jobs:
+  build:
+    runs-on: ubuntu-latest
+    steps:
+      - name: Check out code
+        uses: actions/checkout@v3
+      - name: Setup Docker Buildx
+        uses: docker/setup-buildx-action@v2
+        with:
+          driver: docker
+
+      - name: Build base
+        uses: docker/build-push-action@v2
+        with:
+          context: ./base
+          load: true
+          tags: |
+            jitsi/base:latest
+          build-args: |
+            JITSI_RELEASE=unstable
+
+      - name: Build base-java
+        uses: docker/build-push-action@v2
+        with:
+          context: ./base-java
+          load: true
+          tags: |
+            jitsi/base-java:latest
+
+      - name: Build jibri
+        uses: docker/build-push-action@v2
+        with:
+          context: ./jibri
+          load: true
+          tags: |
+            jitsi/jibri:latest
+
+      - name: Build jicofo
+        uses: docker/build-push-action@v2
+        with:
+          context: ./jicofo
+          load: true
+          tags: |
+            jitsi/jicofo:latest
+
+      - name: Build jigasi
+        uses: docker/build-push-action@v2
+        with:
+          context: ./jigasi
+          load: true
+          tags: |
+            jitsi/jigasi:latest
+
+      - name: Build jvb
+        uses: docker/build-push-action@v2
+        with:
+          context: ./jvb
+          load: true
+          tags: |
+            jitsi/jvb:latest
+
+      - name: Build prosody
+        uses: docker/build-push-action@v2
+        with:
+          context: ./prosody
+          load: true
+          tags: |
+            jitsi/prosody:latest
+
+      - name: Build web
+        uses: docker/build-push-action@v2
+        with:
+          context: ./web
+          load: true
+          tags: |
+            jitsi/web:latest

+ 0 - 134
.github/workflows/unstable.yml

@@ -1,7 +1,6 @@
 name: Unstable Build
 
 on:
-  pull_request:
   schedule:
     - cron: "0 6 * * *"
   workflow_dispatch:
@@ -70,13 +69,11 @@ jobs:
         uses: docker/setup-buildx-action@v1
       - name: Login to DockerHub
         uses: docker/login-action@v1
-        if: ${{ github.event_name != 'pull_request' }}
         with:
           username: ${{ secrets.DOCKERHUB_USERNAME }}
           password: ${{ secrets.DOCKERHUB_TOKEN }}
       - name: Build and push
         uses: docker/build-push-action@v2
-        if: ${{ github.event_name != 'pull_request' }}
         with:
           push: true
           context: ./base
@@ -88,19 +85,6 @@ jobs:
           platforms: linux/amd64,linux/arm64
           cache-from: type=gha
           cache-to: type=gha,mode=max
-      - name: Dryrun
-        uses: docker/build-push-action@v2
-        if: ${{ github.event_name == 'pull_request' }}
-        with:
-          context: ./base
-          tags: |
-            jitsi/base:${{ needs.version.outputs.base }}
-            jitsi/base:${{ needs.version.outputs.date }}
-          build-args: |
-            JITSI_RELEASE=unstable
-          platforms: linux/amd64,linux/arm64
-          cache-from: type=gha
-          cache-to: type=gha,mode=max
 
   base-java:
     runs-on: ubuntu-latest
@@ -116,13 +100,11 @@ jobs:
         uses: docker/setup-buildx-action@v1
       - name: Login to DockerHub
         uses: docker/login-action@v1
-        if: ${{ github.event_name != 'pull_request' }}
         with:
           username: ${{ secrets.DOCKERHUB_USERNAME }}
           password: ${{ secrets.DOCKERHUB_TOKEN }}
       - name: Build and push
         uses: docker/build-push-action@v2
-        if: ${{ github.event_name != 'pull_request' }}
         with:
           push: true
           context: ./base-java
@@ -135,20 +117,6 @@ jobs:
           platforms: linux/amd64,linux/arm64
           cache-from: type=gha
           cache-to: type=gha,mode=max
-      - name: Dryrun
-        uses: docker/build-push-action@v2
-        if: ${{ github.event_name == 'pull_request' }}
-        with:
-          context: ./base-java
-          tags: |
-            jitsi/base-java:${{ needs.version.outputs.base }}
-            jitsi/base-java:${{ needs.version.outputs.date }}
-          build-args: |
-            JITSI_REPO=jitsi
-            BASE_TAG=${{ needs.version.outputs.base }}
-          platforms: linux/amd64,linux/arm64
-          cache-from: type=gha
-          cache-to: type=gha,mode=max
 
   jibri:
     runs-on: ubuntu-latest
@@ -164,13 +132,11 @@ jobs:
         uses: docker/setup-buildx-action@v1
       - name: Login to DockerHub
         uses: docker/login-action@v1
-        if: ${{ github.event_name != 'pull_request' }}
         with:
           username: ${{ secrets.DOCKERHUB_USERNAME }}
           password: ${{ secrets.DOCKERHUB_TOKEN }}
       - name: Build and push
         uses: docker/build-push-action@v2
-        if: ${{ github.event_name != 'pull_request' }}
         with:
           push: true
           context: ./jibri
@@ -184,21 +150,6 @@ jobs:
           platforms: linux/amd64,linux/arm64
           cache-from: type=gha
           cache-to: type=gha,mode=max
-      - name: Dryrun
-        uses: docker/build-push-action@v2
-        if: ${{ github.event_name == 'pull_request' }}
-        with:
-          context: ./jibri
-          tags: |
-            jitsi/jibri:${{ needs.version.outputs.base }}
-            jitsi/jibri:${{ needs.version.outputs.date }}
-            jitsi/jibri:${{ needs.version.outputs.jibri_version }}
-          build-args: |
-            JITSI_REPO=jitsi
-            BASE_TAG=${{ needs.version.outputs.base }}
-          platforms: linux/amd64,linux/arm64
-          cache-from: type=gha
-          cache-to: type=gha,mode=max
 
   jicofo:
     runs-on: ubuntu-latest
@@ -214,13 +165,11 @@ jobs:
         uses: docker/setup-buildx-action@v1
       - name: Login to DockerHub
         uses: docker/login-action@v1
-        if: ${{ github.event_name != 'pull_request' }}
         with:
           username: ${{ secrets.DOCKERHUB_USERNAME }}
           password: ${{ secrets.DOCKERHUB_TOKEN }}
       - name: Build and push
         uses: docker/build-push-action@v2
-        if: ${{ github.event_name != 'pull_request' }}
         with:
           push: true
           context: ./jicofo
@@ -234,21 +183,6 @@ jobs:
           platforms: linux/amd64,linux/arm64
           cache-from: type=gha
           cache-to: type=gha,mode=max
-      - name: Dryrun
-        uses: docker/build-push-action@v2
-        if: ${{ github.event_name == 'pull_request' }}
-        with:
-          context: ./jicofo
-          tags: |
-            jitsi/jicofo:${{ needs.version.outputs.base }}
-            jitsi/jicofo:${{ needs.version.outputs.date }}
-            jitsi/jicofo:${{ needs.version.outputs.jicofo_version }}
-          build-args: |
-            JITSI_REPO=jitsi
-            BASE_TAG=${{ needs.version.outputs.base }}
-          platforms: linux/amd64,linux/arm64
-          cache-from: type=gha
-          cache-to: type=gha,mode=max
 
   jigasi:
     runs-on: ubuntu-latest
@@ -264,13 +198,11 @@ jobs:
         uses: docker/setup-buildx-action@v1
       - name: Login to DockerHub
         uses: docker/login-action@v1
-        if: ${{ github.event_name != 'pull_request' }}
         with:
           username: ${{ secrets.DOCKERHUB_USERNAME }}
           password: ${{ secrets.DOCKERHUB_TOKEN }}
       - name: Build and push
         uses: docker/build-push-action@v2
-        if: ${{ github.event_name != 'pull_request' }}
         with:
           push: true
           context: ./jigasi
@@ -284,21 +216,6 @@ jobs:
           platforms: linux/amd64,linux/arm64
           cache-from: type=gha
           cache-to: type=gha,mode=max
-      - name: Dryrun
-        uses: docker/build-push-action@v2
-        if: ${{ github.event_name == 'pull_request' }}
-        with:
-          context: ./jigasi
-          tags: |
-            jitsi/jigasi:${{ needs.version.outputs.base }}
-            jitsi/jigasi:${{ needs.version.outputs.date }}
-            jitsi/jigasi:${{ needs.version.outputs.jigasi_version }}
-          build-args: |
-            JITSI_REPO=jitsi
-            BASE_TAG=${{ needs.version.outputs.base }}
-          platforms: linux/amd64,linux/arm64
-          cache-from: type=gha
-          cache-to: type=gha,mode=max
 
   jvb:
     runs-on: ubuntu-latest
@@ -314,13 +231,11 @@ jobs:
         uses: docker/setup-buildx-action@v1
       - name: Login to DockerHub
         uses: docker/login-action@v1
-        if: ${{ github.event_name != 'pull_request' }}
         with:
           username: ${{ secrets.DOCKERHUB_USERNAME }}
           password: ${{ secrets.DOCKERHUB_TOKEN }}
       - name: Build and push
         uses: docker/build-push-action@v2
-        if: ${{ github.event_name != 'pull_request' }}
         with:
           push: true
           context: ./jvb
@@ -334,21 +249,6 @@ jobs:
           platforms: linux/amd64,linux/arm64
           cache-from: type=gha
           cache-to: type=gha,mode=max
-      - name: Dryrun
-        uses: docker/build-push-action@v2
-        if: ${{ github.event_name == 'pull_request' }}
-        with:
-          context: ./jvb
-          tags: |
-            jitsi/jvb:${{ needs.version.outputs.base }}
-            jitsi/jvb:${{ needs.version.outputs.date }}
-            jitsi/jvb:${{ needs.version.outputs.jvb_version }}
-          build-args: |
-            JITSI_REPO=jitsi
-            BASE_TAG=${{ needs.version.outputs.base }}
-          platforms: linux/amd64,linux/arm64
-          cache-from: type=gha
-          cache-to: type=gha,mode=max
 
   prosody:
     runs-on: ubuntu-latest
@@ -364,13 +264,11 @@ jobs:
         uses: docker/setup-buildx-action@v1
       - name: Login to DockerHub
         uses: docker/login-action@v1
-        if: ${{ github.event_name != 'pull_request' }}
         with:
           username: ${{ secrets.DOCKERHUB_USERNAME }}
           password: ${{ secrets.DOCKERHUB_TOKEN }}
       - name: Build and push
         uses: docker/build-push-action@v2
-        if: ${{ github.event_name != 'pull_request' }}
         with:
           push: true
           context: ./prosody
@@ -384,21 +282,6 @@ jobs:
           platforms: linux/amd64,linux/arm64
           cache-from: type=gha
           cache-to: type=gha,mode=max
-      - name: Dryrun
-        uses: docker/build-push-action@v2
-        if: ${{ github.event_name == 'pull_request' }}
-        with:
-          context: ./prosody
-          tags: |
-            jitsi/prosody:${{ needs.version.outputs.base }}
-            jitsi/prosody:${{ needs.version.outputs.date }}
-            jitsi/prosody:${{ needs.version.outputs.prosody_version }}
-          build-args: |
-            JITSI_REPO=jitsi
-            BASE_TAG=${{ needs.version.outputs.base }}
-          platforms: linux/amd64,linux/arm64
-          cache-from: type=gha
-          cache-to: type=gha,mode=max
 
   web:
     runs-on: ubuntu-latest
@@ -414,13 +297,11 @@ jobs:
         uses: docker/setup-buildx-action@v1
       - name: Login to DockerHub
         uses: docker/login-action@v1
-        if: ${{ github.event_name != 'pull_request' }}
         with:
           username: ${{ secrets.DOCKERHUB_USERNAME }}
           password: ${{ secrets.DOCKERHUB_TOKEN }}
       - name: Build and push
         uses: docker/build-push-action@v2
-        if: ${{ github.event_name != 'pull_request' }}
         with:
           push: true
           context: ./web
@@ -434,18 +315,3 @@ jobs:
           platforms: linux/amd64,linux/arm64
           cache-from: type=gha
           cache-to: type=gha,mode=max
-      - name: Dryrun
-        uses: docker/build-push-action@v2
-        if: ${{ github.event_name == 'pull_request' }}
-        with:
-          context: ./web
-          tags: |
-            jitsi/web:${{ needs.version.outputs.base }}
-            jitsi/web:${{ needs.version.outputs.date }}
-            jitsi/web:${{ needs.version.outputs.web_version }}
-          build-args: |
-            JITSI_REPO=jitsi
-            BASE_TAG=${{ needs.version.outputs.base }}
-          platforms: linux/amd64,linux/arm64
-          cache-from: type=gha
-          cache-to: type=gha,mode=max