-
Notifications
You must be signed in to change notification settings - Fork 97
182 lines (157 loc) · 6.3 KB
/
Copy pathcli.yml
File metadata and controls
182 lines (157 loc) · 6.3 KB
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
176
177
178
179
180
181
182
name: CLI
on:
workflow_dispatch:
pull_request:
push:
branches:
- main
# Cancel in-progress runs on new commits to same PR/branch
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions: {}
jobs:
test-cli-unit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
with:
bun-version: "1.3.4"
- run: bun ci
- run: bun run --filter '@wormhole-foundation/ntt-cli' test
# EVM tests - native runner with forge build cache from evm.yml
test-evm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
submodules: recursive
persist-credentials: false
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@c7450ba673e133f5ee30098b3b54f444d3a2ca2d # v1.8.0
with:
version: v1.5.0
- name: Install Bun
uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
with:
bun-version: "1.3.4"
- name: Restore forge build cache
uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
with:
path: |
evm/out
evm/cache
key: forge-via-ir-${{ hashFiles('evm/src/**/*.sol', 'evm/script/**/*.sol', 'evm/foundry.toml') }}
restore-keys: |
forge-via-ir-
- name: Install NTT CLI
run: ./cli/install.sh
- name: Run EVM shell tests
env:
NTT_EVM_CACHE_DIR: ${{ github.workspace }}/evm
BSC_RPC_URL: ${{ secrets.BSC_RPC_URL }} # zizmor: ignore[secrets-outside-env]
SEPOLIA_RPC_URL: ${{ secrets.SEPOLIA_RPC_URL }} # zizmor: ignore[secrets-outside-env]
run: ./cli/test/sepolia-bsc.sh
- name: Run EVM E2E tests
env:
NTT_EVM_CACHE_DIR: ${{ github.workspace }}/evm
SEPOLIA_RPC_URL: ${{ secrets.SEPOLIA_RPC_URL }} # zizmor: ignore[secrets-outside-env]
BASE_SEPOLIA_RPC_URL: ${{ secrets.BASE_SEPOLIA_RPC_URL }} # zizmor: ignore[secrets-outside-env]
run: bun run --cwd cli test:e2e
# Build Solana contracts (v1.0.0 and v2.0.0 in parallel)
# Artifacts are cached based on version tag + build script hash
build-solana:
runs-on: ubuntu-latest
strategy:
matrix:
version: ["1.0.0", "2.0.0"]
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Restore cached v${{ matrix.version }} artifacts
id: cache
# zizmor flags this because it sees docker/build-push-action below and assumes it publishes
# artifacts (so cache poisoning could leak out), but the build here doesn't publish anything.
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 # zizmor: ignore[cache-poisoning]
with:
path: /tmp/solana-artifacts/v${{ matrix.version }}
key: solana-v${{ matrix.version }}-${{ hashFiles('cli/test/build-solana.sh', 'Dockerfile.cli', 'Dockerfile.anchor-base', 'solana/Anchor.toml') }}
- name: Free disk space
if: steps.cache.outputs.cache-hit != 'true'
run: sudo rm -rf /usr/local/lib/android
- name: Set up Docker Buildx
if: steps.cache.outputs.cache-hit != 'true'
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3
- name: Build cli-local image
if: steps.cache.outputs.cache-hit != 'true'
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6
with:
context: .
file: Dockerfile.cli
target: cli-local
load: true
tags: cli-local:latest
cache-from: type=gha,scope=cli
cache-to: type=gha,mode=max,scope=cli
- name: Build Solana v${{ matrix.version }}
if: steps.cache.outputs.cache-hit != 'true'
run: |
docker run --rm \
-v "${{ github.workspace }}:/workspace" \
-v "/tmp/solana-artifacts:/tmp/solana-artifacts" \
-e OUTPUT_DIR=/tmp/solana-artifacts \
-e HOME=/root \
-w /workspace \
cli-local:latest \
bash -c "./cli/test/build-solana.sh ${{ matrix.version }}"
- name: Upload v${{ matrix.version }} artifacts
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: solana-v${{ matrix.version }}-artifacts
path: /tmp/solana-artifacts/v${{ matrix.version }}
retention-days: 1
# Run Solana tests using pre-built artifacts
test-solana:
needs: build-solana
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Download v1.0.0 artifacts
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
with:
name: solana-v1.0.0-artifacts
path: /tmp/solana-artifacts/v1.0.0
- name: Download v2.0.0 artifacts
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
with:
name: solana-v2.0.0-artifacts
path: /tmp/solana-artifacts/v2.0.0
- name: Free disk space
run: sudo rm -rf /usr/local/lib/android
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3
- name: Build cli-local image
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6
with:
context: .
file: Dockerfile.cli
target: cli-local
load: true
tags: cli-local:latest
cache-from: type=gha,scope=cli
- name: Run Solana tests
run: |
docker run --rm \
-v "${{ github.workspace }}:/workspace" \
-v "/tmp/solana-artifacts:/tmp/solana-artifacts" \
-e SOLANA_ARTIFACTS_DIR=/tmp/solana-artifacts \
-e HOME=/root \
-w /workspace \
cli-local:latest \
bash -ci "./cli/test/solana.sh --use-tmp-dir"