Commit f0dc4e16 authored by Jason Yellick's avatar Jason Yellick

ci: Convert go-e2e-tests CI to make targets

This change makes it much easier to make build changes to the op-e2e
without having to reflect the changes from the Makefile into the CI
definition.  It also makes easier for developers to mirror the execution
of what's going on in CI locally.
parent 576ee49d
......@@ -775,11 +775,8 @@ jobs:
module:
description: Go Module Name
type: string
use_http:
description: If the op-e2e package should use HTTP clients
type: string
use_external:
description: The extra-process shim (if any) that should be used
target:
description: The make target to execute
type: string
docker:
- image: us-docker.pkg.dev/oplabs-tools-artifacts/images/ci-builder:latest
......@@ -791,13 +788,6 @@ jobs:
- run:
name: prep results dir
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:
name: install geth
command: make install-geth
......@@ -807,21 +797,12 @@ jobs:
- run:
name: print go's available MIPS targets
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:
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
# 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
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" ./...
JUNIT_FILE=/tmp/test-results/<<parameters.module>>_<<parameters.target>>.xml make <<parameters.target>>
working_directory: <<parameters.module>>
- store_test_results:
path: /tmp/test-results
......@@ -1232,18 +1213,15 @@ workflows:
- go-e2e-test:
name: op-e2e-WS-tests
module: op-e2e
use_http: "false"
use_external: ""
target: test-ws
- go-e2e-test:
name: op-e2e-HTTP-tests
module: op-e2e
use_http: "true"
use_external: ""
target: test-http
- go-e2e-test:
name: op-e2e-WS-tests-external-geth
name: op-e2e-ext-geth-tests
module: op-e2e
use_http: "false"
use_external: "external_geth"
target: test-external-geth
- bedrock-go-tests:
requires:
- op-batcher-lint
......
test: pre-test
go test -v ./...
# Generally, JUNIT_FILE is set in CI but may be specified to an arbitrary file location to emulate CI locally
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:
make -C .. cannon-prestate
.PHONY: cannon-prestate
# We depend on the absolute pre-state generated by cannon to deploy the dispute game contracts.
devnet-allocs: pre-test-cannon
make -C .. devnet-allocs
.PHONY: devnet-allocs
pre-test: pre-test-cannon pre-test-allocs
.PHONY: pre-test
pre-test-cannon:
@if [ ! -e ../op-program/bin ]; then \
make cannon-prestate; \
fi
.PHONY: pre-test-cannon
pre-test-allocs:
pre-test-allocs:
@if [ ! -e ../.devnet ]; then \
make devnet-allocs; \
fi
.PHONY: pre-test-allocs
clean:
rm -r ../.devnet
rm -r ../op-program/bin
.PHONY: clean
lint:
golangci-lint run -E goimports,sqlclosecheck,bodyclose,asciicheck,misspell,errorlint --timeout 5m -e "errors.As" -e "errors.Is" ./...
test-external-%: pre-test
make -C ./external_$*/
go test -v --externalL2 ./external_$*/shim
.PHONY: \
test \
lint
.PHONY: 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