-
Notifications
You must be signed in to change notification settings - Fork 242
200 lines (178 loc) · 6.38 KB
/
Copy pathdeploy-and-test.yaml
File metadata and controls
200 lines (178 loc) · 6.38 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
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
name: Deploy and Test
on:
workflow_call:
inputs:
docker_image_tag:
required: true
type: string
description: "The Docker image tag to deploy"
environment:
required: true
type: string
description: "The environment to deploy to (Development or Staging)"
source_repo:
required: true
type: string
description: "Source repository for the image"
target_repo:
required: true
type: string
description: "Target repository for the image"
test_mode:
required: false
type: string
default: "full"
description: "Test mode to run (fast or full)"
secrets:
RPC_URL:
required: true
WS_RPC_URL:
required: true
TEST_ACCOUNT_ADDRESS:
required: true
TEST_ACCOUNT_PRIVATE_KEY:
required: true
TEST_ACCOUNT_ADDRESS_2:
required: true
TEST_ACCOUNT_PRIVATE_KEY_2:
required: true
TEST_ACCOUNT_ADDRESS_3:
required: true
TEST_ACCOUNT_PRIVATE_KEY_3:
required: true
TEST_ACCOUNT_PUBLIC_KEY_3:
required: true
AUTH_TOKEN:
required: true
APP_PRIVATE_KEY:
required: true
concurrency:
group: shared_${{ inputs.environment }}_environment
cancel-in-progress: false
permissions:
contents: read
id-token: write
env:
DOCKER_REGISTRY: nethermind.jfrog.io
jobs:
deploy:
runs-on: ubuntu-latest
environment:
name: ${{ inputs.environment }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v.3.11.1
id: buildx
- name: Install JFrog CLI
id: jfrog
uses: jfrog/setup-jfrog-cli@ff5cb544114ffc152db9cea1cd3d5978d5074946 # v4.5.11
env:
JF_URL: https://${{ env.DOCKER_REGISTRY }}
with:
oidc-provider-name: github-nethermindeth
- name: Login to Registry with OIDC
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
with:
registry: ${{ env.DOCKER_REGISTRY }}
username: ${{ steps.jfrog.outputs.oidc-user }}
password: ${{ steps.jfrog.outputs.oidc-token }}
- name: Setup ORAS
uses: oras-project/setup-oras@8d34698a59f5ffe24821f0b48ab62a3de8b64b20
- name: Check image exists in source repository
run: |
oras manifest fetch \
${{ env.DOCKER_REGISTRY }}/${{ inputs.source_repo }}/juno:${{ inputs.docker_image_tag }} || \
(echo "❌ Image not found in source repository!" && exit 1)
- name: Deploy image
run: |
SOURCE_TAG=${{ env.DOCKER_REGISTRY }}/${{ inputs.source_repo }}/juno:${{ inputs.docker_image_tag }}
TARGET_TAG=${{ env.DOCKER_REGISTRY }}/${{ inputs.target_repo }}/juno:${{ inputs.docker_image_tag }}
if [ "${{ inputs.source_repo }}" = "${{ inputs.target_repo }}" ]; then
echo "Source and target repositories are the same, pushing as latest"
docker buildx imagetools create -t ${{ env.DOCKER_REGISTRY }}/${{ inputs.target_repo }}/juno:latest $SOURCE_TAG
else
echo "Copying image from source to target repository"
oras cp -r $SOURCE_TAG $TARGET_TAG,latest
fi
- name: Verify Deployment Version
run: |
bash .github/workflow-scripts/verify_deployment.sh ${{ secrets.RPC_URL }} ${{ secrets.AUTH_TOKEN }} ${{ inputs.docker_image_tag }}
starknet-rs:
needs: [deploy]
uses: ./.github/workflows/starknet-rs-tests.yml
secrets:
STARKNET_RPC: ${{ secrets.RPC_URL }}/v0_8?apikey=${{ secrets.AUTH_TOKEN }}
starknet-js-rpcv08:
needs: [deploy]
uses: ./.github/workflows/starknet-js-tests.yml
with:
test_mode: ${{ inputs.test_mode }}
secrets:
TEST_RPC_URL: ${{ secrets.RPC_URL }}/v0_8?apikey=${{ secrets.AUTH_TOKEN }}
TEST_ACCOUNT_ADDRESS: ${{ secrets.TEST_ACCOUNT_ADDRESS }}
TEST_ACCOUNT_PRIVATE_KEY: ${{ secrets.TEST_ACCOUNT_PRIVATE_KEY }}
starknet-js-rpcv09:
needs: [deploy]
uses: ./.github/workflows/starknet-js-tests.yml
with:
test_mode: ${{ inputs.test_mode }}
secrets:
TEST_RPC_URL: ${{ secrets.RPC_URL }}/v0_9?apikey=${{ secrets.AUTH_TOKEN }}
TEST_WS_URL: ${{ secrets.WS_RPC_URL }}/v0_9?apikey=${{ secrets.AUTH_TOKEN }}
TEST_ACCOUNT_ADDRESS: ${{ secrets.TEST_ACCOUNT_ADDRESS_2 }}
TEST_ACCOUNT_PRIVATE_KEY: ${{ secrets.TEST_ACCOUNT_PRIVATE_KEY_2 }}
starknet-go-rpcv08:
needs: [deploy]
uses: ./.github/workflows/starknet-go-tests.yml
with:
ref: 8ab778d86f42c344ac789acae897d9621530e3de
rpc_version: v0_8
secrets:
TEST_RPC_URL: ${{ secrets.RPC_URL }}
TEST_WS_RPC_URL: ${{ secrets.WS_RPC_URL }}
AUTH_TOKEN: ${{ secrets.AUTH_TOKEN }}
starknet-go-rpcv09:
needs: [deploy]
uses: ./.github/workflows/starknet-go-tests.yml
with:
ref: 5f5517021c173741e06a552dd81d6bd8a477713c
rpc_version: v0_9
secrets:
TEST_RPC_URL: ${{ secrets.RPC_URL }}
TEST_WS_RPC_URL: ${{ secrets.WS_RPC_URL }}
AUTH_TOKEN: ${{ secrets.AUTH_TOKEN }}
STARKNET_PRIVATE_KEY: ${{ secrets.TEST_ACCOUNT_PRIVATE_KEY_3 }}
STARKNET_PUBLIC_KEY: ${{ secrets.TEST_ACCOUNT_PUBLIC_KEY_3 }}
STARKNET_ACCOUNT_ADDRESS: ${{ secrets.TEST_ACCOUNT_ADDRESS_3 }}
rpc-performance:
needs: [deploy]
runs-on: ubuntu-latest
steps:
- name: Generate a token
id: generate-token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ vars.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
owner: ${{ github.repository_owner }}
repositories: "starknet-rpc-tests"
- name: Checkout the repo
uses: actions/checkout@v4
with:
repository: NethermindEth/starknet-rpc-tests
ref: "fix/load-tests"
token: ${{ steps.generate-token.outputs.token }}
path: starknet-rpc-tests
- name: Setup K6
uses: grafana/setup-k6-action@v1
- name: Run local k6 test
uses: grafana/run-k6-action@v1
env:
NODE_URL: "${{ secrets.RPC_URL }}?apikey=${{ secrets.AUTH_TOKEN }}"
NETWORK: "sepolia"
LOAD_FACTOR: 1
DURATION: "30s"
with:
path: ./starknet-rpc-tests/load-tests/test_cases.js