Skip to content

Commit 678c2ef

Browse files
Template checks (#52)
* Added github action to test templates that are getting added/updated * Update templates to latest sdk to pass new template check * Added specific setup-go hash for action * Added bun to the template check action * Added concurrency check and switched to bun instead of npm * Switched to using major tags * Updated action versions * Make template checks a required github action
1 parent 1351a11 commit 678c2ef

41 files changed

Lines changed: 746 additions & 83 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: Template Check
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened]
6+
7+
concurrency:
8+
group: template-compat-${{ github.head_ref || github.ref }}
9+
cancel-in-progress: true
10+
11+
# Blocking merge gate for templates changed in the PR.
12+
#
13+
# Checks performed per template:
14+
# TypeScript: YAML validation, bun install, typecheck, cre-compile to WASM
15+
# Go: YAML validation, go mod verify, go vet, go build (GOOS=wasip1 GOARCH=wasm)
16+
#
17+
# The SDK version used is captured from the installed package (TS) or go.mod (Go)
18+
# and printed in the Actions log when a check fails.
19+
20+
permissions:
21+
contents: read
22+
23+
jobs:
24+
template-check:
25+
runs-on: ubuntu-latest
26+
27+
defaults:
28+
run:
29+
shell: bash {0}
30+
31+
steps:
32+
- name: Checkout
33+
uses: actions/checkout@v6
34+
with:
35+
fetch-depth: 0 # full history needed for git diff against base branch
36+
37+
# Go is required for Go template builds (GOOS=wasip1 GOARCH=wasm).
38+
# GOTOOLCHAIN=auto lets Go download the exact toolchain declared in go.mod
39+
# (e.g. "toolchain go1.24.10") if it differs from the installed version.
40+
- name: Setup Go
41+
uses: actions/setup-go@v5
42+
with:
43+
go-version: 'stable'
44+
cache: false # cache managed explicitly below
45+
env:
46+
GOTOOLCHAIN: auto
47+
48+
# Node + npm are required for TypeScript template checks.
49+
- name: Setup Node
50+
uses: actions/setup-node@v6
51+
with:
52+
node-version: '24'
53+
54+
# cre-compile is shipped with a bun shebang; npx invokes it as /usr/bin/env bun.
55+
# Match local dev machines where Bun is installed alongside Node.
56+
- name: Setup Bun
57+
uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
58+
59+
# Cache Go module downloads. Keyed on all go.sum files so any new module
60+
# version busts the cache while unchanged templates stay fast.
61+
- name: Cache Go modules
62+
uses: actions/cache@v5
63+
with:
64+
path: |
65+
~/go/pkg/mod
66+
~/.cache/go-build
67+
key: ${{ runner.os }}-go-templates-${{ hashFiles('**/go.sum') }}
68+
restore-keys: ${{ runner.os }}-go-templates-
69+
70+
# Cache npm package downloads. Multiple templates sharing the same
71+
# @chainlink/cre-sdk version (e.g. ^1.5.0) will hit the cache after
72+
# the first install, avoiding repeated network downloads.
73+
- name: Cache npm
74+
uses: actions/cache@v5
75+
with:
76+
path: ~/.npm
77+
key: ${{ runner.os }}-npm-templates-${{ hashFiles('**/package.json') }}
78+
restore-keys: ${{ runner.os }}-npm-templates-
79+
80+
- name: Run template checks
81+
env:
82+
BASE_REF: ${{ github.base_ref }}
83+
RESULTS_FILE: /tmp/template-results.json
84+
GOTOOLCHAIN: auto
85+
run: ./scripts/check-templates.sh

building-blocks/indexer-block-trigger/block-trigger-ts/workflow/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
},
99
"license": "UNLICENSED",
1010
"dependencies": {
11-
"@chainlink/cre-sdk": "^1.5.0"
11+
"@chainlink/cre-sdk": "^1.6.0"
1212
},
1313
"devDependencies": {
1414
"typescript": "5.9.3"

building-blocks/indexer-data-fetch/indexer-fetch-ts/workflow/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
},
99
"license": "UNLICENSED",
1010
"dependencies": {
11-
"@chainlink/cre-sdk": "^1.5.0"
11+
"@chainlink/cre-sdk": "^1.6.0"
1212
},
1313
"devDependencies": {
1414
"typescript": "5.9.3"

building-blocks/kv-store/kv-store-ts/my-workflow/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
},
99
"license": "UNLICENSED",
1010
"dependencies": {
11-
"@chainlink/cre-sdk": "^1.5.0",
11+
"@chainlink/cre-sdk": "^1.6.0",
1212
"@noble/hashes": "^1.7.2"
1313
},
1414
"devDependencies": {

building-blocks/read-data-feeds/read-data-feeds-ts/my-workflow/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
},
99
"license": "UNLICENSED",
1010
"dependencies": {
11-
"@chainlink/cre-sdk": "^1.5.0",
11+
"@chainlink/cre-sdk": "^1.6.0",
1212
"viem": "2.34.0",
1313
"zod": "3.25.76"
1414
},

