Added template tests#249
Conversation
4a72034 to
a9dce82
Compare
47a936d to
9bbbc7c
Compare
| @@ -0,0 +1,324 @@ | |||
| #!/bin/bash | |||
There was a problem hiding this comment.
nit since it's a typescript repo maybe making it in a TS test would be higher-level more readable and integrated with other tests for devs to run (and do not forget), but for CI I guess bash is fine too 👍
|
I like the idea. nit comment, but non-blocking |
ernest-nowacki
left a comment
There was a problem hiding this comment.
Love it and love this addon:
As a way for making sure templates also include all they need to have full TS checks ready.
Locally I got some errors (example: [7/33] tokenized-asset-servicing/asset-log-trigger-workflow) but those might be legitimate templates improvements we need. Entire process works great locally! (used: [7/33] tokenized-asset-servicing/asset-log-trigger-workflow).
Leaving some small feedback below.
| on: | ||
| pull_request: | ||
| types: [opened, synchronize, reopened] | ||
|
|
There was a problem hiding this comment.
I would also add
concurrency:
group: template-compat-${{ github.head_ref || github.ref }}
cancel-in-progress: true
As template testing could take some time and upon multiple commits we would have improved efficiency.
| - name: Post or remove PR comment | ||
| uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 | ||
| with: | ||
| script: | |
There was a problem hiding this comment.
I feel it would be cleaner and easier to maintain if we put script in file together with other scripts we had and just call it here in 1-2 lines.
| info "Packing SDK..." | ||
|
|
||
| cd packages/cre-sdk-javy-plugin | ||
| JAVY_TARBALL=$(npm pack --quiet 2>/dev/null) |
There was a problem hiding this comment.
For tarballs I wonder if we could stick with bun as we already use it everywhere except publish stage. Can you try bun pm pack and see if it would work?
Non blocking - if it's causes trouble we can keep npm - if not, then lets keep using bun whenever we can.
| cp package.json package.json.bak | ||
| npm pkg set dependencies."@chainlink/cre-sdk-javy-plugin"="file:$JAVY_TARBALL_PATH" | ||
|
|
||
| TARBALL=$(npm pack --quiet 2>/dev/null) |
| - name: Checkout cre-templates (${{ steps.detect-ref.outputs.ref }}) | ||
| uses: actions/checkout@v6 | ||
| with: | ||
| repository: ${{ env.TEMPLATES_REPO }} | ||
| ref: ${{ steps.detect-ref.outputs.ref }} | ||
| path: cre-templates | ||
| token: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| - name: Setup Node (for npm) |
…pescript into template_tests
861d92b to
a001633
Compare
Adds cross-repo testing to catch SDK changes that break TypeScript templates in cre-templates before they reach developers.
bun run test:templatesBuilds and packs the local SDK, then runs typecheck and WASM compilation against every TypeScript template in cre-templates. Defaults to ../cre-templates — override with TEMPLATES_DIR=/path/to/cre-templates.
Runs on every PR. Non-blocking by design, supports a compat/ branch convention in cre-templates for coordinated breaking changes: create the branch with template fixes applied, and the action will automatically test against it instead of main.
Posts a PR comment listing failed templates and their errors when something breaks, and removes it automatically when the PR is fixed.