Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 33 additions & 23 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,64 +10,74 @@ 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`.
pnpm:
description: Install pnpm if `true`. Defaults to `false`.
required: false
solana:
description: Install Solana if `true`. Defaults to `false`.
required: false
toolchain:
description: Rust toolchain to install. Comma-separated string of [`format`, `lint`, `test`].
required: false

runs:
using: 'composite'
steps:
- name: Set Environment Variables
shell: bash
run: |
source ./vars.env
echo "RUST_TOOLCHAIN_NIGHTLY=$RUST_TOOLCHAIN_NIGHTLY" >> "$GITHUB_ENV"
echo "SOLANA_CLI_VERSION=$SOLANA_CLI_VERSION" >> "$GITHUB_ENV"

- name: Setup pnpm
if: ${{ inputs.pnpm == 'true' }}
uses: pnpm/action-setup@v3

- name: Setup Node.js
if: ${{ inputs.pnpm == 'true' }}
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'

- name: Install Dependencies
if: ${{ inputs.pnpm == 'true' }}
run: pnpm install --frozen-lockfile
shell: bash

- name: Set Environment Variables
shell: bash
run: pnpm zx ./scripts/ci/set-env.mjs

- name: Install Protobuf Compiler (Temporary Workaround for Solana 2.0)
if: ${{ inputs.solana == 'true' || inputs.rustfmt == 'true' || inputs.clippy == 'true' }}
shell: bash
run: |
sudo apt-get update
sudo apt-get install -y protobuf-compiler

- name: Install Rustfmt
if: ${{ inputs.rustfmt == 'true' }}
- name: Install Rust 'format' Toolchain
if: ${{ contains(inputs.toolchain, 'format') }}
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.TOOLCHAIN_FORMAT }}
toolchain: ${{ env.RUST_TOOLCHAIN_NIGHTLY }}
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 }}
toolchain: ${{ env.RUST_TOOLCHAIN_NIGHTLY }}
components: clippy

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

- name: Install Solana
if: ${{ inputs.solana == 'true' }}
uses: solana-program/actions/install-solana@v1
with:
version: ${{ env.SOLANA_VERSION }}
version: ${{ env.SOLANA_CLI_VERSION }}
cache: true

- name: Install 'cargo-hack'
if: ${{ contains(inputs.toolchain, 'lint') }}
shell: bash
run: cargo install cargo-hack

- name: Cache Cargo Dependencies
if: ${{ inputs.cargo-cache-key && !inputs.cargo-cache-fallback-key }}
uses: actions/cache@v4
Expand Down
Loading