Skip to content

Commit

Permalink
chore: refactor workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
colin-axner committed Oct 16, 2024
1 parent 4ddb0fb commit 32184df
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 67 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/build-simd-image-from-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
2 changes: 2 additions & 0 deletions .github/workflows/build-wasm-simd-image-from-tag.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/e2e-manual-simd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ on:
- TestInterchainAccountsGovTestSuite
- TestIncentivizedInterchainAccountsTestSuite
- TestAuthzTransferTestSuite
- TestGrandpaTestSuite
chain-image:
description: 'The image to use for chain A'
required: true
Expand Down Expand Up @@ -72,6 +73,7 @@ on:
options:
- rly
- hermes
- hyperspace
relayer-tag:
description: 'The tag to use for the relayer'
required: true
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/e2e-manual-wasm-simd.yaml
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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
Expand Down
58 changes: 0 additions & 58 deletions .github/workflows/e2e-test-workflow-call.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 }}'
Expand Down Expand Up @@ -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 }}'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/e2e-wasm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}'
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/release-wasm.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
7 changes: 3 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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}"

Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion modules/light-clients/08-wasm/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 32184df

Please sign in to comment.