Allow easier customization of rust plugins #429
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 | |
| 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 |