@@ -10,64 +10,74 @@ 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 [`format`, `lint`, `test`].
21+ required : false
2222
2323runs :
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-
50- - name : Install Rustfmt
51- if : ${{ inputs.rustfmt == 'true' }}
49+ - name : Install Rust 'format' Toolchain
50+ if : ${{ contains(inputs.toolchain, 'format') }}
5251 uses : dtolnay/rust-toolchain@master
5352 with :
54- toolchain : ${{ env.TOOLCHAIN_FORMAT }}
53+ toolchain : ${{ env.RUST_TOOLCHAIN_NIGHTLY }}
5554 components : rustfmt
5655
57- - name : Install Clippy
58- if : ${{ inputs.clippy == 'true' }}
56+ - name : Install Rust 'lint' Toolchain
57+ if : ${{ contains( inputs.toolchain, 'lint') }}
5958 uses : dtolnay/rust-toolchain@master
6059 with :
61- toolchain : ${{ env.TOOLCHAIN_LINT }}
60+ toolchain : ${{ env.RUST_TOOLCHAIN_NIGHTLY }}
6261 components : clippy
6362
63+ - name : Install Rust 'test' Toolchain
64+ if : ${{ contains(inputs.toolchain, 'test') }}
65+ uses : dtolnay/rust-toolchain@master
66+ with :
67+ toolchain : stable
68+
6469 - name : Install Solana
6570 if : ${{ inputs.solana == 'true' }}
6671 uses : solana-program/actions/install-solana@v1
6772 with :
68- version : ${{ env.SOLANA_VERSION }}
73+ version : ${{ env.SOLANA_CLI_VERSION }}
6974 cache : true
7075
76+ - name : Install 'cargo-hack'
77+ if : ${{ contains(inputs.toolchain, 'lint') }}
78+ shell : bash
79+ run : cargo install cargo-hack
80+
7181 - name : Cache Cargo Dependencies
7282 if : ${{ inputs.cargo-cache-key && !inputs.cargo-cache-fallback-key }}
7383 uses : actions/cache@v4
0 commit comments