From cc327e91501a7de7dbe534440db62c9420727fb0 Mon Sep 17 00:00:00 2001 From: Wataru Kurashima Date: Wed, 6 Sep 2023 13:17:54 +0900 Subject: [PATCH 1/4] =?UTF-8?q?ci:=20=F0=9F=8E=A1=20use=20docker/build-pus?= =?UTF-8?q?h-action?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yml | 40 +++++++++++++++++++++++++++++++++++----- 1 file changed, 35 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cebff82231..1f2a1b29bd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -170,14 +170,44 @@ jobs: run: | npm install --global --force yarn@1.22.19 yarn cache clean && yarn --frozen-lockfile --network-concurrency 1 - - name: Build and push preview image to Docker Hub - env: - DOCKER_USER: ${{ vars.DOCKER_USER }} - DOCKER_PASS: ${{ secrets.DOCKER_PASS }} + + - name: Set up QEMU + timeout-minutes: 1 + uses: docker/setup-qemu-action@v2.2.0 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Login to DockerHub + uses: docker/login-action@v2 + with: + username: ${{ vars.DOCKER_USER }} + password: ${{ secrets.DOCKER_PASS }} + + - name: Bump version + id: version run: | set -x .ci/update_version - .ci/docker_build + VERSION=$(jq -r .version package.json) + VERSION_TAG="${VERSION}.b${GITHUB_RUN_ID}.${GITHUB_RUN_NUMBER}" + echo "VERSION_TAG=$VERSION_TAG" >> "$GITHUB_OUTPUT" + + - name: Build and push preview image to Docker Hub + uses: docker/build-push-action@v4 + with: + push: true + tags: | + redash/redash:preview + redash/preview:${{ steps.version.outputs.VERSION_TAG }} + context: . + build-args: | + test_all_deps=true + cache-from: type=ghq + cache-to: type=gha,mode=max + env: + DOCKER_CONTENT_TRUST: true + - name: "Failure: output container logs to console" if: failure() run: docker-compose logs From a7edb5a0752a2494f2b02b747287aee9a50768e3 Mon Sep 17 00:00:00 2001 From: Wataru Kurashima Date: Wed, 6 Sep 2023 13:29:11 +0900 Subject: [PATCH 2/4] =?UTF-8?q?style:=20=F0=9F=92=84=20shellcheck=20SC2086?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1f2a1b29bd..6160bdcf42 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -128,7 +128,7 @@ jobs: - name: Enable Code Coverage Report For Master Branch if: endsWith(github.ref, '/master') run: | - echo "CODE_COVERAGE=true" >> $GITHUB_ENV + echo "CODE_COVERAGE=true" >> "$GITHUB_ENV" - name: Install Dependencies run: | npm install --global --force yarn@1.22.19 From caa04bdc24493578723270bd2e7675c8d81937cd Mon Sep 17 00:00:00 2001 From: Wataru Kurashima Date: Wed, 6 Sep 2023 15:58:05 +0900 Subject: [PATCH 3/4] =?UTF-8?q?ci:=20=F0=9F=8E=A1=20skip-checker?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6160bdcf42..7f9ca44b7e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -152,12 +152,28 @@ jobs: name: coverage path: coverage + build-skip-check: + runs-on: ubuntu-22.04 + outputs: + skip: ${{ steps.skip-check.outputs.skip }} + steps: + - name: Skip? + id: skip-check + run: | + if [[ ${{ vars.DOCKER_USER }} == '' ]] || [[ ${{ secrets.DOCKER_PASS }} == '' ]]; then + echo skip=true >> "$GITHUB_OUTPUT" + else + echo skip=false >> "$GITHUB_OUTPUT" + fi + build-docker-image: runs-on: ubuntu-22.04 needs: - backend-unit-tests - frontend-unit-tests - frontend-e2e-tests + - build-skip-check + if: ${{ needs.build-skip-check.outputs.skip == false}} steps: - uses: actions/checkout@v3 with: From 1add20f2e4799a3e62b5e0968a8565f54d39dba7 Mon Sep 17 00:00:00 2001 From: Wataru Kurashima Date: Wed, 6 Sep 2023 16:05:58 +0900 Subject: [PATCH 4/4] =?UTF-8?q?fix:=20=F0=9F=90=9B=20conditional=20binary?= =?UTF-8?q?=20operator=20expected?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7f9ca44b7e..0b9e9d90ce 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -160,7 +160,7 @@ jobs: - name: Skip? id: skip-check run: | - if [[ ${{ vars.DOCKER_USER }} == '' ]] || [[ ${{ secrets.DOCKER_PASS }} == '' ]]; then + if [[ "${{ vars.DOCKER_USER }}" == '' ]] || [[ "${{ secrets.DOCKER_PASS }}" == '' ]]; then echo skip=true >> "$GITHUB_OUTPUT" else echo skip=false >> "$GITHUB_OUTPUT"