Commit 48ed4e8c authored by OptimismBot's avatar OptimismBot Committed by GitHub

Merge pull request #7033 from bobanetwork/ci-move-e2e-to-make

ci: Convert go-e2e-tests CI to make targets
parents 576ee49d f0dc4e16
...@@ -775,11 +775,8 @@ jobs: ...@@ -775,11 +775,8 @@ jobs:
module: module:
description: Go Module Name description: Go Module Name
type: string type: string
use_http: target:
description: If the op-e2e package should use HTTP clients description: The make target to execute
type: string
use_external:
description: The extra-process shim (if any) that should be used
type: string type: string
docker: docker:
- image: us-docker.pkg.dev/oplabs-tools-artifacts/images/ci-builder:latest - image: us-docker.pkg.dev/oplabs-tools-artifacts/images/ci-builder:latest
...@@ -791,13 +788,6 @@ jobs: ...@@ -791,13 +788,6 @@ jobs:
- run: - run:
name: prep results dir name: prep results dir
command: mkdir -p /tmp/test-results command: mkdir -p /tmp/test-results
- when:
condition: <<parameters.use_external>>
steps:
- run:
name: Build Shim
command: make -C <<parameters.use_external>>
working_directory: <<parameters.module>>
- run: - run:
name: install geth name: install geth
command: make install-geth command: make install-geth
...@@ -807,21 +797,12 @@ jobs: ...@@ -807,21 +797,12 @@ jobs:
- run: - run:
name: print go's available MIPS targets name: print go's available MIPS targets
command: go tool dist list | grep mips command: go tool dist list | grep mips
- run:
name: Run all init steps for op-e2e
command: make pre-test
working_directory: <<parameters.module>>
- run: - run:
name: run tests name: run tests
command: | command:
# Note: We don't use circle CI test splits because we need to split by test name, not by package. There is an additional # Note: We don't use circle CI test splits because we need to split by test name, not by package. There is an additional
# constraint that gotestsum does not currently (nor likely will) accept files from different pacakges when building. # constraint that gotestsum does not currently (nor likely will) accept files from different pacakges when building.
# Note: -parallel must be set to match the number of cores in the resource class JUNIT_FILE=/tmp/test-results/<<parameters.module>>_<<parameters.target>>.xml make <<parameters.target>>
export TEST_SUFFIX="<<parameters.use_external>>"
export EXTERNAL_L2="$(test -z '<<parameters.use_external>>' || echo '<<parameters.use_external>>/shim')"
OP_TESTLOG_DISABLE_COLOR=true OP_E2E_DISABLE_PARALLEL=false OP_E2E_USE_HTTP=<<parameters.use_http>> gotestsum \
--format=standard-verbose --junitfile=/tmp/test-results/<<parameters.module>>_http_<<parameters.use_http>>$TEST_SUFFIX.xml \
-- -timeout=20m -parallel=8 --externalL2 "$EXTERNAL_L2" ./...
working_directory: <<parameters.module>> working_directory: <<parameters.module>>
- store_test_results: - store_test_results:
path: /tmp/test-results path: /tmp/test-results
...@@ -1232,18 +1213,15 @@ workflows: ...@@ -1232,18 +1213,15 @@ workflows:
- go-e2e-test: - go-e2e-test:
name: op-e2e-WS-tests name: op-e2e-WS-tests
module: op-e2e module: op-e2e
use_http: "false" target: test-ws
use_external: ""
- go-e2e-test: - go-e2e-test:
name: op-e2e-HTTP-tests name: op-e2e-HTTP-tests
module: op-e2e module: op-e2e
use_http: "true" target: test-http
use_external: ""
- go-e2e-test: - go-e2e-test:
name: op-e2e-WS-tests-external-geth name: op-e2e-ext-geth-tests
module: op-e2e module: op-e2e
use_http: "false" target: test-external-geth
use_external: "external_geth"
- bedrock-go-tests: - bedrock-go-tests:
requires: requires:
- op-batcher-lint - op-batcher-lint
......
test: pre-test # Generally, JUNIT_FILE is set in CI but may be specified to an arbitrary file location to emulate CI locally
go test -v ./... ifdef JUNIT_FILE
go_test = OP_TESTLOG_DISABLE_COLOR=true OP_E2E_DISABLE_PARALLEL=false gotestsum --format=standard-verbose --junitfile=$(JUNIT_FILE) --
# Note: -parallel must be set to match the number of cores in the resource class
go_test_flags = -timeout=20m -parallel=8
else
go_test = go test
go_test_flags = -v
endif
test: pre-test test-ws
.PHONY: test
test-external-%: pre-test
make -C ./external_$*/
$(go_test) $(go_test_flags) --externalL2 ./external_$*/shim
test-ws: pre-test
$(go_test) $(go_test_flags) ./...
.PHONY: test-ws
test-http: pre-test
OP_E2E_USE_HTTP=true $(go_test) $(go_test_flags) ./...
.PHONY: test-ws
cannon-prestate: cannon-prestate:
make -C .. cannon-prestate make -C .. cannon-prestate
.PHONY: cannon-prestate
# We depend on the absolute pre-state generated by cannon to deploy the dispute game contracts. # We depend on the absolute pre-state generated by cannon to deploy the dispute game contracts.
devnet-allocs: pre-test-cannon devnet-allocs: pre-test-cannon
make -C .. devnet-allocs make -C .. devnet-allocs
.PHONY: devnet-allocs
pre-test: pre-test-cannon pre-test-allocs pre-test: pre-test-cannon pre-test-allocs
.PHONY: pre-test
pre-test-cannon: pre-test-cannon:
@if [ ! -e ../op-program/bin ]; then \ @if [ ! -e ../op-program/bin ]; then \
make cannon-prestate; \ make cannon-prestate; \
fi fi
.PHONY: pre-test-cannon
pre-test-allocs: pre-test-allocs:
@if [ ! -e ../.devnet ]; then \ @if [ ! -e ../.devnet ]; then \
make devnet-allocs; \ make devnet-allocs; \
fi fi
.PHONY: pre-test-allocs
clean: clean:
rm -r ../.devnet rm -r ../.devnet
rm -r ../op-program/bin rm -r ../op-program/bin
.PHONY: clean
lint: lint:
golangci-lint run -E goimports,sqlclosecheck,bodyclose,asciicheck,misspell,errorlint --timeout 5m -e "errors.As" -e "errors.Is" ./... golangci-lint run -E goimports,sqlclosecheck,bodyclose,asciicheck,misspell,errorlint --timeout 5m -e "errors.As" -e "errors.Is" ./...
.PHONY: lint
test-external-%: pre-test
make -C ./external_$*/
go test -v --externalL2 ./external_$*/shim
.PHONY: \
test \
lint
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment