|
| 1 | +on: |
| 2 | + push: |
| 3 | + branches: |
| 4 | + - main |
| 5 | + pull_request: |
| 6 | + branches: |
| 7 | + - "*" |
| 8 | + types: |
| 9 | + - opened |
| 10 | + - synchronize |
| 11 | + - reopened |
| 12 | + - ready_for_review |
| 13 | + |
| 14 | +name: js-token-interface-v2 |
| 15 | + |
| 16 | +permissions: |
| 17 | + contents: read |
| 18 | + |
| 19 | +concurrency: |
| 20 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 21 | + cancel-in-progress: true |
| 22 | + |
| 23 | +jobs: |
| 24 | + token-interface-js-v2: |
| 25 | + name: token-interface-js-v2 |
| 26 | + if: github.event.pull_request.draft == false |
| 27 | + runs-on: ubuntu-latest |
| 28 | + |
| 29 | + services: |
| 30 | + redis: |
| 31 | + image: redis:8.0.1 |
| 32 | + ports: |
| 33 | + - 6379:6379 |
| 34 | + options: >- |
| 35 | + --health-cmd "redis-cli ping" |
| 36 | + --health-interval 10s |
| 37 | + --health-timeout 5s |
| 38 | + --health-retries 5 |
| 39 | +
|
| 40 | + env: |
| 41 | + LIGHT_PROTOCOL_VERSION: V2 |
| 42 | + REDIS_URL: redis://localhost:6379 |
| 43 | + CI: true |
| 44 | + |
| 45 | + steps: |
| 46 | + - name: Checkout sources |
| 47 | + uses: actions/checkout@v6 |
| 48 | + with: |
| 49 | + submodules: true |
| 50 | + |
| 51 | + - name: Setup and build |
| 52 | + uses: ./.github/actions/setup-and-build |
| 53 | + with: |
| 54 | + skip-components: "redis,disk-cleanup,go" |
| 55 | + cache-key: "js" |
| 56 | + |
| 57 | + - name: Build token-interface with V2 |
| 58 | + run: | |
| 59 | + cd js/token-interface |
| 60 | + pnpm build:v2 |
| 61 | +
|
| 62 | + - name: Build CLI |
| 63 | + run: | |
| 64 | + just cli build |
| 65 | +
|
| 66 | + - name: Run token-interface unit tests with V2 |
| 67 | + run: | |
| 68 | + echo "Running token-interface unit tests with retry logic (max 2 attempts)..." |
| 69 | + attempt=1 |
| 70 | + max_attempts=2 |
| 71 | + until just js test-token-interface-unit-v2; do |
| 72 | + attempt=$((attempt + 1)) |
| 73 | + if [ $attempt -gt $max_attempts ]; then |
| 74 | + echo "Tests failed after $max_attempts attempts" |
| 75 | + exit 1 |
| 76 | + fi |
| 77 | + echo "Attempt $attempt/$max_attempts failed, retrying..." |
| 78 | + sleep 5 |
| 79 | + done |
| 80 | + echo "Tests passed on attempt $attempt" |
| 81 | +
|
| 82 | + - name: Run token-interface e2e tests with V2 |
| 83 | + run: | |
| 84 | + echo "Running token-interface e2e tests with retry logic (max 2 attempts)..." |
| 85 | + attempt=1 |
| 86 | + max_attempts=2 |
| 87 | + until just js test-token-interface-e2e-v2; do |
| 88 | + attempt=$((attempt + 1)) |
| 89 | + if [ $attempt -gt $max_attempts ]; then |
| 90 | + echo "Tests failed after $max_attempts attempts" |
| 91 | + exit 1 |
| 92 | + fi |
| 93 | + echo "Attempt $attempt/$max_attempts failed, retrying..." |
| 94 | + sleep 5 |
| 95 | + done |
| 96 | + echo "Tests passed on attempt $attempt" |
| 97 | +
|
| 98 | + - name: Display prover logs on failure |
| 99 | + if: failure() |
| 100 | + run: | |
| 101 | + echo "=== Displaying prover logs ===" |
| 102 | + find . -path "*/test-ledger/*prover*.log" -type f -exec echo "=== Contents of {} ===" \; -exec cat {} \; -exec echo "=== End of {} ===" \; || echo "No prover logs found" |
0 commit comments