-
Notifications
You must be signed in to change notification settings - Fork 0
175 lines (145 loc) · 6.22 KB
/
node_test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
name: Node Tests
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
node_tests:
name: Run Node Tests
runs-on: ubuntu-latest-large
steps:
- name: Checkout code
uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Rust Cache
uses: Swatinem/rust-cache@v2
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly
- name: Install RISC0
uses: ./.github/actions/install-risc0
with:
version: 1.2.4
# Login to DockerHub with access token
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
# Set up Docker and Docker Compose
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
# Try to pull cache images (with separate tags for cache)
- name: Pull cache images
continue-on-error: true # Continue even if images don't exist yet
run: |
docker pull elladic/ttc-prover-server:cache || true
docker pull elladic/anvil-node:cache || true
docker pull elladic/ttc-monitor-server:cache || true
# Build with cache from pulled images
- name: Build Docker images
run: |
# Pull cache images
docker pull elladic/ttc-prover-server:cache || true
docker pull elladic/anvil-node:cache || true
docker pull elladic/ttc-monitor-server:cache || true
# Build prover-server image
echo "Building prover-server image..."
DOCKER_BUILDKIT=1 docker build \
--target prover-server \
--tag elladic/ttc-prover-server:local \
--cache-from elladic/ttc-prover-server:cache \
--build-arg BUILDKIT_INLINE_CACHE=1 \
-f docker/servers/Dockerfile .
# Build monitor-server image
echo "Building monitor-server image..."
DOCKER_BUILDKIT=1 docker build \
--target monitor-server \
--tag elladic/ttc-monitor-server:local \
--cache-from elladic/ttc-monitor-server:cache \
--build-arg BUILDKIT_INLINE_CACHE=1 \
-f docker/servers/Dockerfile .
# Debug: List directory contents to locate Dockerfile
echo "Contents of ./docker/anvil:"
ls -la ./docker/anvil/
# Build anvil-node image
echo "Building anvil-node image..."
DOCKER_BUILDKIT=1 docker build \
--tag elladic/anvil-node:local \
--cache-from elladic/anvil-node:cache \
--build-arg BUILDKIT_INLINE_CACHE=1 \
-f ./docker/anvil/Dockerfile ./docker/anvil
# Start services with docker compose using the built images
echo "Creating .env file with image references..."
echo "PROVER_SERVER_IMAGE=elladic/ttc-prover-server:local" > .env
echo "ETHEREUM_NODE_IMAGE=elladic/anvil-node:local" >> .env
echo "MONITOR_SERVER_IMAGE=elladic/ttc-monitor-server:local" >> .env
echo "Contents of .env file:"
cat .env
# Run mock tests for regular pushes/PRs
- name: Run node tests with mocks
if: github.event_name != 'schedule'
run: |
mkdir -p /tmp/risc0-work-dir
RISC0_DEV_MODE=true docker compose up -d
make compile-contract-deps
make fetch-image-id-contract > contract/src/ImageID.sol
make compile-ttc-contract
make create-schema
export TTC_ADDRESS=$(make deploy-mock | tee /dev/tty | tail -n 1)
TTC_ADDRESS="$TTC_ADDRESS" make run-node-tests
# Run full tests for nightly builds
- name: Run full node tests
if: github.event_name == 'schedule'
run: |
mkdir -p /tmp/risc0-work-dir
RISC0_DEV_MODE=false docker compose up -d
make compile-contract-deps
make fetch-image-id-contract > contract/src/ImageID.sol
make compile-ttc-contract
make create-schema
export TTC_ADDRESS=$(make deploy | tee /dev/tty | tail -n 1)
TTC_ADDRESS="$TTC_ADDRESS" NUM_ACTORS=3 PROVER_TIMEOUT=1200 make run-node-tests
# Get short git SHA for tagging
- name: Get short SHA
id: short_sha
run: echo "sha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
# Push versioned and cache images
- name: Push images
if: github.ref == 'refs/heads/main' && (success() || failure())
continue-on-error: true
run: |
# Get short SHA
SHA=$(git rev-parse --short HEAD)
# Tag and push prover-server images with SHA and cache tags
docker tag elladic/ttc-prover-server:local elladic/ttc-prover-server:$SHA
docker push elladic/ttc-prover-server:$SHA
docker tag elladic/ttc-prover-server:local elladic/ttc-prover-server:cache
docker push elladic/ttc-prover-server:cache
# Tag and push monitor-server images with SHA and cache tags
docker tag elladic/ttc-monitor-server:local elladic/ttc-monitor-server:$SHA
docker push elladic/ttc-monitor-server:$SHA
docker tag elladic/ttc-monitor-server:local elladic/ttc-monitor-server:cache
docker push elladic/ttc-monitor-server:cache
# Tag and push ethereum-node images with SHA and cache tags
docker tag elladic/anvil-node:local elladic/anvil-node:$SHA
docker push elladic/anvil-node:$SHA
docker tag elladic/anvil-node:local elladic/anvil-node:cache
docker push elladic/anvil-node:cache
# Push latest tag only on successful builds from main branch
- name: Push latest tag
if: github.ref == 'refs/heads/main' && success()
run: |
# Tag and push latest versions
docker tag elladic/ttc-prover-server:local elladic/ttc-prover-server:latest
docker push elladic/ttc-prover-server:latest
docker tag elladic/ttc-monitor-server:local elladic/ttc-monitor-server:latest
docker push elladic/ttc-monitor-server:latest
docker tag elladic/anvil-node:local elladic/anvil-node:latest
docker push elladic/anvil-node:latest
# Cleanup
- name: Cleanup
if: always()
run: docker compose down