-
Notifications
You must be signed in to change notification settings - Fork 38
204 lines (177 loc) · 6.56 KB
/
tests.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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
name: Run tests with workflow_call
on:
workflow_call:
inputs:
ref:
description: "Git ref to checkout to"
type: string
default: "main"
fluence-env:
description: "Fluence environment to run tests against"
type: string
default: "local"
chain-rpc-image:
description: "chain-rpc image tag"
type: string
default: "null"
chain-deploy-script-image:
description: "chain-deploy-script image tag"
type: string
default: "null"
subgraph-deploy-script-image:
description: "subgraph-deploy-script image tag"
type: string
default: "null"
deal-ts-clients-version:
description: "deal-ts-clients version"
type: string
default: "null"
node-version:
description: "Node version"
type: string
default: "22.10.0"
platform:
description: "OS and architecture"
type: string
default: "linux-x64"
env:
CI: true
FORCE_COLOR: true
DEBUG: "fcli:*,deal-ts-clients:*"
FLUENCE_ENV: "${{ inputs.fluence-env }}"
FLUENCE_USER_DIR: "${{ github.workspace }}/tmp/.fluence"
NPM_CONFIG_REGISTRY: "https://npm.fluence.dev"
FLUENCE_LOG_DISPLAY_SPAN_LIST: true
jobs:
tests:
name: "Run tests"
runs-on: builder
timeout-minutes: 60
permissions:
contents: write
id-token: write
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
steps:
- name: Checkout fluence-cli
uses: actions/checkout@v4
with:
repository: fluencelabs/cli
ref: ${{ inputs.ref }}
- name: Import secrets
uses: hashicorp/vault-action@v3.0.0
id: secrets
with:
url: https://vault.fluence.dev
path: jwt/github
role: ci
method: jwt
jwtGithubAudience: "https://github.com/fluencelabs"
jwtTtl: 300
exportToken: false
secrets: |
kv/hub.docker.com/fluencebot username | DOCKER_HUB_USERNAME ;
kv/hub.docker.com/fluencebot password | DOCKER_HUB_PASSWORD ;
kv/docker-registry/basicauth/ci username | DOCKER_USERNAME ;
kv/docker-registry/basicauth/ci password | DOCKER_PASSWORD ;
kv/npm-registry/basicauth/ci token | NODE_AUTH_TOKEN;
- name: Set deal images
run: |
# set deal images
case ${{ inputs.chain-rpc-image }} in
'null')
chain_rpc="$(jq '.["chain-rpc"]' packages/cli/package/src/versions.json -r)"
chain_deploy_script="$(jq '.["chain-deploy-script"]' packages/cli/package/src/versions.json -r)"
subgraph_deploy_script="$(jq '.["subgraph-deploy-script"]' packages/cli/package/src/versions.json -r)"
;;
# else set deal images to snapshots passed from e2e
*)
chain_rpc=${{ inputs.chain-rpc-image }}
chain_deploy_script=${{ inputs.chain-deploy-script-image }}
subgraph_deploy_script=${{ inputs.subgraph-deploy-script-image }}
;;
esac
echo "chain-rpc image used for tests is $chain_rpc"
echo "CHAIN_RPC_IMAGE=${chain_rpc}" >> $GITHUB_ENV
echo "chain-deploy-script image used for tests is $chain_deploy_script"
echo "CHAIN_DEPLOY_SCRIPT_IMAGE=${chain_deploy_script}" >> $GITHUB_ENV
echo "subgraph-deploy-script image used for tests is $subgraph_deploy_script"
echo "SUBGRAPH_DEPLOY_SCRIPT_IMAGE=${subgraph_deploy_script}" >> $GITHUB_ENV
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ env.DOCKER_HUB_USERNAME }}
password: ${{ env.DOCKER_HUB_PASSWORD }}
- name: Login to private docker registry
uses: docker/login-action@v3
with:
registry: docker.fluence.dev
username: ${{ env.DOCKER_USERNAME }}
password: ${{ env.DOCKER_PASSWORD }}
- name: Setup node with self-hosted npm registry
uses: actions/setup-node@v4
with:
node-version: ${{ inputs.node-version }}
registry-url: "https://npm.fluence.dev"
cache: "yarn"
- name: Configure yarn to publish to private registry
run: |
yarn config set npmRegistryServer "https://npm.fluence.dev"
yarn config set npmAlwaysAuth true
yarn config set npmAuthToken $NODE_AUTH_TOKEN
- run: yarn install
- name: Set deal-ts-clients version
if: inputs.deal-ts-clients-version != 'null'
uses: fluencelabs/github-actions/npm-set-dependency@main
with:
package: "@fluencelabs/deal-ts-clients"
version: "${{ inputs.deal-ts-clients-version }}"
package-manager: yarn
working-directory: packages/cli/package
- name: Update versions.json
uses: ./.github/actions/replace-version
with:
versions: |
{
"chain-rpc": "${{ env.CHAIN_RPC_IMAGE }}",
"chain-deploy-script": "${{ env.CHAIN_DEPLOY_SCRIPT_IMAGE }}",
"subgraph-deploy-script": "${{ env.SUBGRAPH_DEPLOY_SCRIPT_IMAGE }}"
}
- name: Cache turbo build setup
uses: actions/cache@v4
with:
path: .turbo
key: ${{ runner.os }}-turbo-${{ github.sha }}
restore-keys: |
${{ runner.os }}-turbo-
- name: Cache node binaries
id: cache-node-binaries
uses: actions/cache@v4
env:
cache-name: cache-node-binaries
with:
path: packages/cli/package/tmp/cache/node-v${{ inputs.node-version }}-${{ inputs.platform }}
key: ${{ env.cache-name }}-${{ inputs.node-version }}-${{ inputs.platform }}
- name: Pack Fluence CLI for Linux
run: yarn pack-${{ inputs.platform }}
- name: Generate templates
run: yarn generate-templates
- name: Set up the environment (local up)
if: inputs.fluence-env == 'local'
run: yarn local-up
- name: Run provider tests
run: yarn vitest-provider
- name: Show Runner Load Average
run: uptime
if: always()
- name: Dump container logs
if: always()
uses: jwalton/gh-docker-logs@v2
- name: Dump anvil state
if: contains(github.event.pull_request.labels.*.name, 'dump-anvil') && failure()
run: |
curl http://localhost:8545 \
-X POST \
-H "Content-Type: application/json" \
--data '{"id":0,"jsonrpc":"2.0","method":"anvil_dumpState","params":[]}'