|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main] |
| 6 | + pull_request: |
| 7 | + branches: [main] |
| 8 | + |
| 9 | +jobs: |
| 10 | + test: |
| 11 | + name: Build & Test |
| 12 | + runs-on: ubuntu-latest |
| 13 | + steps: |
| 14 | + - uses: actions/checkout@v7 |
| 15 | + |
| 16 | + - uses: pnpm/action-setup@v6 |
| 17 | + with: |
| 18 | + version: 11.24.0 |
| 19 | + |
| 20 | + - uses: actions/setup-node@v7 |
| 21 | + with: |
| 22 | + node-version: 22 |
| 23 | + cache: pnpm |
| 24 | + |
| 25 | + - name: Install dependencies |
| 26 | + run: pnpm install --frozen-lockfile |
| 27 | + |
| 28 | + # The viewer is a separate project with its own lockfile. Typecheck it |
| 29 | + # explicitly: `vite build` does not, so a type error here would |
| 30 | + # otherwise ship in the bundle every release embeds. |
| 31 | + - name: Install viewer dependencies |
| 32 | + run: pnpm --dir viewer install --frozen-lockfile |
| 33 | + |
| 34 | + - name: Typecheck viewer |
| 35 | + run: pnpm --dir viewer run typecheck |
| 36 | + |
| 37 | + - name: Build CLI and viewer |
| 38 | + run: pnpm build |
| 39 | + |
| 40 | + - name: Run tests |
| 41 | + run: pnpm vitest run |
| 42 | + |
| 43 | + template-smoke: |
| 44 | + name: Scaffolded template runs |
| 45 | + runs-on: ubuntu-latest |
| 46 | + steps: |
| 47 | + - uses: actions/checkout@v7 |
| 48 | + |
| 49 | + - uses: pnpm/action-setup@v6 |
| 50 | + with: |
| 51 | + version: 11.24.0 |
| 52 | + |
| 53 | + - uses: actions/setup-node@v7 |
| 54 | + with: |
| 55 | + node-version: 22 |
| 56 | + cache: pnpm |
| 57 | + |
| 58 | + - name: Install dependencies |
| 59 | + run: | |
| 60 | + pnpm install --frozen-lockfile |
| 61 | + pnpm --dir viewer install --frozen-lockfile |
| 62 | +
|
| 63 | + - name: Build CLI and viewer |
| 64 | + run: pnpm build |
| 65 | + |
| 66 | + # The producer image is the CLI plus rindexer, which ships linux/amd64 |
| 67 | + # only. Every step below is what a user does from the template README; |
| 68 | + # each of them was broken at some point and none was covered by a test. |
| 69 | + - name: Build the producer image |
| 70 | + run: | |
| 71 | + docker build --platform linux/amd64 -t chainplot:local \ |
| 72 | + -f docker/producer.Dockerfile . |
| 73 | +
|
| 74 | + - name: Scaffold the template |
| 75 | + run: | |
| 76 | + node dist/cli/main.js init --template ingest-transfers \ |
| 77 | + --output "$RUNNER_TEMP/proj" --json |
| 78 | +
|
| 79 | + # No RPC is needed to prove the stack comes up and the CLI is reachable. |
| 80 | + - name: Bring the stack up and drive the CLI |
| 81 | + working-directory: ${{ runner.temp }}/proj |
| 82 | + run: | |
| 83 | + printf 'RPC_URL=http://127.0.0.1:1\n' > .env |
| 84 | + docker compose up -d |
| 85 | + docker compose ps |
| 86 | + docker compose exec -T producer chainplot capabilities --json |
| 87 | + docker compose exec -T producer chainplot validate --json |
| 88 | +
|
| 89 | + - name: Tear down |
| 90 | + if: always() |
| 91 | + working-directory: ${{ runner.temp }}/proj |
| 92 | + run: docker compose down -v |
0 commit comments