Skip to content

Commit

Permalink
Add interface scripts (#17)
Browse files Browse the repository at this point in the history
* [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
  • Loading branch information
febo authored Nov 11, 2024
1 parent 2593378 commit 53e4667
Show file tree
Hide file tree
Showing 11 changed files with 349 additions and 95 deletions.
27 changes: 18 additions & 9 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,8 @@ inputs:
cargo-cache-local-key:
description: The key to cache local cargo dependencies. Skips local cargo caching if not provided.
required: false
clippy:
description: Install Clippy if `true`. Defaults to `false`.
required: false
rustfmt:
description: Install Rustfmt if `true`. Defaults to `false`.
toolchain:
description: Rust toolchain to install. Comma-separated string of [`build`, `format`, `lint`, `test`].
required: false
solana:
description: Install Solana if `true`. Defaults to `false`.
Expand All @@ -40,20 +37,32 @@ runs:
shell: bash
run: pnpm zx ./scripts/ci/set-env.mjs

- name: Install Rustfmt
if: ${{ inputs.rustfmt == 'true' }}
- name: Install Rust 'build' Toolchain
if: ${{ contains(inputs.toolchain, 'build') }}
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.TOOLCHAIN_BUILD }}

- name: Install Rust 'format' Toolchain
if: ${{ contains(inputs.toolchain, 'format') }}
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.TOOLCHAIN_FORMAT }}
components: rustfmt

- name: Install Clippy
if: ${{ inputs.clippy == 'true' }}
- name: Install Rust 'lint' Toolchain
if: ${{ contains(inputs.toolchain, 'lint') }}
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.TOOLCHAIN_LINT }}
components: clippy

- name: Install Rust 'test' Toolchain
if: ${{ contains(inputs.toolchain, 'test') }}
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.TOOLCHAIN_TEST }}

- name: Install Solana
if: ${{ inputs.solana == 'true' }}
uses: solana-program/actions/install-solana@v1
Expand Down
42 changes: 38 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
format_and_lint_client_js:
Expand Down Expand Up @@ -33,15 +32,50 @@ jobs:
- name: Setup Environment
uses: ./.github/actions/setup
with:
clippy: true
rustfmt: true
toolchain: format, lint

- name: Format Client Rust
run: pnpm clients:rust:format

- name: Lint Client Rust
run: pnpm clients:rust:lint

format_and_lint_interface:
name: Format & Lint Interface
runs-on: ubuntu-latest
steps:
- name: Git Checkout
uses: actions/checkout@v4

- name: Setup Environment
uses: ./.github/actions/setup
with:
toolchain: format, lint

- name: Format Interface
run: pnpm interface:format

- name: Lint Interface
run: pnpm interface:lint

test_interface:
name: Test Interface
runs-on: ubuntu-latest
needs: format_and_lint_interface
steps:
- name: Git Checkout
uses: actions/checkout@v4

- name: Setup Environment
uses: ./.github/actions/setup
with:
toolchain: test
cargo-cache-key: cargo-interface
solana: true

- name: Test Interface
run: pnpm interface:test

generate_clients:
name: Check Client Generation
runs-on: ubuntu-latest
Expand All @@ -52,7 +86,7 @@ jobs:
- name: Setup Environment
uses: ./.github/actions/setup
with:
rustfmt: true
toolchain: format

- name: Generate Clients
run: pnpm generate:clients
Expand Down
Loading

0 comments on commit 53e4667

Please sign in to comment.