Implement e2e flow #119
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |