From 7aa9b496fabbac77219227a2f33baf47a5435b67 Mon Sep 17 00:00:00 2001 From: Dimitri Huisman Date: Mon, 5 Jul 2021 17:09:48 +0000 Subject: [PATCH] Moved logic for building testing images from deploy job to build job. This should save time. Test number for ci workflow #1234 --- .github/workflows/CI.yml | 34 ++++++++++++++++++++++++---------- tests/deploy.sh | 9 --------- 2 files changed, 24 insertions(+), 19 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 2b81a60d..2db8de97 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -13,7 +13,7 @@ on: - '[1-9].[0-9].[0-9]' # pre-releases, e.g. 1.8-pre1 - 1.8-pre[0-9] - # test branches, e.g. test-debian + # test branches, e.g. test-debian - test-* ############################################### @@ -39,6 +39,21 @@ jobs: shell: bash run: | echo "BRANCH=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV + #For branch TESTING, we set the image tag to PR-xxxx + - name: Derive MAILU_VERSION for branch testing + if: ${{ env.BRANCH == 'testing' }} + shell: bash + env: + COMMIT_MESSAGE: ${{ github.event.head_commit.message }} + run: | + echo "MAILU_VERSION=pr-${COMMIT_MESSAGE//[!0-9]/}" >> $GITHUB_ENV + - name: Derive MAILU_VERSION for other branches than testing + if: ${{ env.BRANCH != 'testing' }} + shell: bash + env: + MAILU_BRANCH: ${{ env.BRANCH }} + run: | + echo "MAILU_VERSION=${{ MAILU_BRANCH }}" >> $GITHUB_ENV - name: Create folder for storing images run: | sudo mkdir -p /images @@ -58,7 +73,7 @@ jobs: run: echo "$DOCKER_PW" | docker login --username $DOCKER_UN --password-stdin - name: Build all docker images env: - MAILU_VERSION: ${{ env.BRANCH }} + MAILU_VERSION: ${{ env.MAILU_VERSION }} TRAVIS_BRANCH: ${{ env.BRANCH }} DOCKER_ORG: ${{ secrets.DOCKER_ORG }} run: docker-compose -f tests/build.yml build @@ -94,7 +109,7 @@ jobs: - name: Test core suite run: python tests/compose/test.py core 1 env: - MAILU_VERSION: ${{ env.BRANCH }} + MAILU_VERSION: ${{ env.MAILU_VERSION }} TRAVIS_BRANCH: ${{ env.BRANCH }} DOCKER_ORG: ${{ secrets.DOCKER_ORG }} @@ -127,7 +142,7 @@ jobs: - name: Test fetch run: python tests/compose/test.py fetchmail 1 env: - MAILU_VERSION: ${{ env.BRANCH }} + MAILU_VERSION: ${{ env.MAILU_VERSION }} TRAVIS_BRANCH: ${{ env.BRANCH }} DOCKER_ORG: ${{ secrets.DOCKER_ORG }} @@ -160,7 +175,7 @@ jobs: - name: Test clamvav run: python tests/compose/test.py filters 2 env: - MAILU_VERSION: ${{ env.BRANCH }} + MAILU_VERSION: ${{ env.MAILU_VERSION }} TRAVIS_BRANCH: ${{ env.BRANCH }} DOCKER_ORG: ${{ secrets.DOCKER_ORG }} @@ -193,7 +208,7 @@ jobs: - name: Test rainloop run: python tests/compose/test.py rainloop 1 env: - MAILU_VERSION: ${{ env.BRANCH }} + MAILU_VERSION: ${{ env.MAILU_VERSION }} TRAVIS_BRANCH: ${{ env.BRANCH }} DOCKER_ORG: ${{ secrets.DOCKER_ORG }} @@ -226,7 +241,7 @@ jobs: - name: Test roundcube run: python tests/compose/test.py roundcube 1 env: - MAILU_VERSION: ${{ env.BRANCH }} + MAILU_VERSION: ${{ env.MAILU_VERSION }} TRAVIS_BRANCH: ${{ env.BRANCH }} DOCKER_ORG: ${{ secrets.DOCKER_ORG }} @@ -259,7 +274,7 @@ jobs: - name: Test webdav run: python tests/compose/test.py webdav 1 env: - MAILU_VERSION: ${{ env.BRANCH }} + MAILU_VERSION: ${{ env.MAILU_VERSION }} TRAVIS_BRANCH: ${{ env.BRANCH }} DOCKER_ORG: ${{ secrets.DOCKER_ORG }} @@ -300,9 +315,8 @@ jobs: DOCKER_PW: ${{ secrets.Docker_Password }} DOCKER_ORG: ${{ secrets.DOCKER_ORG }} DOCKER_ORG_TESTS: ${{ secrets.DOCKER_ORG_TESTS }} - MAILU_VERSION: ${{ env.BRANCH }} + MAILU_VERSION: ${{ env.MAILU_VERSION }} TRAVIS_BRANCH: ${{ env.BRANCH }} - TRAVIS_COMMIT_MESSAGE: ${{ github.event.head_commit.message }} run: bash tests/deploy.sh # This job is watched by bors. It only complets if building,testing and deploy worked. diff --git a/tests/deploy.sh b/tests/deploy.sh index a836417b..abb37b6b 100755 --- a/tests/deploy.sh +++ b/tests/deploy.sh @@ -3,14 +3,5 @@ # Skip deploy for staging branch [ "$TRAVIS_BRANCH" = "staging" ] && exit 0 -# Retag in case of `bors try` -if [ "$TRAVIS_BRANCH" = "testing" ]; then - export DOCKER_ORG=$DOCKER_ORG_TESTS - # Commit message is like "Try #99". - # This sets the version tag to "pr-99" - export MAILU_VERSION="pr-${TRAVIS_COMMIT_MESSAGE//[!0-9]/}" - docker-compose -f tests/build.yml build -fi - docker login -u $DOCKER_UN -p $DOCKER_PW docker-compose -f tests/build.yml push