Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update template with latest create-solana-program #29

Merged
merged 6 commits into from
Oct 4, 2024
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
101 changes: 85 additions & 16 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,102 @@
name: Setup environment

inputs:
cache:
description: Enable caching
default: "true"
node:
description: The Node.js version to install
required: 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
solana:
description: The Solana version to install
description: Install Solana if `true`. Defaults to `false`.
required: false
shank:
description: Install Shank if `true`. Defaults to `false`.
required: false

runs:
using: "composite"
using: 'composite'
steps:
- name: Install Protoc
uses: arduino/setup-protoc@v3

- 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
node-version: 20
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 Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: ${{ env.RUST_TOOLCHAIN }}
components: rustc, cargo, rustfmt, clippy
cache: true

- name: Install Solana
if: ${{ inputs.solana != '' }}
uses: metaplex-foundation/actions/install-solana@v1
with:
version: ${{ inputs.solana }}
cache: ${{ inputs.cache }}
- name: Install Protoc
uses: arduino/setup-protoc@v3
version: ${{ env.SOLANA_VERSION }}
cache: true

- name: Install Shank
if: ${{ inputs.shank == 'true' }}
uses: baptiste0928/cargo-install@v3
with:
crate: shank-cli

- 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/
~/.cache/solana/
key: ${{ runner.os }}-${{ inputs.cargo-cache-local-key }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-${{ inputs.cargo-cache-local-key }}
Loading
Loading