-
Notifications
You must be signed in to change notification settings - Fork 0
188 lines (158 loc) · 5.88 KB
/
zkml-pipeline.yml
File metadata and controls
188 lines (158 loc) · 5.88 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
name: ZKML Pipeline CI/CD
on:
push:
branches: [main, develop]
pull_request:
branches: [main]
env:
NODE_VERSION: "20"
jobs:
lint-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: "yarn"
- name: Install dependencies
run: yarn install
- name: Create test environment file
run: |
cat > .env << 'EOF'
VITE_CHAIN_ID="11155111"
VITE_RPC_URL="https://rpc.sepolia.org"
VITE_TOKEN_ADDR="0x1234567890123456789012345678901234567890"
VITE_CAMPAIGN="0x1234567890123456789012345678901234567890123456789012345678901234"
VITE_FLOOR_SCORE="600000"
VITE_CAP_SCORE="1000000"
VITE_MIN_PAYOUT="100"
VITE_MAX_PAYOUT="1000"
VITE_CURVE="SQRT"
VITE_WALLETCONNECT_PROJECT_ID="test-project-id"
VITE_AIRDROP_ECDSA_ADDR="0x1234567890123456789012345678901234567890"
VITE_DEBUG="true"
PUBLIC_CHAIN_ID="11155111"
PUBLIC_RPC_URL="https://rpc.sepolia.org"
PUBLIC_TOKEN_ADDR="0x1234567890123456789012345678901234567890"
PUBLIC_CAMPAIGN="0x1234567890123456789012345678901234567890123456789012345678901234"
PUBLIC_WALLETCONNECT_PROJECT_ID="test-project-id"
EOF
# - name: Format check
# run: yarn format && git diff --exit-code
# - name: Lint check
# run: yarn lint || echo "Linting issues found but not blocking"
# - name: Type check
# run: npx svelte-check --tsconfig ./tsconfig.json
# - name: Unit tests
# run: yarn test:unit || echo "Unit tests failed but not blocking"
- name: Build application
run: yarn build
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: build-artifacts
path: .svelte-kit/output/
e2e-tests:
runs-on: ubuntu-latest
needs: lint-and-test
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: "yarn"
- name: Install dependencies
run: yarn install
- name: Install Playwright
run: npx playwright install --with-deps
- name: Create test environment
run: |
cat > .env << 'EOF'
VITE_CHAIN_ID="11155111"
VITE_RPC_URL="https://rpc.sepolia.org"
VITE_TOKEN_ADDR="0x1234567890123456789012345678901234567890"
VITE_CAMPAIGN="0x1234567890123456789012345678901234567890123456789012345678901234"
VITE_FLOOR_SCORE="600000"
VITE_CAP_SCORE="1000000"
VITE_MIN_PAYOUT="100"
VITE_MAX_PAYOUT="1000"
VITE_CURVE="SQRT"
VITE_WALLETCONNECT_PROJECT_ID="test-project-id"
VITE_AIRDROP_ECDSA_ADDR="0x1234567890123456789012345678901234567890"
VITE_DEBUG="true"
PUBLIC_CHAIN_ID="11155111"
PUBLIC_RPC_URL="https://rpc.sepolia.org"
PUBLIC_TOKEN_ADDR="0x1234567890123456789012345678901234567890"
PUBLIC_CAMPAIGN="0x1234567890123456789012345678901234567890123456789012345678901234"
PUBLIC_WALLETCONNECT_PROJECT_ID="test-project-id"
EOF
- name: Build application
run: yarn build
# - name: Run E2E tests
# run: yarn test:e2e
# - name: Upload test results
# uses: actions/upload-artifact@v4
# if: always()
# with:
# name: e2e-test-results
# path: test-results/
deploy-staging:
runs-on: ubuntu-latest
needs: [lint-and-test, e2e-tests]
if: github.ref == 'refs/heads/develop'
environment: staging
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: "yarn"
- name: Install dependencies
run: yarn install
- name: Build for staging
run: yarn build
env:
VITE_CHAIN_ID: ${{ vars.STAGING_CHAIN_ID }}
VITE_RPC_URL: ${{ vars.STAGING_RPC_URL }}
VITE_TOKEN_ADDR: ${{ vars.STAGING_TOKEN_ADDR }}
VITE_AIRDROP_ECDSA_ADDR: ${{ vars.STAGING_AIRDROP_ECDSA_ADDR }}
VITE_AIRDROP_ZK_ADDR: ${{ vars.STAGING_AIRDROP_ZK_ADDR }}
VITE_ZKML_PROVER_ADDR: ${{ vars.STAGING_ZKML_PROVER_ADDR }}
VITE_WALLETCONNECT_PROJECT_ID: ${{ secrets.WALLETCONNECT_PROJECT_ID }}
- name: Deploy to staging
run: |
echo "🚀 Deploying to staging environment..."
# Add your deployment commands here
# e.g., deploy to Vercel, Netlify, or your hosting platform
deploy-production:
runs-on: ubuntu-latest
needs: [lint-and-test, e2e-tests]
if: github.ref == 'refs/heads/main'
environment: production
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: "yarn"
- name: Install dependencies
run: yarn install
- name: Build for production
run: yarn build
env:
VITE_CHAIN_ID: ${{ vars.PRODUCTION_CHAIN_ID }}
VITE_RPC_URL: ${{ vars.PRODUCTION_RPC_URL }}
VITE_TOKEN_ADDR: ${{ vars.PRODUCTION_TOKEN_ADDR }}
VITE_AIRDROP_ECDSA_ADDR: ${{ vars.PRODUCTION_AIRDROP_ECDSA_ADDR }}
VITE_AIRDROP_ZK_ADDR: ${{ vars.PRODUCTION_AIRDROP_ZK_ADDR }}
VITE_ZKML_PROVER_ADDR: ${{ vars.PRODUCTION_ZKML_PROVER_ADDR }}
VITE_WALLETCONNECT_PROJECT_ID: ${{ secrets.WALLETCONNECT_PROJECT_ID }}
- name: Deploy to production
run: |
echo "🚀 Deploying to production environment..."
# Add your production deployment commands here