Skip to content

Commit 53e4667

Browse files
authored
Add interface scripts (#17)
* [wip] Add interface crate * [wip] Add missing features * [wip] Add wasm * Add dev dependencies * Update rust renderer * Address review comments * Update lock file * Fix dependencies * Switch crates version * Remove serde feature * Add interface scripts * Enable CI on all branches * Add rust toolchain option * Fix clippy args * Refactor rust toolchain * Replace interface build for test * Fix step name * Fix test script call * Address review comments * Remove duplicate * Fix rustdoc tests * Fix lock file * Add missing dependency * Add missing feature dependency
1 parent 2593378 commit 53e4667

File tree

11 files changed

+349
-95
lines changed

11 files changed

+349
-95
lines changed

.github/actions/setup/action.yml

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,8 @@ inputs:
1010
cargo-cache-local-key:
1111
description: The key to cache local cargo dependencies. Skips local cargo caching if not provided.
1212
required: false
13-
clippy:
14-
description: Install Clippy if `true`. Defaults to `false`.
15-
required: false
16-
rustfmt:
17-
description: Install Rustfmt if `true`. Defaults to `false`.
13+
toolchain:
14+
description: Rust toolchain to install. Comma-separated string of [`build`, `format`, `lint`, `test`].
1815
required: false
1916
solana:
2017
description: Install Solana if `true`. Defaults to `false`.
@@ -40,20 +37,32 @@ runs:
4037
shell: bash
4138
run: pnpm zx ./scripts/ci/set-env.mjs
4239

43-
- name: Install Rustfmt
44-
if: ${{ inputs.rustfmt == 'true' }}
40+
- name: Install Rust 'build' Toolchain
41+
if: ${{ contains(inputs.toolchain, 'build') }}
42+
uses: dtolnay/rust-toolchain@master
43+
with:
44+
toolchain: ${{ env.TOOLCHAIN_BUILD }}
45+
46+
- name: Install Rust 'format' Toolchain
47+
if: ${{ contains(inputs.toolchain, 'format') }}
4548
uses: dtolnay/rust-toolchain@master
4649
with:
4750
toolchain: ${{ env.TOOLCHAIN_FORMAT }}
4851
components: rustfmt
4952

50-
- name: Install Clippy
51-
if: ${{ inputs.clippy == 'true' }}
53+
- name: Install Rust 'lint' Toolchain
54+
if: ${{ contains(inputs.toolchain, 'lint') }}
5255
uses: dtolnay/rust-toolchain@master
5356
with:
5457
toolchain: ${{ env.TOOLCHAIN_LINT }}
5558
components: clippy
5659

60+
- name: Install Rust 'test' Toolchain
61+
if: ${{ contains(inputs.toolchain, 'test') }}
62+
uses: dtolnay/rust-toolchain@master
63+
with:
64+
toolchain: ${{ env.TOOLCHAIN_TEST }}
65+
5766
- name: Install Solana
5867
if: ${{ inputs.solana == 'true' }}
5968
uses: solana-program/actions/install-solana@v1

.github/workflows/main.yml

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ on:
44
push:
55
branches: [main]
66
pull_request:
7-
branches: [main]
87

98
jobs:
109
format_and_lint_client_js:
@@ -33,15 +32,50 @@ jobs:
3332
- name: Setup Environment
3433
uses: ./.github/actions/setup
3534
with:
36-
clippy: true
37-
rustfmt: true
35+
toolchain: format, lint
3836

3937
- name: Format Client Rust
4038
run: pnpm clients:rust:format
4139

4240
- name: Lint Client Rust
4341
run: pnpm clients:rust:lint
4442

43+
format_and_lint_interface:
44+
name: Format & Lint Interface
45+
runs-on: ubuntu-latest
46+
steps:
47+
- name: Git Checkout
48+
uses: actions/checkout@v4
49+
50+
- name: Setup Environment
51+
uses: ./.github/actions/setup
52+
with:
53+
toolchain: format, lint
54+
55+
- name: Format Interface
56+
run: pnpm interface:format
57+
58+
- name: Lint Interface
59+
run: pnpm interface:lint
60+
61+
test_interface:
62+
name: Test Interface
63+
runs-on: ubuntu-latest
64+
needs: format_and_lint_interface
65+
steps:
66+
- name: Git Checkout
67+
uses: actions/checkout@v4
68+
69+
- name: Setup Environment
70+
uses: ./.github/actions/setup
71+
with:
72+
toolchain: test
73+
cargo-cache-key: cargo-interface
74+
solana: true
75+
76+
- name: Test Interface
77+
run: pnpm interface:test
78+
4579
generate_clients:
4680
name: Check Client Generation
4781
runs-on: ubuntu-latest
@@ -52,7 +86,7 @@ jobs:
5286
- name: Setup Environment
5387
uses: ./.github/actions/setup
5488
with:
55-
rustfmt: true
89+
toolchain: format
5690

5791
- name: Generate Clients
5892
run: pnpm generate:clients

0 commit comments

Comments
 (0)