-
Notifications
You must be signed in to change notification settings - Fork 0
136 lines (113 loc) · 4.99 KB
/
playwright.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
name: Playwright Tests
on:
push:
branches: [main, master, feat/tests/test-init, releases/*]
pull_request:
branches: [main, master, releases/*]
workflow_dispatch:
env:
codex_version: v0.1.7
circuit_version: v0.1.7
marketplace_address: "0xfE822Df439d987849a90B64a4C0e26a297DBD47F"
eth_provider: "https://rpc.testnet.codex.storage"
VITE_CODEX_API_URL: ${{ secrets.VITE_CODEX_API_URL }}
VITE_GEO_IP_URL: ${{ secrets.VITE_GEO_IP_URL }}
jobs:
tests:
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- name: Install dependencies
run: sudo apt update && sudo apt install libgomp1
- name: Setup env variables
run: |
echo "platform=${RUNNER_OS,,}" >> $GITHUB_ENV
echo "architecture=$([[ $RUNNER_ARCH == 'X64' ]] && echo amd64 || echo ${RUNNER_ARCH,,})" >> $GITHUB_ENV
- name: Restore cached circuits
id: circuits-cache-restore
uses: actions/cache/restore@v4
with:
path: |
datadir/circuits
key: ${{ env.circuit_version }}-circuits
- name: Download circuits
if: steps.circuits-cache-restore.outputs.cache-hit != 'true'
run: |
mkdir -p datadir/circuits
chmod 700 datadir
chmod 700 datadir/circuits
curl -OL https://github.com/codex-storage/nim-codex/releases/download/${circuit_version}/cirdl-${circuit_version}-${platform}-${architecture}.tar.gz
tar -xvf cirdl-${circuit_version}-${platform}-${architecture}.tar.gz
chmod +x cirdl-${circuit_version}-${platform}-${architecture}
./cirdl-${circuit_version}-${platform}-${architecture} ./datadir/circuits ${eth_provider} ${marketplace_address}
- name: Cache circuits
id: circuits-cache
uses: actions/cache/save@v4
with:
path: datadir/circuits
key: ${{ steps.circuits-cache-restore.outputs.cache-primary-key }}
- name: Restore cached codex
id: codex-cache-restore
uses: actions/cache/restore@v4
with:
path: ./codex-${{ env.codex_version }}-${{ env.platform }}-${{ env.architecture }}
key: ${{ env.codex_version }}-codex
- name: Download codex
if: steps.codex-cache-restore.outputs.cache-hit != 'true'
run: |
curl -LO https://github.com/codex-storage/nim-codex/releases/download/${codex_version}/codex-${codex_version}-${platform}-${architecture}.tar.gz
curl -LO https://github.com/codex-storage/nim-codex/releases/download/${codex_version}/codex-${codex_version}-${platform}-${architecture}.tar.gz.sha256
sha256sum -c codex-${codex_version}-${platform}-${architecture}.tar.gz.sha256
[[ $? -eq 0 ]] && { echo "Checksum is OK"; } || { echo "Checksum failed"; exit 1; }
tar -zxvf codex-${codex_version}-${platform}-${architecture}.tar.gz
- name: Cache codex
id: codex-cache
uses: actions/cache/save@v4
with:
path: ./codex-${{ env.codex_version }}-${{ env.platform }}-${{ env.architecture }}
key: ${{ steps.codex-cache-restore.outputs.cache-primary-key }}
- name: Run Codex node
run: |
# Get an eth address
response=$(curl -s https://key.codex.storage)
awk -F ': ' '/private/ {print $2}' <<<"${response}" > eth.key
awk -F ': ' '/address/ {print $2}' <<<"${response}" > eth.address
chmod 600 eth.key
# Run
./codex-${codex_version}-${platform}-${architecture} --data-dir=datadir --api-cors-origin="*" persistence --eth-provider=${eth_provider} --eth-private-key=./eth.key --marketplace-address=${marketplace_address} prover --circuit-dir=./datadir/circuits &
sleep 15
- name: Check Codex API
run: |
curl --max-time 5 --fail localhost:8080/api/codex/v1/debug/info -w "\n"
[[ $? -eq 0 ]] && { echo "Codex node is up"; } || { echo "Please check Codex node"; exit 1; }
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: lts/*
- uses: actions/cache@v4
id: npm-cache
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
# - uses: actions/cache@v4
# id: playwright-browsers-cache
# with:
# path: ~/.cache/ms-playwright
# key: ${{ runner.os }}-node-${{ hashFiles('**/playwright.config.ts') }}
# - if: steps.playwright-browsers-cache.outputs.cache-hit != 'true'
# name: Install Playwright Browsers
# run: npx playwright install --with-deps
- name: Install Playwright Browsers
run: npx playwright install --with-deps
- name: Run Playwright tests
run: npm run test
- uses: actions/upload-artifact@v4
# if: ${{ !cancelled() }}
with:
name: playwright-report
path: playwright-report/
retention-days: 30