From f2c4712c4f7a0068658abd6941ace613e6d93728 Mon Sep 17 00:00:00 2001 From: Casper Date: Tue, 28 Sep 2021 12:37:54 +0200 Subject: [PATCH] Streamline workflow step seperation (#2222) * streamline workflow step separation * doh! Co-authored-by: Georg Lauterbach <44545919+georglauterbach@users.noreply.github.com> --- .github/workflows/contributors.yml | 16 +++++++--------- .github/workflows/default_on_push.yml | 14 +++++++++++++- .github/workflows/linting.yml | 3 +++ .github/workflows/scheduled_builds.yml | 6 ++++++ .github/workflows/test_merge_requests.yml | 12 +++++++++--- 5 files changed, 38 insertions(+), 13 deletions(-) diff --git a/.github/workflows/contributors.yml b/.github/workflows/contributors.yml index c58af082..3c755e13 100644 --- a/.github/workflows/contributors.yml +++ b/.github/workflows/contributors.yml @@ -9,28 +9,26 @@ jobs: runs-on: ubuntu-latest continue-on-error: true steps: - - - name: Delete old contributors-update branch + - name: Delete old contributors-update branch uses: dawidd6/action-delete-branch@v3 with: github_token: ${{secrets.GITHUB_TOKEN}} branches: contributors-update - + add-contributors: runs-on: ubuntu-latest needs: delete-old-branch steps: - - - uses: actions/checkout@v2 - - - name: Create contributors-update branch + - uses: actions/checkout@v2 + + - name: Create contributors-update branch uses: peterjgrainger/action-create-branch@v2.0.1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: branch: 'contributors-update' - - - name: Auto-add contributors + + - name: Auto-add contributors uses: BobAnkh/add-contributors@v0.2.2 with: BRANCH: 'contributors-update' diff --git a/.github/workflows/default_on_push.yml b/.github/workflows/default_on_push.yml index deefe1bb..f2cfc075 100644 --- a/.github/workflows/default_on_push.yml +++ b/.github/workflows/default_on_push.yml @@ -5,7 +5,7 @@ on: push: branches: - master - paths: + paths: - 'target/**' - '.dockerignore' - '.gitmodules' @@ -22,9 +22,11 @@ jobs: uses: actions/checkout@v2.3.4 with: submodules: recursive + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v1.6.0 id: buildx + - name: Cache Docker layers uses: actions/cache@v2.1.6 with: @@ -32,6 +34,7 @@ jobs: key: ${{ runner.os }}-buildx-${{ github.sha }} restore-keys: | ${{ runner.os }}-buildx- + - name: Build image locally uses: docker/build-push-action@v2.7.0 with: @@ -45,6 +48,7 @@ jobs: load: true tags: mailserver-testing:ci cache-to: type=local,dest=/tmp/.buildx-cache + - name: Run test suite run: > NAME=mailserver-testing:ci @@ -56,10 +60,12 @@ jobs: needs: build-and-test-image runs-on: ubuntu-20.04 steps: + - name: Checkout uses: actions/checkout@v2.3.4 with: submodules: recursive + - name: Prepare tags id: prep uses: docker/metadata-action@v3.5.0 @@ -74,11 +80,14 @@ jobs: type=semver,pattern={{major}}.{{minor}}.{{patch}} flavor: | latest=auto + - name: Set up QEMU uses: docker/setup-qemu-action@v1.2.0 + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v1.6.0 id: buildx + - name: Cache Docker layers uses: actions/cache@v2.1.6 with: @@ -86,17 +95,20 @@ jobs: key: ${{ runner.os }}-buildx-${{ github.sha }} restore-keys: | ${{ runner.os }}-buildx- + - name: Login to DockerHub uses: docker/login-action@v1.10.0 with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} + - name: Login to GitHub Container Registry uses: docker/login-action@v1.10.0 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} + - name: Build images locally uses: docker/build-push-action@v2.7.0 with: diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index fddedf03..15a9a205 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -20,16 +20,19 @@ jobs: uses: actions/checkout@v2.3.4 with: submodules: recursive + - name: Hadolint run: | make hadolint env: HADOLINT_VERSION: 2.4.1 + - name: ShellCheck run: | make shellcheck env: SHELLCHECK_VERSION: 0.7.2 + - name: ECLint run: | make eclint diff --git a/.github/workflows/scheduled_builds.yml b/.github/workflows/scheduled_builds.yml index a5767808..f730ea19 100644 --- a/.github/workflows/scheduled_builds.yml +++ b/.github/workflows/scheduled_builds.yml @@ -12,6 +12,7 @@ jobs: uses: actions/checkout@v2.3.4 with: submodules: recursive + - name: Prepare tags id: prep uses: docker/metadata-action@v3.5.0 @@ -21,22 +22,27 @@ jobs: ${{ secrets.GHCR_REPOSITORY }} tags: | type=raw,value=edge + - name: Set up QEMU uses: docker/setup-qemu-action@v1.2.0 + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v1.6.0 id: buildx + - name: Login to DockerHub uses: docker/login-action@v1.10.0 with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} + - name: Login to GitHub Container Registry uses: docker/login-action@v1.10.0 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} + - name: Build image locally uses: docker/build-push-action@v2.7.0 with: diff --git a/.github/workflows/test_merge_requests.yml b/.github/workflows/test_merge_requests.yml index b5cb24d2..f3e914e9 100644 --- a/.github/workflows/test_merge_requests.yml +++ b/.github/workflows/test_merge_requests.yml @@ -1,9 +1,9 @@ name: "Test Merge Requests" -on: +on: workflow_dispatch: pull_request: - paths: + paths: - 'target/**' - 'test/**' - '.dockerignore' @@ -19,11 +19,14 @@ jobs: uses: actions/checkout@v2.3.4 with: submodules: recursive + - name: Set up QEMU uses: docker/setup-qemu-action@v1.2.0 + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v1.6.0 id: buildx + - name: Cache Docker layers uses: actions/cache@v2.1.6 with: @@ -31,6 +34,7 @@ jobs: key: ${{ runner.os }}-buildx-${{ github.sha }} restore-keys: | ${{ runner.os }}-buildx- + - name: Build images locally uses: docker/build-push-action@v2.7.0 with: @@ -43,6 +47,7 @@ jobs: platforms: linux/amd64,linux/arm/v7,linux/arm64 tags: mailserver-testing:ci cache-to: type=local,dest=/tmp/.buildx-cache + - name: Build image for test suit uses: docker/build-push-action@v2.7.0 with: @@ -56,9 +61,10 @@ jobs: load: true tags: mailserver-testing:ci cache-from: type=local,src=/tmp/.buildx-cache + - name: Run test suite run: > NAME=mailserver-testing:ci bash -c 'make generate-accounts tests' env: - CI: true \ No newline at end of file + CI: true