diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a5c412feadb..9dacb31283a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,4 +1,4 @@ -name: Tests & Code Coverage +name: Tests on: pull_request: @@ -29,7 +29,7 @@ jobs: name: Skipping test run: echo Should I skip tests? ${{ steps.skip_check.outputs.should_skip }} - go_test: + go: needs: should_run_go_test if: ${{ needs.should_run_test.outputs.should_skip != 'true' }} runs-on: ubuntu-latest @@ -66,7 +66,7 @@ jobs: name: Run all tests run: make test-unit - e2e_test: + e2e: runs-on: ubuntu-latest timeout-minutes: 25 steps: diff --git a/Dockerfile b/Dockerfile index b1d1331a642..e8df0dca488 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,24 +8,35 @@ ARG BASE_IMG_TAG=nonroot FROM golang:1.18.2-alpine3.15 as build -RUN set -eux; apk add --no-cache ca-certificates build-base; -RUN apk add git -# Needed by github.com/zondax/hid -RUN apk add linux-headers +# linux-headers needed by github.com/zondax/hid +RUN set -eux; apk add --no-cache ca-certificates build-base; apk add git linux-headers +# CosmWasm: see https://github.com/CosmWasm/wasmvm/releases +# 1) Add the releases into /lib/ +ADD https://github.com/CosmWasm/wasmvm/releases/download/v1.0.0/libwasmvm_muslc.aarch64.a \ + https://github.com/CosmWasm/wasmvm/releases/download/v1.0.0/libwasmvm_muslc.x86_64.a \ + /lib/ +# 2) Verify their hashes +RUN sha256sum /lib/libwasmvm_muslc.aarch64.a | grep 7d2239e9f25e96d0d4daba982ce92367aacf0cbd95d2facb8442268f2b1cc1fc; \ + sha256sum /lib/libwasmvm_muslc.x86_64.a | grep f6282df732a13dec836cda1f399dd874b1e3163504dbd9607c6af915b2740479 +# Copy the right library according to architecture. The final location will be found by the linker flag `-lwasmvm_muslc` +RUN cp /lib/libwasmvm_muslc.$(uname -m).a /lib/libwasmvm_muslc.a + +# Get go dependencies first +COPY go.mod go.sum /osmosis/ WORKDIR /osmosis -COPY . /osmosis +RUN --mount=type=cache,target=/root/.cache/go-build \ + --mount=type=cache,target=/root/go/pkg/mod \ + go mod download -# CosmWasm: see https://github.com/CosmWasm/wasmvm/releases -ADD https://github.com/CosmWasm/wasmvm/releases/download/v1.0.0/libwasmvm_muslc.aarch64.a /lib/libwasmvm_muslc.aarch64.a -ADD https://github.com/CosmWasm/wasmvm/releases/download/v1.0.0/libwasmvm_muslc.x86_64.a /lib/libwasmvm_muslc.x86_64.a -RUN sha256sum /lib/libwasmvm_muslc.aarch64.a | grep 7d2239e9f25e96d0d4daba982ce92367aacf0cbd95d2facb8442268f2b1cc1fc -RUN sha256sum /lib/libwasmvm_muslc.x86_64.a | grep f6282df732a13dec836cda1f399dd874b1e3163504dbd9607c6af915b2740479 +# Copy all files into our docker repo +COPY . /osmosis -# CosmWasm: copy the right library according to architecture. The final location will be found by the linker flag `-lwasmvm_muslc` -RUN cp /lib/libwasmvm_muslc.$(uname -m).a /lib/libwasmvm_muslc.a +# build -RUN BUILD_TAGS=muslc LINK_STATICALLY=true make build +RUN --mount=type=cache,target=/root/.cache/go-build \ + --mount=type=cache,target=/root/go/pkg/mod \ + BUILD_TAGS=muslc LINK_STATICALLY=true make build # -------------------------------------------------------- # Runner diff --git a/Makefile b/Makefile index d88313efcf2..865c02d188b 100644 --- a/Makefile +++ b/Makefile @@ -258,13 +258,13 @@ build-e2e-script: go build -mod=readonly $(BUILD_FLAGS) -o $(BUILDDIR)/ ./tests/e2e/initialization/$(E2E_SCRIPT_NAME) docker-build-debug: - @docker build -t osmosis:debug --build-arg BASE_IMG_TAG=debug -f Dockerfile . + @DOCKER_BUILDKIT=1 docker build -t osmosis:debug --build-arg BASE_IMG_TAG=debug -f Dockerfile . docker-build-e2e-init-chain: - @docker build -t osmosis-e2e-init-chain:debug --build-arg E2E_SCRIPT_NAME=chain -f tests/e2e/initialization/init.Dockerfile . + @DOCKER_BUILDKIT=1 docker build -t osmosis-e2e-init-chain:debug --build-arg E2E_SCRIPT_NAME=chain -f tests/e2e/initialization/init.Dockerfile . docker-build-e2e-init-node: - @docker build -t osmosis-e2e-init-node:debug --build-arg E2E_SCRIPT_NAME=node -f tests/e2e/initialization/init.Dockerfile . + @DOCKER_BUILDKIT=1 docker build -t osmosis-e2e-init-node:debug --build-arg E2E_SCRIPT_NAME=node -f tests/e2e/initialization/init.Dockerfile . .PHONY: test-mutation diff --git a/tests/e2e/README.md b/tests/e2e/README.md index d34b339f52b..e0d33cf4f62 100644 --- a/tests/e2e/README.md +++ b/tests/e2e/README.md @@ -39,7 +39,7 @@ Conceptually, we can split the e2e setup into 2 parts: 1. Chain Initialization - The chain can either be initailized off of the current branch, or off the prior mainnet release and then upgraded to the current branch. + The chain can either be initialized off of the current branch, or off the prior mainnet release and then upgraded to the current branch. If current, we run chain initialization off of the current Git branch by calling `chain.Init(...)` method in the `configurer/current.go`. diff --git a/tests/e2e/configurer/chain/node.go b/tests/e2e/configurer/chain/node.go index 10b4cc99001..8ec7bad7e60 100644 --- a/tests/e2e/configurer/chain/node.go +++ b/tests/e2e/configurer/chain/node.go @@ -68,7 +68,7 @@ func (n *NodeConfig) Run() error { n.t.Logf("started node container: %s", n.Name) return true }, - 5*time.Minute, + 2*time.Minute, time.Second, "Osmosis node failed to produce blocks", )