From b49e8b3e09f482193ac2d6b726e08c66d47d8bc4 Mon Sep 17 00:00:00 2001 From: jonesho Date: Fri, 25 Oct 2024 19:30:24 +0800 Subject: [PATCH 1/2] feat: bump actions-checkout to v4 and fix config test error --- .github/workflows/all-tools.yml | 4 ++-- .github/workflows/bridge-ui-publish.yml | 2 +- .github/workflows/cache-docker-images.yml | 4 ++-- .github/workflows/codeql.yml | 2 +- .github/workflows/load-test.yml | 5 +---- .github/workflows/main.yml | 2 +- .github/workflows/postman-build-and-publish.yml | 2 +- .github/workflows/postman-testing.yml | 5 +---- .github/workflows/prover-testing.yml | 2 +- .github/workflows/reuse-run-e2e-tests.yml | 2 +- .github/workflows/reuse-store-image-name-and-tags.yml | 2 +- .github/workflows/traces-api-facade-build-and-publish.yml | 5 +---- .github/workflows/traces-api-facade-testing.yml | 5 +---- .../transaction-exclusion-api-build-and-publish.yml | 5 +---- .github/workflows/transaction-exclusion-api-testing.yml | 5 +---- 15 files changed, 17 insertions(+), 35 deletions(-) diff --git a/.github/workflows/all-tools.yml b/.github/workflows/all-tools.yml index a2405eec5..9d618becc 100644 --- a/.github/workflows/all-tools.yml +++ b/.github/workflows/all-tools.yml @@ -22,7 +22,7 @@ jobs: all-tools: ${{ steps.filter.outputs['all-tools'] }} steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Filter commit changes uses: dorny/paths-filter@v2 id: filter @@ -85,7 +85,7 @@ jobs: name: All tools build and push steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: ssh-key: ${{ secrets.SELF_GITHUB_SSH_KEY }} submodules: true diff --git a/.github/workflows/bridge-ui-publish.yml b/.github/workflows/bridge-ui-publish.yml index 7b63d6e58..b985b87ae 100644 --- a/.github/workflows/bridge-ui-publish.yml +++ b/.github/workflows/bridge-ui-publish.yml @@ -17,7 +17,7 @@ jobs: runs-on: [self-hosted, ubuntu-20.04, X64, small] steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Get version from package.json id: package-version diff --git a/.github/workflows/cache-docker-images.yml b/.github/workflows/cache-docker-images.yml index 863d4130c..29e18a1ae 100644 --- a/.github/workflows/cache-docker-images.yml +++ b/.github/workflows/cache-docker-images.yml @@ -15,7 +15,7 @@ jobs: cache-images: ${{ steps.filter.outputs.cache-images }} steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Filter commit changes uses: dorny/paths-filter@v2 id: filter @@ -34,7 +34,7 @@ jobs: runs-on: [self-hosted, ubuntu-20.04, X64, small] steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Login to Docker Hub uses: docker/login-action@v3 with: diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 80777cb15..c57870296 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -35,7 +35,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL diff --git a/.github/workflows/load-test.yml b/.github/workflows/load-test.yml index 295aac845..63ec3aa26 100644 --- a/.github/workflows/load-test.yml +++ b/.github/workflows/load-test.yml @@ -31,10 +31,7 @@ jobs: name: Run Load Test steps: - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: 0 - ref: ${{ github.head_ref }} + uses: actions/checkout@v4 - uses: actions/setup-java@v4 with: diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d4f1ab769..c0d6f04b1 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -23,7 +23,7 @@ jobs: no-changes: ${{ steps.filter.outputs.coordinator == 'false' && steps.filter.outputs.postman == 'false' && steps.filter.outputs.prover == 'false' && steps.filter.outputs.traces-api-facade == 'false' && steps.filter.outputs.transaction-exclusion-api == 'false' }} steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Filter commit changes uses: dorny/paths-filter@v3 id: filter diff --git a/.github/workflows/postman-build-and-publish.yml b/.github/workflows/postman-build-and-publish.yml index d95715e99..881df1730 100644 --- a/.github/workflows/postman-build-and-publish.yml +++ b/.github/workflows/postman-build-and-publish.yml @@ -67,7 +67,7 @@ jobs: run: | echo "TAGS=${{ env.IMAGE_NAME }}:${{ env.COMMIT_TAG }},${{ env.IMAGE_NAME }}:${{ env.DEVELOP_TAG }}" >> $GITHUB_ENV - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: ssh-key: ${{ secrets.SELF_GITHUB_SSH_KEY }} submodules: true diff --git a/.github/workflows/postman-testing.yml b/.github/workflows/postman-testing.yml index a352614ef..411083146 100644 --- a/.github/workflows/postman-testing.yml +++ b/.github/workflows/postman-testing.yml @@ -13,10 +13,7 @@ jobs: name: Postman & SDK tests steps: - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: 0 - ref: ${{ github.head_ref }} + uses: actions/checkout@v4 - name: Setup nodejs environment uses: ./.github/actions/setup-nodejs diff --git a/.github/workflows/prover-testing.yml b/.github/workflows/prover-testing.yml index 1427eeffb..5b1d5026d 100644 --- a/.github/workflows/prover-testing.yml +++ b/.github/workflows/prover-testing.yml @@ -25,7 +25,7 @@ jobs: with: go-version: 1.23.x - name: checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 - uses: actions/cache@v3 diff --git a/.github/workflows/reuse-run-e2e-tests.yml b/.github/workflows/reuse-run-e2e-tests.yml index 3c1df5333..b2eb15d97 100644 --- a/.github/workflows/reuse-run-e2e-tests.yml +++ b/.github/workflows/reuse-run-e2e-tests.yml @@ -77,7 +77,7 @@ jobs: if: ${{ inputs.e2e-tests-with-ssh }} uses: lhotari/action-upterm@v1 - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup nodejs environment uses: ./.github/actions/setup-nodejs with: diff --git a/.github/workflows/reuse-store-image-name-and-tags.yml b/.github/workflows/reuse-store-image-name-and-tags.yml index 05a61e23e..e7cf31551 100644 --- a/.github/workflows/reuse-store-image-name-and-tags.yml +++ b/.github/workflows/reuse-store-image-name-and-tags.yml @@ -26,7 +26,7 @@ jobs: develop_tag: ${{ steps.step1.outputs.DEVELOP_TAG }} steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Compute version tags id: step1 run: | diff --git a/.github/workflows/traces-api-facade-build-and-publish.yml b/.github/workflows/traces-api-facade-build-and-publish.yml index 811e3e81a..bce7c1934 100644 --- a/.github/workflows/traces-api-facade-build-and-publish.yml +++ b/.github/workflows/traces-api-facade-build-and-publish.yml @@ -67,10 +67,7 @@ jobs: run: | echo "TAGS=${{ env.IMAGE_NAME }}:${{ env.COMMIT_TAG }},${{ env.IMAGE_NAME }}:${{ env.DEVELOP_TAG }}" >> $GITHUB_ENV - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: 0 - ref: ${{ github.head_ref }} + uses: actions/checkout@v4 - uses: actions/setup-java@v4 with: distribution: temurin diff --git a/.github/workflows/traces-api-facade-testing.yml b/.github/workflows/traces-api-facade-testing.yml index d532eb15f..a4053cbfd 100644 --- a/.github/workflows/traces-api-facade-testing.yml +++ b/.github/workflows/traces-api-facade-testing.yml @@ -21,10 +21,7 @@ jobs: name: Traces api facade tests steps: - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: 0 - ref: ${{ github.head_ref }} + uses: actions/checkout@v4 - uses: actions/setup-java@v4 with: distribution: temurin diff --git a/.github/workflows/transaction-exclusion-api-build-and-publish.yml b/.github/workflows/transaction-exclusion-api-build-and-publish.yml index bb7ed0c0d..0157809f7 100644 --- a/.github/workflows/transaction-exclusion-api-build-and-publish.yml +++ b/.github/workflows/transaction-exclusion-api-build-and-publish.yml @@ -67,10 +67,7 @@ jobs: run: | echo "TAGS=${{ env.IMAGE_NAME }}:${{ env.COMMIT_TAG }},${{ env.IMAGE_NAME }}:${{ env.DEVELOP_TAG }}" >> $GITHUB_ENV - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: 0 - ref: ${{ github.head_ref }} + uses: actions/checkout@v4 - uses: actions/setup-java@v4 with: distribution: temurin diff --git a/.github/workflows/transaction-exclusion-api-testing.yml b/.github/workflows/transaction-exclusion-api-testing.yml index cb076b35d..79247abed 100644 --- a/.github/workflows/transaction-exclusion-api-testing.yml +++ b/.github/workflows/transaction-exclusion-api-testing.yml @@ -20,10 +20,7 @@ jobs: name: Transaction exclusion api tests steps: - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: 0 - ref: ${{ github.head_ref }} + uses: actions/checkout@v4 - uses: actions/setup-java@v4 with: distribution: temurin From d0407147a54daf202e9ebfccf0e8d6cba62315f8 Mon Sep 17 00:00:00 2001 From: jonesho Date: Fri, 25 Oct 2024 22:28:16 +0800 Subject: [PATCH 2/2] feat: save and upload image as gzip if merging back to main and no changes have made --- .github/actions/image-tag-and-push/action.yml | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/.github/actions/image-tag-and-push/action.yml b/.github/actions/image-tag-and-push/action.yml index 519e526ef..9a3b9541e 100644 --- a/.github/actions/image-tag-and-push/action.yml +++ b/.github/actions/image-tag-and-push/action.yml @@ -49,8 +49,29 @@ runs: docker buildx imagetools create --tag ${{ inputs.image_name }}:${{ inputs.develop_tag }} ${{ inputs.image_name }}:${{ inputs.last_commit_tag }} docker buildx imagetools create --tag ${{ inputs.image_name }}:${{ inputs.commit_tag }} ${{ inputs.image_name }}:${{ inputs.last_commit_tag }} echo IMAGE_TAGGED=true >> $GITHUB_ENV + - name: Split docker image name (i.e. extract "xyz" from "consensys/xyz") + if: ${{ github.ref == 'refs/heads/main' && inputs.last_commit_tag_exists == '0' }} + env: + IMAGE_NAME: ${{ inputs.image_name }} + id: split + shell: bash + run: | + echo "::set-output name=image_name_suffix::${IMAGE_NAME##*/}" + - name: Save Docker image as artifact for later use in e2e test + if: ${{ github.ref == 'refs/heads/main' && inputs.last_commit_tag_exists == '0' }} + shell: bash + run: | + docker pull ${{ env.IMAGE_NAME }}:${{ env.COMMIT_TAG }} + docker save ${{ env.IMAGE_NAME }}:${{ env.COMMIT_TAG }} | gzip > ${{ steps.split.outputs.image_name_suffix }}-docker-image.tar.gz + - name: Upload Docker image artifact for later use in e2e test + if: ${{ github.ref == 'refs/heads/main' && inputs.last_commit_tag_exists == '0' }} + uses: actions/upload-artifact@v4 + with: + name: ${{ steps.split.outputs.image_name_suffix }} + path: ${{ steps.split.outputs.image_name_suffix }}-docker-image.tar.gz - name: Set output from environment variable shell: bash id: set-output run: | echo "image_tagged=$IMAGE_TAGGED" >> $GITHUB_OUTPUT + echo "image_name_suffix: ${{ steps.split.outputs.image_name_suffix }}"