Skip to content

Commit 3a64bc8

Browse files
committed
overhaul ci with makefile
1 parent ba02efe commit 3a64bc8

37 files changed

+289
-1198
lines changed

.github/actions/setup/action.yml

Lines changed: 38 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,64 +10,80 @@ 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+
pnpm:
14+
description: Install pnpm if `true`. Defaults to `false`.
1815
required: false
1916
solana:
2017
description: Install Solana if `true`. Defaults to `false`.
2118
required: false
19+
toolchain:
20+
description: Rust toolchain to install. Comma-separated string of [`build`, `format`, `lint`, `test`].
21+
required: false
2222

2323
runs:
2424
using: 'composite'
2525
steps:
26+
- name: Set Environment Variables
27+
shell: bash
28+
run: |
29+
source ./vars.env
30+
echo "RUST_TOOLCHAIN_NIGHTLY=$RUST_TOOLCHAIN_NIGHTLY" >> "$GITHUB_ENV"
31+
echo "SOLANA_CLI_VERSION=$SOLANA_CLI_VERSION" >> "$GITHUB_ENV"
32+
2633
- name: Setup pnpm
34+
if: ${{ inputs.pnpm == 'true' }}
2735
uses: pnpm/action-setup@v3
2836

2937
- name: Setup Node.js
38+
if: ${{ inputs.pnpm == 'true' }}
3039
uses: actions/setup-node@v4
3140
with:
3241
node-version: 20
3342
cache: 'pnpm'
3443

3544
- name: Install Dependencies
45+
if: ${{ inputs.pnpm == 'true' }}
3646
run: pnpm install --frozen-lockfile
3747
shell: bash
3848

39-
- name: Set Environment Variables
40-
shell: bash
41-
run: pnpm zx ./scripts/ci/set-env.mjs
42-
43-
- name: Install Protobuf Compiler (Temporary Workaround for Solana 2.0)
44-
if: ${{ inputs.solana == 'true' || inputs.rustfmt == 'true' || inputs.clippy == 'true' }}
45-
shell: bash
46-
run: |
47-
sudo apt-get update
48-
sudo apt-get install -y protobuf-compiler
49+
- name: Install Rust 'build' Toolchain
50+
if: ${{ contains(inputs.toolchain, 'build') }}
51+
uses: dtolnay/rust-toolchain@master
52+
with:
53+
toolchain: ${{ env.RUST_TOOLCHAIN_NIGHTLY }}
4954

50-
- name: Install Rustfmt
51-
if: ${{ inputs.rustfmt == 'true' }}
55+
- name: Install Rust 'format' Toolchain
56+
if: ${{ contains(inputs.toolchain, 'format') }}
5257
uses: dtolnay/rust-toolchain@master
5358
with:
54-
toolchain: ${{ env.TOOLCHAIN_FORMAT }}
59+
toolchain: ${{ env.RUST_TOOLCHAIN_NIGHTLY }}
5560
components: rustfmt
5661

57-
- name: Install Clippy
58-
if: ${{ inputs.clippy == 'true' }}
62+
- name: Install Rust 'lint' Toolchain
63+
if: ${{ contains(inputs.toolchain, 'lint') }}
5964
uses: dtolnay/rust-toolchain@master
6065
with:
61-
toolchain: ${{ env.TOOLCHAIN_LINT }}
66+
toolchain: ${{ env.RUST_TOOLCHAIN_NIGHTLY }}
6267
components: clippy
6368

69+
- name: Install Rust 'test' Toolchain
70+
if: ${{ contains(inputs.toolchain, 'test') }}
71+
uses: dtolnay/rust-toolchain@master
72+
with:
73+
toolchain: ${{ env.RUST_TOOLCHAIN_NIGHTLY }}
74+
6475
- name: Install Solana
6576
if: ${{ inputs.solana == 'true' }}
6677
uses: solana-program/actions/install-solana@v1
6778
with:
68-
version: ${{ env.SOLANA_VERSION }}
79+
version: ${{ env.SOLANA_CLI_VERSION }}
6980
cache: true
7081

82+
- name: Install 'cargo-hack'
83+
if: ${{ contains(inputs.toolchain, 'lint') }}
84+
shell: bash
85+
run: cargo install cargo-hack
86+
7187
- name: Cache Cargo Dependencies
7288
if: ${{ inputs.cargo-cache-key && !inputs.cargo-cache-fallback-key }}
7389
uses: actions/cache@v4

0 commit comments

Comments
 (0)