forked from Junirezz/YieldVault-RWA
-
Notifications
You must be signed in to change notification settings - Fork 0
136 lines (123 loc) · 4.3 KB
/
Copy pathintegration-smoke.yml
File metadata and controls
136 lines (123 loc) · 4.3 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
name: Phase 3 Cross-Stack Smoke Test
# Verifies frontend share-price logic and backend vault endpoints against
# deployment metadata produced by the rust-wasm testnet deploy job.
#
# Secrets (repository settings → Secrets and variables → Actions):
# TESTNET_SECRET_KEY — required only for deploy mode in rust-wasm.yml
# TESTNET_TOKEN_ADDRESS — required only for deploy mode in rust-wasm.yml
#
# Artifacts:
# After a successful main-branch deploy, download the `testnet-deployment`
# artifact from the Rust + WASM CI workflow. It contains `deployment.json`
# with `contract_id` and `git_sha`.
on:
pull_request:
paths:
- ".github/workflows/integration-smoke.yml"
- "contracts/vault/scripts/smoke-test.sh"
- "frontend/src/lib/vaultApi.ts"
- "frontend/src/lib/vaultApi.test.ts"
workflow_dispatch:
inputs:
deployment_artifact:
description: "GitHub artifact name containing deployment.json"
required: false
default: "testnet-deployment"
backend_url:
description: "Backend base URL for smoke probes"
required: false
default: "http://localhost:3000"
workflow_run:
workflows:
- Rust + WASM CI
types:
- completed
branches:
- main
jobs:
integration-smoke:
name: Cross-stack testnet smoke test
runs-on: ubuntu-latest
if: >-
github.event_name == 'pull_request' ||
github.event_name == 'workflow_dispatch' ||
(github.event_name == 'workflow_run' &&
github.event.workflow_run.conclusion == 'success')
env:
BACKEND_URL: ${{ github.event.inputs.backend_url || 'http://localhost:3000' }}
DEPLOYMENT_ARTIFACT: ${{ github.event.inputs.deployment_artifact || 'testnet-deployment' }}
SMOKE_TEST_MODE: cross-stack
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download deployment artifact
if: github.event_name == 'workflow_run'
uses: actions/download-artifact@v4
with:
name: ${{ env.DEPLOYMENT_ARTIFACT }}
path: .
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ github.event.workflow_run.id }}
- name: Prepare deployment metadata
run: |
if [[ ! -f deployment.json && -f deployments/contracts.testnet.json ]]; then
cp deployments/contracts.testnet.json deployment.json
fi
if [[ ! -f deployment.json ]]; then
echo '{"contract_id":"","git_sha":""}' > deployment.json
fi
- name: Setup Node (frontend)
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
cache-dependency-path: frontend/package-lock.json
- name: Install frontend dependencies
working-directory: frontend
run: npm ci
- name: Setup Node (backend)
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
cache-dependency-path: backend/package-lock.json
- name: Install backend dependencies
working-directory: backend
run: npm ci
- name: Prepare backend database
working-directory: backend
run: npx prisma generate
- name: Start backend for smoke probes
working-directory: backend
run: |
npm run build
npm run start &
for i in $(seq 1 60); do
if curl -fsS "$BACKEND_URL/health" >/dev/null 2>&1; then
echo "Backend is ready"
exit 0
fi
sleep 2
done
echo "Backend failed to start"
curl -v "$BACKEND_URL/health" || true
exit 1
env:
PORT: 3000
NODE_ENV: development
OTEL_ENABLED: "false"
ALLOWLIST_ENABLED: "false"
STELLAR_RPC_URL: https://soroban-testnet.stellar.org
ADMIN_AUDIT_LOG_STORAGE: memory
- name: Run cross-stack smoke test
run: bash contracts/vault/scripts/smoke-test.sh
env:
DEPLOYMENT_FILE: deployment.json
BACKEND_URL: ${{ env.BACKEND_URL }}
- name: Upload deployment snapshot
if: always() && hashFiles('deployment.json')
uses: actions/upload-artifact@v4
with:
name: smoke-test-deployment-snapshot
path: deployment.json
retention-days: 14