-
Notifications
You must be signed in to change notification settings - Fork 5
152 lines (149 loc) · 6.17 KB
/
test.yaml
File metadata and controls
152 lines (149 loc) · 6.17 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
name: test
on:
push:
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
env:
NX_DAEMON: false
BASE_RPC_URL: ${{ secrets.BASE_RPC_URL }}
ETHEREUM_RPC_URL: ${{ secrets.ETHEREUM_RPC_URL }}
OPTIMISM_RPC_URL: ${{ secrets.OPTIMISM_RPC_URL }}
OPTIMISM_SEPOLIA_RPC_URL: ${{ secrets.OPTIMISM_SEPOLIA_RPC_URL }}
POLYGON_RPC_URL: ${{ secrets.POLYGON_RPC_URL }}
steps:
- uses: actions/checkout@v6
with: { fetch-depth: 0, fetch-tags: true }
- uses: actions/setup-node@v6
with: { node-version: "^24.14.1" }
- uses: foundry-rs/foundry-toolchain@v1
with: { version: v1.5.1 }
- uses: actions/setup-python@v6
with:
python-version: "3.12"
cache: pip
cache-dependency-path: contracts/requirements.txt
- uses: actions/cache@v5
with:
path: .nx/cache
key: nx-${{ runner.os }}-${{ github.sha }}
restore-keys: nx-${{ runner.os }}-
- run: pip install -r contracts/requirements.txt
- run: |
mkdir -p $HOME/.local/bin && cd $HOME/.local/bin
streamingfast=""
for source in firehose-ethereum:latest substreams:latest substreams-sink-sql:latest; do
repo="${source%%:*}"
release="${source#*:}"
curl --retry 5 --retry-all-errors --retry-delay 2 -L "$(curl --retry 5 --retry-all-errors --retry-delay 2 -sH 'Authorization: token ${{ github.token }}' https://api.github.com/repos/streamingfast/$repo/releases/$release | jq --arg arch "$(uname -m | sed 's/aarch64/arm64/')" -r '.assets[] | select(.browser_download_url | test("linux_" + $arch)) | .browser_download_url')" | tar zxf - &
streamingfast="$streamingfast $!"
done
for pid in $streamingfast; do wait "$pid" || exit 1; done
- run: echo ::add-matcher::.github/matcher.json
- run: corepack enable
- run: pnpm install --frozen-lockfile
- run: pnpm nx run-many -t test
- uses: codecov/codecov-action@v6
if: ${{ !cancelled() }}
with:
token: ${{ secrets.CODECOV_TOKEN }}
name: test
- uses: codecov/codecov-action@v6
if: ${{ !cancelled() }}
with:
report_type: test_results
files: server/coverage/junit.xml
token: ${{ secrets.CODECOV_TOKEN }}
name: test
- uses: actions/upload-artifact@v7
if: ${{ !cancelled() }}
with:
name: server-artifacts
path: server/node_modules/@exactly/.*
include-hidden-files: true
e2e:
runs-on: ubuntu-latest
timeout-minutes: 30
env:
NX_DAEMON: false
CHAIN_ID: "31337"
EXPO_PUBLIC_E2E_MNEMONIC: ${{ secrets.EXPO_PUBLIC_E2E_MNEMONIC }}
steps:
- uses: actions/checkout@v6
with: { fetch-depth: 0, fetch-tags: true }
- uses: actions/setup-node@v6
with: { node-version: "^24.14.1" }
- uses: foundry-rs/foundry-toolchain@v1
with: { version: v1.5.1 }
- uses: actions/cache@v5
with:
path: .nx/cache
key: nx-${{ runner.os }}-${{ github.sha }}
restore-keys: nx-${{ runner.os }}-
- uses: actions/setup-java@v5
with: { distribution: zulu, java-version: "17" }
- run: |
set -o pipefail
mkdir -p $HOME/.local/bin && cd $HOME/.local/bin
streamingfast=""
for source in firehose-ethereum:latest substreams:latest substreams-sink-sql:latest; do
repo="${source%%:*}"
release="${source#*:}"
curl --retry 5 --retry-all-errors --retry-delay 2 -L "$(curl --retry 5 --retry-all-errors --retry-delay 2 -sH 'Authorization: token ${{ github.token }}' https://api.github.com/repos/streamingfast/$repo/releases/$release | jq --arg arch "$(uname -m | sed 's/aarch64/arm64/')" -r '.assets[] | select(.browser_download_url | test("linux_" + $arch)) | .browser_download_url')" | tar zxf - &
streamingfast="$streamingfast $!"
done
for pid in $streamingfast; do wait "$pid" || exit 1; done
for attempt in {1..5}; do
curl -fsSL "https://get.maestro.mobile.dev" | bash || true
[ -x $HOME/.maestro/bin/maestro ] && $HOME/.maestro/bin/maestro --version && echo $HOME/.maestro/bin >> "$GITHUB_PATH" && break
[ "$attempt" -eq 5 ] && echo "maestro install failed after 5 attempts" && exit 1
rm -rf $HOME/.maestro $HOME/.maestro.tmp
sleep 2
done
- run: echo ::add-matcher::.github/matcher.json
- run: corepack enable
- run: pnpm install --frozen-lockfile
- run: |
pnpm nx run-many -t build -p mobile e2e
pnpm nx generate:app server
pnpm nx e2e server > server.log 2>&1 &
pnpm dlx serve server/app -l 8081 -snL &
for i in {1..420}; do
curl -f http://localhost:3000/api/auth/authentication > /dev/null 2>&1 && break
[ $i -eq 420 ] && cat server.log && exit 1
sleep 1
done
CHROME_LOG_FILE=$PWD/chrome.log xvfb-run maestro test .maestro/flows/web.yaml --format junit --output .maestro/junit.xml
env: { APP_DOMAIN: localhost, EXPO_PUBLIC_ENV: e2e }
- if: always()
run: |
curl -X POST http://localhost:3000/e2e/shutdown || true
for i in {1..60}; do [ -f server/coverage/lcov.info ] && break; sleep 1; done
- uses: codecov/codecov-action@v6
if: ${{ !cancelled() }}
with:
files: server/coverage/lcov.info,server/coverage/app.json
token: ${{ secrets.CODECOV_TOKEN }}
flags: e2e
name: web
- uses: codecov/codecov-action@v6
if: ${{ !cancelled() }}
with:
report_type: test_results
files: .maestro/junit.xml
token: ${{ secrets.CODECOV_TOKEN }}
flags: e2e
name: web
- uses: actions/upload-artifact@v7
if: ${{ !cancelled() }}
with:
name: e2e-artifacts
path: |
chrome.log
server.log
server/coverage
server/node_modules/@exactly/.*
~/.maestro/tests
.maestro/screenshots
include-hidden-files: true