-
Notifications
You must be signed in to change notification settings - Fork 6
149 lines (125 loc) · 5.29 KB
/
ci.yml
File metadata and controls
149 lines (125 loc) · 5.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
name: CI
permissions:
contents: read
on:
pull_request:
types: [opened, synchronize, reopened]
push:
branches: [main]
jobs:
lint-format:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
submodules: recursive
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Bun
uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
with:
bun-version: 1.3.12
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Check formatting & linting
run: |
if ! bun turbo run check:ci; then
echo ""
echo "=========================================="
echo "Formatting or linting issues detected!"
echo "Did you forget to run 'bun full-checks' (or 'bun check') before pushing?"
echo "=========================================="
exit 1
fi
full-checks:
needs: lint-format
runs-on: ubuntu-latest
defaults:
run:
shell: zsh {0}
steps:
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
submodules: recursive
token: ${{ secrets.GITHUB_TOKEN }}
- name: Install zsh
run: |
sudo apt-get update
sudo apt-get install -y zsh
# Add it to /etc/shells if missing
if ! grep -q "^$(which zsh)$" /etc/shells; then
echo "$(which zsh)" | sudo tee -a /etc/shells
fi
# Change the default shell for the current user
sudo chsh -s "$(which zsh)" $USER
# Use bash or sh for this step, because zsh isn't set yet
shell: bash {0}
# Match packages/cre-sdk-javy-plugin/src/javy_chainlink_sdk/rust-toolchain.toml (host cargo build step).
- name: Setup Rust (1.85.0) with wasm target
uses: actions-rust-lang/setup-rust-toolchain@150fca883cd4034361b621bd4e6a9d34e5143606 # v1.15.4
with:
toolchain: 1.85.0
target: wasm32-wasip1
override: true
- name: Setup Bun
uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
with:
bun-version: 1.3.12
- name: Cache Bun dependencies
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
with:
path: ~/.bun/install/cache
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lock') }}
# Host cargo (compile-javy-sdk-plugin) + optional local plugin path; Docker build uses its own layers.
- name: Cache cargo + Javy release binary cache
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
with:
path: |
~/.cargo/registry
~/.cargo/git
~/.cache/javy
key: ${{ runner.os }}-cre-plugin-v8.1.0-${{ hashFiles('packages/cre-sdk-javy-plugin/src/javy_chainlink_sdk/Cargo.lock', 'packages/cre-sdk-javy-plugin/src/cre_generated_host.Cargo.lock', 'packages/cre-sdk-javy-plugin/src/javy_chainlink_sdk/rust-toolchain.toml', 'packages/cre-sdk-javy-plugin/scripts/build-plugin-local.sh', 'packages/cre-sdk-javy-plugin/scripts/print-javy-path-for-build.ts', 'packages/cre-sdk-javy-plugin/scripts/ensure-javy.ts', 'packages/cre-sdk-javy-plugin/Dockerfile') }}
- name: Install dependencies
run: bun install --frozen-lockfile
# build:plugin-wasm uses Docker (same as default locally) so committed dist/*.wasm matches CI.
# SKIP_DOCKER_IMAGE=1 is for machines without Docker only; it produces different bytes than the image.
- name: Full checks
run: bun full-checks
- name: Verify no uncommitted changes
run: |
if ! git diff --exit-code; then
echo ""
echo "=========================================="
echo "Uncommitted file changes detected after full-checks!"
echo "Run 'bun full-checks' locally and commit the resulting changes."
echo "=========================================="
exit 1
fi
shell: bash {0}
- name: Install CRE CLI
run: |
chmod +x scripts/setup-cre-cli.sh
sudo scripts/setup-cre-cli.sh
- name: Verify CRE CLI installation
run: cre version
- name: E2E - Simulate hello-world workflow
env:
CRE_API_KEY: ${{ secrets.CRE_CLI_API_KEY }}
run: ./scripts/e2e/simulate-hello-world.sh
# Disabled: depends on external swapi.info which causes consensus
# aggregator failures. Re-enable once we set up an HTTP service we
# control for this workflow.
# - name: E2E - Simulate star-wars workflow
# env:
# CRE_API_KEY: ${{ secrets.CRE_CLI_API_KEY }}
# run: ./scripts/e2e/simulate-star-wars.sh
- name: E2E - Simulate log-trigger workflow
env:
CRE_API_KEY: ${{ secrets.CRE_CLI_API_KEY }}
run: ./scripts/e2e/simulate-log-trigger.sh
# Rust extension examples: build cre-rust-inject-alpha, compile workflows, simulate.
- name: E2E - Simulate rust-inject workflows
env:
CRE_API_KEY: ${{ secrets.CRE_CLI_API_KEY }}
run: ./scripts/e2e/simulate-rust-inject.sh