-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f61463b
commit 00018b9
Showing
19 changed files
with
589 additions
and
306 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,108 @@ | ||
name: Setup environment | ||
|
||
inputs: | ||
cache: | ||
description: Enable caching | ||
default: "true" | ||
cargo-cache-key: | ||
description: The key to cache cargo dependencies. Skips cargo caching if not provided. | ||
required: false | ||
cargo-cache-fallback-key: | ||
description: The fallback key to use when caching cargo dependencies. Default to not using a fallback key. | ||
required: false | ||
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 | ||
node: | ||
description: The Node.js version to install | ||
description: The Node.js version to install. Required. | ||
required: true | ||
rustfmt: | ||
description: Install Rustfmt if `true`. Defaults to `false`. | ||
required: false | ||
solana: | ||
description: The Solana version to install | ||
description: The Solana version to install. Skips if not provided. | ||
required: false | ||
|
||
runs: | ||
using: "composite" | ||
using: 'composite' | ||
steps: | ||
- name: Setup pnpm | ||
uses: pnpm/action-setup@v3 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ inputs.node }} | ||
cache: "pnpm" | ||
- name: Install dependencies | ||
cache: 'pnpm' | ||
|
||
- name: Install Dependencies | ||
run: pnpm install --frozen-lockfile | ||
shell: bash | ||
|
||
- name: Set Environment Variables | ||
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' }} | ||
uses: dtolnay/rust-toolchain@master | ||
with: | ||
toolchain: ${{ env.TOOLCHAIN_LINT }} | ||
components: clippy | ||
|
||
- name: Install Solana | ||
if: ${{ inputs.solana != '' }} | ||
if: ${{ inputs.solana }} | ||
uses: metaplex-foundation/actions/install-solana@v1 | ||
with: | ||
version: ${{ inputs.solana }} | ||
cache: ${{ inputs.cache }} | ||
cache: true | ||
|
||
|
||
- name: Cache Cargo Dependencies | ||
if: ${{ inputs.cargo-cache-key && !inputs.cargo-cache-fallback-key }} | ||
uses: actions/cache@v4 | ||
with: | ||
path: | | ||
~/.cargo/bin/ | ||
~/.cargo/registry/index/ | ||
~/.cargo/registry/cache/ | ||
~/.cargo/git/db/ | ||
target/ | ||
key: ${{ runner.os }}-${{ inputs.cargo-cache-key }}-${{ hashFiles('**/Cargo.lock') }} | ||
restore-keys: ${{ runner.os }}-${{ inputs.cargo-cache-key }} | ||
|
||
- name: Cache Cargo Dependencies With Fallback | ||
if: ${{ inputs.cargo-cache-key && inputs.cargo-cache-fallback-key }} | ||
uses: actions/cache@v4 | ||
with: | ||
path: | | ||
~/.cargo/bin/ | ||
~/.cargo/registry/index/ | ||
~/.cargo/registry/cache/ | ||
~/.cargo/git/db/ | ||
target/ | ||
key: ${{ runner.os }}-${{ inputs.cargo-cache-key }}-${{ hashFiles('**/Cargo.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-${{ inputs.cargo-cache-key }} | ||
${{ runner.os }}-${{ inputs.cargo-cache-fallback-key }}-${{ hashFiles('**/Cargo.lock') }} | ||
${{ runner.os }}-${{ inputs.cargo-cache-fallback-key }} | ||
- name: Cache Local Cargo Dependencies | ||
if: ${{ inputs.cargo-cache-local-key }} | ||
uses: actions/cache@v4 | ||
with: | ||
path: | | ||
.cargo/bin/ | ||
.cargo/registry/index/ | ||
.cargo/registry/cache/ | ||
.cargo/git/db/ | ||
key: ${{ runner.os }}-${{ inputs.cargo-cache-local-key }}-${{ hashFiles('**/Cargo.lock') }} | ||
restore-keys: ${{ runner.os }}-${{ inputs.cargo-cache-local-key }} |
Oops, something went wrong.