Skip to content

Commit 82aa7c9

Browse files
committed
feat(ci): integration test
1 parent 84a8754 commit 82aa7c9

3 files changed

Lines changed: 128 additions & 0 deletions

File tree

.github/workflows/integration.yml

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
name: Project integration tests
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
10+
cancel-in-progress: true
11+
12+
jobs:
13+
# Build images and publish as artifacts
14+
build:
15+
name: Build images
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
21+
22+
- name: Set up Docker Buildx
23+
uses: docker/setup-buildx-action@v2
24+
25+
- name: Set up Rust
26+
uses: actions/setup-rust@v1
27+
28+
- name: Install Just
29+
uses: taiki-e/install-action@just
30+
31+
- name: Build Docker images
32+
run: |
33+
just build
34+
35+
- name: Save Docker images to tarballs
36+
run: |
37+
mkdir -p artifacts
38+
just ci export-images $(realpath ./artifacts)
39+
40+
- name: Upload images artifacts
41+
uses: actions/upload-artifact@v4
42+
with:
43+
name: based-op-images
44+
path: artifacts
45+
46+
# Use published artifacts and run nodes
47+
test:
48+
name: Configure nodes & run tests
49+
runs-on: ubuntu-latest
50+
needs: build
51+
env:
52+
BASED_ENV: dev
53+
steps:
54+
- uses: actions/checkout@v4
55+
with:
56+
fetch-depth: 0
57+
58+
- name: Install Just
59+
uses: taiki-e/install-action@just
60+
61+
- name: Set up Foundry (for Ethereum tests)
62+
uses: foundry-rs/setup-foundry@v1
63+
with:
64+
version: latest
65+
66+
- name: Download images artifacts
67+
uses: actions/download-artifact@v4
68+
with:
69+
name: based-op-images
70+
path: ./artifacts
71+
72+
- name: Load Docker images
73+
run: |
74+
set -euo pipefail
75+
find ./artifacts -f -exec gunzip -c {} | docker load \;
76+
77+
- name: Prepare configuration
78+
run: |
79+
set -euo pipefail
80+
just ci prepare
81+
82+
- name: Publish configuration artifact
83+
uses: actions/upload-artifact@v4
84+
with:
85+
name: config
86+
path: |
87+
.local/
88+
89+
- name: Start Based OP services
90+
run: |
91+
set -euo pipefail
92+
just ci run
93+
94+
- name: Run tests
95+
run: |
96+
set -euo pipefail
97+
just ci test
98+
99+
- run: |
100+
just ci stop

based/docker/Justfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ build image *args:
99
docker build -t local_based_{{image}} -f ./{{image}}.Dockerfile ../ {{args}} \
1010
{{quiet}}
1111

12+
save image dest:
13+
echo "Exporting {{image}}..."
14+
docker save local_based{{image}} | gzip > {{dest}}/based-{{image}}.tar.gz
15+
1216
build-portal: (build "portal")
1317
build-registry: (build "registry")
1418
build-gateway: (build "gateway")
@@ -18,6 +22,9 @@ build-metrics-exporter: (build "metrics-exporter" "--load")
1822
[parallel]
1923
all: build-portal build-registry build-gateway build-txproxy build-metrics-exporter
2024

25+
[parallel]
26+
export-all dest: (save "portal" dest) (save "registry" dest) (save "gateway" dest) (save "txproxy" dest) (save "metrics-exporter" dest)
27+
2128
# Creates the docker network `name` if it doesn't already exist
2229
create-network name="based_op_net":
2330
docker network inspect {{name}} > /dev/null 2>&1 || docker network create {{name}}

scripts/ci.just

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ root := join(justfile_directory(), "..")
22
assets := canonicalize(join(root, ".github", "assets"))
33

44
parent := "just -f " + join(root, "Justfile")
5+
based := "just -f " + join(root, "based", "docker", "Justfile")
6+
deps := "just -f " + join(root, "deps", "Justfile")
57

68
# Prepare chain config from known values
79
prepare:
@@ -25,6 +27,25 @@ prepare:
2527
2628
echo "*** Main Node and Follower Node configured! Use \`run\` to start both"
2729
30+
# Run the configured chain
2831
@run: (prepare)
2932
{{parent}} main-node start
3033
{{parent}} follower-node start-dev
34+
35+
# Run tests on the configured chain
36+
test:
37+
{{parent}} test tx
38+
39+
# Stop the configured chain
40+
@stop:
41+
{{parent}} main-node stop
42+
{{parent}} follower-node stop
43+
44+
# Save the built images of the used services
45+
export-images dest:
46+
docker save local_based_op_node | gzip > {{dest}}/based-op-node.tar.gz
47+
docker save local_based_op_deployer | gzip > {{dest}}/based-op-deployer.tar.gz
48+
docker save local_based_op_geth | gzip > {{dest}}/based-op-geth.tar.gz
49+
{{based}} export-all {{dest}}
50+
51+

0 commit comments

Comments
 (0)