building-blocks/read-data-feeds/read-mvr-data-feeds-go/go.sum

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -173,14 +173,14 @@ github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible h1
173173
github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA=
174174
github.com/shopspring/decimal v1.4.0 h1:bxl37RwXBklmTi0C79JfXCEBD1cqqHt0bbgBAGFp81k=
175175
github.com/shopspring/decimal v1.4.0/go.mod h1:gawqmDU56v4yIKSwfBSFip1HdCCXN8/+DMd9qYNcwME=
176-
github.com/smartcontractkit/chainlink-protos/cre/go v0.0.0-20250918131840-564fe2776a35 h1:hhKdzgNZT+TnohlmJODtaxlSk+jyEO79YNe8zLFtp78=
177-
github.com/smartcontractkit/chainlink-protos/cre/go v0.0.0-20250918131840-564fe2776a35/go.mod h1:jUC52kZzEnWF9tddHh85zolKybmLpbQ1oNA4FjOHt1Q=
178-
github.com/smartcontractkit/cre-sdk-go v1.0.0 h1:O52/QDmw/W8SJ7HQ9ASlVx7alSMGsewjL0Y8WZmgf5w=
179-
github.com/smartcontractkit/cre-sdk-go v1.0.0/go.mod h1:CQY8hCISjctPmt8ViDVgFm4vMGLs5fYI198QhkBS++Y=
180-
github.com/smartcontractkit/cre-sdk-go/capabilities/blockchain/evm v1.0.0-beta.0 h1:t2bzRHnqkyxvcrJKSsKPmCGLMjGO97ESgrtLCnTIEQw=
181-
github.com/smartcontractkit/cre-sdk-go/capabilities/blockchain/evm v1.0.0-beta.0/go.mod h1:VVJ4mvA7wOU1Ic5b/vTaBMHEUysyxd0gdPPXkAu8CmY=
182-
github.com/smartcontractkit/cre-sdk-go/capabilities/scheduler/cron v1.0.0-beta.0 h1:Tui4xQVln7Qtk3CgjBRgDfihgEaAJy2t2MofghiGIDA=
183-
github.com/smartcontractkit/cre-sdk-go/capabilities/scheduler/cron v1.0.0-beta.0/go.mod h1:PWyrIw16It4TSyq6mDXqmSR0jF2evZRKuBxu7pK1yDw=
176+
github.com/smartcontractkit/chainlink-protos/cre/go v0.0.0-20251103211352-4c2e6505f4d6 h1:Zmwr/k+7JM/3FRf4AcK9SqLdQ+ZmIRt3LBALa+T1Igg=
177+
github.com/smartcontractkit/chainlink-protos/cre/go v0.0.0-20251103211352-4c2e6505f4d6/go.mod h1:jUC52kZzEnWF9tddHh85zolKybmLpbQ1oNA4FjOHt1Q=
178+
github.com/smartcontractkit/cre-sdk-go v1.0.1-0.20251103212936-f87c1b6768b7 h1:sKGjw83NUOSyVOvYUTNdbUzd35CuIS0hDsmNb4CPrg4=
179+
github.com/smartcontractkit/cre-sdk-go v1.0.1-0.20251103212936-f87c1b6768b7/go.mod h1:CQY8hCISjctPmt8ViDVgFm4vMGLs5fYI198QhkBS++Y=
180+
github.com/smartcontractkit/cre-sdk-go/capabilities/blockchain/evm v1.0.0-beta.0.0.20251103212936-f87c1b6768b7 h1:riXijgLlYw3hu7YGMAuf6o1G1MYyLhqENoYqEz79HTU=
181+
github.com/smartcontractkit/cre-sdk-go/capabilities/blockchain/evm v1.0.0-beta.0.0.20251103212936-f87c1b6768b7/go.mod h1:mbkNee1UMkB13Dab+EMwlkPbYY2Qwj5+SaOtYWagY8s=
182+
github.com/smartcontractkit/cre-sdk-go/capabilities/scheduler/cron v1.0.0-beta.0.0.20251103212936-f87c1b6768b7 h1:mNArf+I7g6h9WLH+j65w6epY3CygfJy13HOoVRS42KQ=
183+
github.com/smartcontractkit/cre-sdk-go/capabilities/scheduler/cron v1.0.0-beta.0.0.20251103212936-f87c1b6768b7/go.mod h1:PWyrIw16It4TSyq6mDXqmSR0jF2evZRKuBxu7pK1yDw=
184184
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
185185
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
186186
github.com/supranational/blst v0.3.16-0.20250831170142-f48500c1fdbe h1:nbdqkIGOGfUAD54q1s2YBcBz/WcsxCO9HUQ4aGV5hUw=

building-blocks/read-data-feeds/read-mvr-data-feeds-ts/contracts/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"private": true,
55
"type": "module",
66
"dependencies": {
7-
"@chainlink/cre-sdk": "^1.5.0",
7+
"@chainlink/cre-sdk": "^1.6.0",
88
"viem": "2.34.0"
99
}
1010
}

building-blocks/read-data-feeds/read-mvr-data-feeds-ts/my-workflow/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
},
99
"license": "UNLICENSED",
1010
"dependencies": {
11-
"@chainlink/cre-sdk": "^1.5.0",
11+
"@chainlink/cre-sdk": "^1.6.0",
1212
"viem": "2.34.0",
1313
"zod": "3.25.76"
1414
},

0 commit comments

Comments
 (0)