Bind general TypeScript (functions + classes), not just React #42
Workflow file for this run
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: CI | |
| on: | |
| push: | |
| branches: [main, master] | |
| pull_request: | |
| branches: [main, master] | |
| concurrency: | |
| group: ci-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| test: | |
| name: Test (smoke + golden snapshot) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: npm | |
| - name: Install dependencies | |
| run: npm ci | |
| # Smoke test + golden snapshot diff (generated output vs committed goldens). | |
| # Deterministic and offline — blocking. See docs/TYPE_MAPPING.md. | |
| - name: Smoke + golden snapshot | |
| run: npm test | |
| # Publish an ephemeral pkg.pr.new preview of the tool ITSELF on every PR / push to main, so | |
| # the exact build can be `npm i`-ed and tested in another project without cutting a release. | |
| # Requires the pkg-pr-new GitHub App (https://github.com/apps/pkg-pr-new) installed on the repo. | |
| preview: | |
| name: Publish preview to pkg.pr.new | |
| runs-on: ubuntu-latest | |
| needs: test # only publish a preview once the smoke + golden tests pass | |
| if: github.event_name == 'pull_request' || (github.event_name == 'push' && github.ref == 'refs/heads/main') | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: npm | |
| - run: npm ci | |
| # Packs the package per its `files` allowlist, publishes a commit-SHA-pinned build, and posts | |
| # a sticky PR comment: npm i https://pkg.pr.new/@juspay/rescript-bindgen@<sha> | |
| - name: Publish preview | |
| run: npx pkg-pr-new publish | |
| # Compile every golden fixture's output on ReScript 12 — proves the bindings are | |
| # valid, not just shape-matched. Deterministic and offline — blocking. | |
| compile: | |
| name: Golden compile (ReScript 12) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: npm | |
| - run: npm ci | |
| - name: Install ReScript sandbox deps | |
| run: npm --prefix test/sandbox ci || npm --prefix test/sandbox install | |
| - name: Compile goldens | |
| run: npm run test:compile | |
| # Integration: generate bindings for the latest published blend and compile them. | |
| # Informational — depends on npm + the published package, so it must not block CI. | |
| integration: | |
| name: Generate + compile (blend latest) | |
| runs-on: ubuntu-latest | |
| continue-on-error: true | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: npm | |
| - run: npm ci | |
| - name: Install ReScript sandbox deps | |
| run: npm --prefix test/sandbox ci || npm --prefix test/sandbox install | |
| - name: Generate blend bindings | |
| run: npm run gen -- --pkg @juspay/blend-design-system@latest --out test/sandbox/src --from "@juspay/blend-design-system" --webapi --yes | |
| - name: Compile-check generated bindings | |
| run: | | |
| printf 'module File = {\n type t\n}\nmodule FileList = {\n type t\n}\nmodule FormData = {\n type t\n}\n' > test/sandbox/src/Webapi.res | |
| npx --prefix test/sandbox rescript build || (cd test/sandbox && npx rescript build) |