From 32184df68bc6147a86d3934018984cb238008f17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Colin=20Axn=C3=A9r?= <25233464+colin-axner@users.noreply.github.com> Date: Wed, 16 Oct 2024 13:07:43 +0200 Subject: [PATCH] chore: refactor workflows --- .../workflows/build-simd-image-from-tag.yml | 3 +- .../build-wasm-simd-image-from-tag.yml | 2 + .github/workflows/e2e-manual-simd.yaml | 2 + .github/workflows/e2e-manual-wasm-simd.yaml | 5 ++ .github/workflows/e2e-test-workflow-call.yml | 58 ------------------- .github/workflows/e2e-wasm.yaml | 4 +- .github/workflows/release-wasm.yml | 3 +- Dockerfile | 7 +-- modules/light-clients/08-wasm/Dockerfile | 2 +- 9 files changed, 19 insertions(+), 67 deletions(-) diff --git a/.github/workflows/build-simd-image-from-tag.yml b/.github/workflows/build-simd-image-from-tag.yml index 5aad8f5fe51..ccafb4d4702 100644 --- a/.github/workflows/build-simd-image-from-tag.yml +++ b/.github/workflows/build-simd-image-from-tag.yml @@ -40,8 +40,9 @@ jobs: run: | version="$(scripts/get-libwasm-version.py --get-version)" checksum="$(scripts/get-libwasm-version.py --get-checksum)" - + # remove any `/` characters from the docker tag and replace them with a - + # this ensures the docker tag is valid. docker_tag="$(echo $GIT_TAG | sed 's/[^a-zA-Z0-9\.]/-/g')" docker build . -t "${REGISTRY}/${ORG}/${IMAGE_NAME}:${docker_tag}" --build-arg IBC_GO_VERSION=${{ inputs.ibc-go-version }} docker push "${REGISTRY}/${ORG}/${IMAGE_NAME}:${docker_tag}" diff --git a/.github/workflows/build-wasm-simd-image-from-tag.yml b/.github/workflows/build-wasm-simd-image-from-tag.yml index 185e2e6ce31..68b1b53a114 100644 --- a/.github/workflows/build-wasm-simd-image-from-tag.yml +++ b/.github/workflows/build-wasm-simd-image-from-tag.yml @@ -1,4 +1,6 @@ name: Build Wasm Simd Image +# starting ibc-go v10, simd can be reused for wasm images +# this workflow can be deleted after support for v9 is dropped on: workflow_dispatch: inputs: diff --git a/.github/workflows/e2e-manual-simd.yaml b/.github/workflows/e2e-manual-simd.yaml index d2ec7b5c081..70e88667fc2 100644 --- a/.github/workflows/e2e-manual-simd.yaml +++ b/.github/workflows/e2e-manual-simd.yaml @@ -18,6 +18,7 @@ on: - TestInterchainAccountsGovTestSuite - TestIncentivizedInterchainAccountsTestSuite - TestAuthzTransferTestSuite + - TestGrandpaTestSuite chain-image: description: 'The image to use for chain A' required: true @@ -72,6 +73,7 @@ on: options: - rly - hermes + - hyperspace relayer-tag: description: 'The tag to use for the relayer' required: true diff --git a/.github/workflows/e2e-manual-wasm-simd.yaml b/.github/workflows/e2e-manual-wasm-simd.yaml index 719d120266a..b598c879919 100644 --- a/.github/workflows/e2e-manual-wasm-simd.yaml +++ b/.github/workflows/e2e-manual-wasm-simd.yaml @@ -1,4 +1,6 @@ name: Manual WASM E2E (Simd) +# starting ibc-go v10, simd can be reused for wasm images +# this workflow can be deleted after support for v9 is dropped on: # when https://github.com/community/community/discussions/11795 is resolved # we will be able to dynamically build up the list of valid inputs. @@ -16,6 +18,9 @@ on: required: true type: string default: "ghcr.io/cosmos/ibc-go-wasm-simd" + options: + - ghcr.io/cosmos/ibc-go-simd # for v10 and up + - ghcr.io/cosmos/ibc-go-wasm-simd chain-binary: description: 'Specify the chain binary to be used' required: true diff --git a/.github/workflows/e2e-test-workflow-call.yml b/.github/workflows/e2e-test-workflow-call.yml index 6afeeb002b7..42adca928d3 100644 --- a/.github/workflows/e2e-test-workflow-call.yml +++ b/.github/workflows/e2e-test-workflow-call.yml @@ -72,11 +72,6 @@ on: required: false type: boolean default: false - build-and-push-docker-image-wasm: - description: 'Flag to specify if the wasm docker image should be built and pushed beforehand' - required: false - type: boolean - default: false upload-logs: description: 'Specify flag to indicate that logs should be uploaded on failure' required: false @@ -86,7 +81,6 @@ on: env: REGISTRY: ghcr.io IMAGE_NAME: ibc-go-simd - IMAGE_NAME_WASM: ibc-go-wasm-simd jobs: # test-details exists to provide an easy way to see the inputs for the e2e test. @@ -158,56 +152,6 @@ jobs: LIBWASM_VERSION=${{ steps.build-args.outputs.version }} LIBWASM_CHECKSUM=${{ steps.build-args.outputs.checksum }} - docker-build-wasm: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - if: ${{ inputs.build-and-push-docker-image-wasm }} - - - uses: actions/setup-python@v5 - if: ${{ inputs.build-and-push-docker-image-wasm }} - with: - python-version: '3.10' - - - name: Install dependencies - if: ${{ inputs.build-and-push-docker-image-wasm }} - run: make python-install-deps - - - name: Determine Build arguments - if: ${{ inputs.build-and-push-docker-image-wasm }} - id: build-args - run: | - echo "version=$(scripts/get-libwasm-version.py --get-version)" >> $GITHUB_OUTPUT - echo "checksum=$(scripts/get-libwasm-version.py --get-checksum)" >> $GITHUB_OUTPUT - - - name: Log in to the Container registry - if: ${{ inputs.build-and-push-docker-image-wasm }} - uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Extract metadata (tags, labels) for Docker - if: ${{ inputs.build-and-push-docker-image-wasm }} - id: meta - uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 - with: - images: ${{ env.REGISTRY }}/cosmos/${{ env.IMAGE_NAME_WASM }} - - - name: Build and push Docker image - if: ${{ inputs.build-and-push-docker-image-wasm }} - uses: docker/build-push-action@4f58ea79222b3b9dc2c8bbdd6debcef730109a75 - with: - context: . - push: true - tags: ${{ steps.meta.outputs.tags }} - file: modules/light-clients/08-wasm/Dockerfile - build-args: | - LIBWASM_VERSION=${{ steps.build-args.outputs.version }} - LIBWASM_CHECKSUM=${{ steps.build-args.outputs.checksum }} - - # dynamically build a matrix of test/test suite pairs to run. # this job runs a go tool located at cmd/build_test_matrix/main.go. # it walks the e2e/test directory in order to locate all test suite / test name @@ -241,7 +185,6 @@ jobs: needs: - build-test-matrix - docker-build - - docker-build-wasm env: CHAIN_IMAGE: '${{ inputs.chain-image }}' CHAIN_A_TAG: '${{ inputs.chain-a-tag }}' @@ -284,7 +227,6 @@ jobs: needs: - build-test-matrix - docker-build - - docker-build-wasm env: CHAIN_IMAGE: '${{ inputs.chain-image }}' CHAIN_A_TAG: '${{ inputs.chain-a-tag }}' diff --git a/.github/workflows/e2e-wasm.yaml b/.github/workflows/e2e-wasm.yaml index ae3ec51725a..106c8d36331 100644 --- a/.github/workflows/e2e-wasm.yaml +++ b/.github/workflows/e2e-wasm.yaml @@ -59,10 +59,10 @@ jobs: secrets: inherit with: # with each test, we build an image from the current code. - build-and-push-docker-image-wasm: true + build-and-push-docker-image: true # if the test fails, we upload logs so that we can download them from the UI. upload-logs: true - chain-image: ghcr.io/cosmos/ibc-go-wasm-simd + chain-image: ghcr.io/cosmos/ibc-go-simd # with regular tests, both images are the same. chain-a-tag: '${{ needs.determine-image-tag.outputs.simd-tag }}' chain-b-tag: '${{ needs.determine-image-tag.outputs.simd-tag }}' diff --git a/.github/workflows/release-wasm.yml b/.github/workflows/release-wasm.yml index 3cb42026837..9cb2fd2b3a3 100644 --- a/.github/workflows/release-wasm.yml +++ b/.github/workflows/release-wasm.yml @@ -1,5 +1,6 @@ name: Build Wasm Docker Simapp - +# starting ibc-go v10, simd can be reused for wasm images +# this workflow can be deleted after support for v9 is dropped on: workflow_dispatch: inputs: diff --git a/Dockerfile b/Dockerfile index fd4bc037032..e53c39d0aec 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,11 @@ FROM golang:1.22-alpine3.20 as builder -ARG IBC_GO_VERSION +ARG IBC_GO_VERSION ARG LIBWASM_VERSION ARG LIBWASM_CHECKSUM +# ensure the arguments are being specified for this image. +RUN test -n "${IBC_GO_VERSION}" RUN test -n "${LIBWASM_VERSION}" RUN test -n "${LIBWASM_CHECKSUM}" @@ -16,9 +18,6 @@ ADD https://github.com/CosmWasm/wasmvm/releases/download/${LIBWASM_VERSION}/libw RUN sha256sum /lib/libwasmvm_muslc.x86_64.a | grep ${LIBWASM_CHECKSUM} RUN cp /lib/libwasmvm_muslc.x86_64.a /lib/libwasmvm_muslc.a -# ensure the ibc go version is being specified for this image. -RUN test -n "${IBC_GO_VERSION}" - # Copy relevant files before go mod download. Replace directives to local paths break if local # files are not copied before go mod download. ADD internal internal diff --git a/modules/light-clients/08-wasm/Dockerfile b/modules/light-clients/08-wasm/Dockerfile index ecb05fbbae9..57fe0939faf 100644 --- a/modules/light-clients/08-wasm/Dockerfile +++ b/modules/light-clients/08-wasm/Dockerfile @@ -26,7 +26,7 @@ ADD LICENSE LICENSE COPY go.mod . COPY go.sum . -#WORKDIR /go/modules/light-clients/08-wasm +WORKDIR /go/simapp RUN go mod download