Skip to content

Commit

Permalink
Fix GH CI Rust setup
Browse files Browse the repository at this point in the history
  • Loading branch information
jasl committed Oct 4, 2024
1 parent c6e08f0 commit 38fd480
Show file tree
Hide file tree
Showing 10 changed files with 2,965 additions and 4,412 deletions.
22 changes: 6 additions & 16 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`.
rust:
description: Install Rust if `true`. Defaults to `false`.
required: false
solana:
description: Install Solana if `true`. Defaults to `false`.
Expand Down Expand Up @@ -43,19 +40,12 @@ runs:
shell: bash
run: pnpm zx ./scripts/ci/set-env.mjs

- name: Install Rustfmt
if: ${{ inputs.rustfmt == 'true' }}
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.TOOLCHAIN_FORMAT }}
components: rustfmt

- name: Install Clippy
if: ${{ inputs.clippy == 'true' }}
- name: Install Rust
if: ${{ inputs.rust == 'true' }}
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.TOOLCHAIN_LINT }}
components: clippy
toolchain: ${{ env.RUST_TOOLCHAIN }}
components: rustc, cargo, rustfmt, clippy

- name: Install Solana
if: ${{ inputs.solana == 'true' }}
Expand Down
11 changes: 6 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ jobs:
- name: Setup Environment
uses: ./.github/actions/setup
with:
clippy: true
rustfmt: true
rust: true

- name: Format Programs
run: pnpm programs:format
Expand Down Expand Up @@ -52,8 +51,7 @@ jobs:
- name: Setup Environment
uses: ./.github/actions/setup
with:
clippy: true
rustfmt: true
rust: true

- name: Format Client Rust
run: pnpm clients:rust:format
Expand All @@ -73,6 +71,7 @@ jobs:
uses: ./.github/actions/setup
with:
cargo-cache-key: cargo-programs
rust: true
solana: true

- name: Build Programs
Expand Down Expand Up @@ -104,6 +103,7 @@ jobs:
with:
cargo-cache-key: cargo-program-tests
cargo-cache-fallback-key: cargo-programs
rust: true
solana: true

- name: Test Programs
Expand Down Expand Up @@ -143,7 +143,7 @@ jobs:
- name: Setup Environment
uses: ./.github/actions/setup
with:
rustfmt: true
rust: true

- name: Generate Clients
run: pnpm generate:clients
Expand Down Expand Up @@ -187,6 +187,7 @@ jobs:
uses: ./.github/actions/setup
with:
cargo-cache-key: cargo-rust-client
rust: true
solana: true

- name: Restore Program Builds
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/publish-rust-client.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ jobs:
uses: ./.github/actions/setup
with:
cargo-cache-key: cargo-rust-client
clippy: true
rustfmt: true
rust: true
solana: true

- name: Format Rust Client
Expand Down Expand Up @@ -75,8 +74,7 @@ jobs:
with:
cargo-cache-key: cargo-publish-rust-client
cargo-cache-fallback-key: cargo-rust-client
clippy: true
rustfmt: true
rust: true

- name: Install Cargo Release
run: which cargo-release || cargo install cargo-release
Expand Down
8 changes: 1 addition & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,7 @@ repository = "https://github.com/dephy-io/dephy-id"
license = "Apache-2.0"

[workspace.metadata.cli]
solana = "1.18.25"

# Specify Rust toolchains for rustfmt, clippy, and build.
# Any unprovided toolchains default to stable.
[workspace.metadata.toolchains]
format = "1.81.0"
lint = "1.81.0"
solana = "2.0.13"

[workspace.dependencies]
anchor-lang = "0.30.1"
Expand Down
Loading

0 comments on commit 38fd480

Please sign in to comment.