-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (61 loc) · 1.94 KB
/
ci.yml
File metadata and controls
74 lines (61 loc) · 1.94 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
# Replaces manual "Ganache + deploy" checks from phase-05: local JSON-RPC on :8545,
# compile, test, deploy TelemetryAnchor, verify localhost.json.
# Uses Hardhat's built-in node (same port/network as hardhat.config localhost).
name: CI
on:
push:
pull_request:
jobs:
python:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: "pip"
- name: Install dependencies
run: pip install -r requirements.txt httpx
- name: Run pytest
run: python -m pytest
contracts-e2e:
runs-on: ubuntu-latest
defaults:
run:
working-directory: contracts
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20"
cache: npm
cache-dependency-path: contracts/package-lock.json
- name: Install npm dependencies
run: npm ci
- name: Compile Solidity
run: npx hardhat compile
- name: Run Hardhat tests
run: npx hardhat test
- name: E2E — local chain, deploy, verify artifact
run: |
set -e
npx hardhat node > /tmp/hardhat-node.log 2>&1 &
NODE_PID=$!
sleep 10
npx hardhat run scripts/deploy.js --network localhost
node <<'NODE'
const fs = require("fs");
const path = require("path");
const p = path.join("deployments", "localhost.json");
if (!fs.existsSync(p)) {
console.error("missing", p);
process.exit(1);
}
const j = JSON.parse(fs.readFileSync(p, "utf8"));
if (!/^0x[0-9a-fA-F]{40}$/.test(j.contractAddress)) {
console.error("invalid contractAddress", j);
process.exit(1);
}
console.log("E2E OK:", j.contractAddress);
NODE
kill $NODE_PID 2>/dev/null || true