Skip to content

Commit cb598f0

Browse files
authored
Update solana program template (#1)
* [wip] Update solana program template * [wip] Add legacy package to workflow * Fix pnpm version * Fix lint * Change step names
1 parent b7b2457 commit cb598f0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+1710
-889
lines changed

.github/actions/setup/action.yml

Lines changed: 86 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,103 @@
11
name: Setup environment
22

33
inputs:
4-
cache:
5-
description: Enable caching
6-
default: "true"
7-
node:
8-
description: The Node.js version to install
9-
required: true
4+
cargo-cache-key:
5+
description: The key to cache cargo dependencies. Skips cargo caching if not provided.
6+
required: false
7+
cargo-cache-fallback-key:
8+
description: The fallback key to use when caching cargo dependencies. Default to not using a fallback key.
9+
required: false
10+
cargo-cache-local-key:
11+
description: The key to cache local cargo dependencies. Skips local cargo caching if not provided.
12+
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`.
18+
required: false
1019
solana:
11-
description: The Solana version to install
20+
description: Install Solana if `true`. Defaults to `false`.
21+
required: false
1222

1323
runs:
14-
using: "composite"
24+
using: 'composite'
1525
steps:
1626
- name: Setup pnpm
1727
uses: pnpm/action-setup@v3
28+
1829
- name: Setup Node.js
1930
uses: actions/setup-node@v4
2031
with:
21-
node-version: ${{ inputs.node }}
22-
cache: "pnpm"
23-
- name: Install dependencies
32+
node-version: 20
33+
cache: 'pnpm'
34+
35+
- name: Install Dependencies
2436
run: pnpm install --frozen-lockfile
2537
shell: bash
38+
39+
- name: Set Environment Variables
40+
shell: bash
41+
run: pnpm zx ./scripts/ci/set-env.mjs
42+
43+
- name: Install Rustfmt
44+
if: ${{ inputs.rustfmt == 'true' }}
45+
uses: dtolnay/rust-toolchain@master
46+
with:
47+
toolchain: ${{ env.TOOLCHAIN_FORMAT }}
48+
components: rustfmt
49+
50+
- name: Install Clippy
51+
if: ${{ inputs.clippy == 'true' }}
52+
uses: dtolnay/rust-toolchain@master
53+
with:
54+
toolchain: ${{ env.TOOLCHAIN_LINT }}
55+
components: clippy
56+
2657
- name: Install Solana
27-
if: ${{ inputs.solana != '' }}
58+
if: ${{ inputs.solana == 'true' }}
2859
uses: metaplex-foundation/actions/install-solana@v1
2960
with:
30-
version: ${{ inputs.solana }}
31-
cache: ${{ inputs.cache }}
61+
version: ${{ env.SOLANA_VERSION }}
62+
cache: true
63+
64+
- name: Cache Cargo Dependencies
65+
if: ${{ inputs.cargo-cache-key && !inputs.cargo-cache-fallback-key }}
66+
uses: actions/cache@v4
67+
with:
68+
path: |
69+
~/.cargo/bin/
70+
~/.cargo/registry/index/
71+
~/.cargo/registry/cache/
72+
~/.cargo/git/db/
73+
target/
74+
key: ${{ runner.os }}-${{ inputs.cargo-cache-key }}-${{ hashFiles('**/Cargo.lock') }}
75+
restore-keys: ${{ runner.os }}-${{ inputs.cargo-cache-key }}
76+
77+
- name: Cache Cargo Dependencies With Fallback
78+
if: ${{ inputs.cargo-cache-key && inputs.cargo-cache-fallback-key }}
79+
uses: actions/cache@v4
80+
with:
81+
path: |
82+
~/.cargo/bin/
83+
~/.cargo/registry/index/
84+
~/.cargo/registry/cache/
85+
~/.cargo/git/db/
86+
target/
87+
key: ${{ runner.os }}-${{ inputs.cargo-cache-key }}-${{ hashFiles('**/Cargo.lock') }}
88+
restore-keys: |
89+
${{ runner.os }}-${{ inputs.cargo-cache-key }}
90+
${{ runner.os }}-${{ inputs.cargo-cache-fallback-key }}-${{ hashFiles('**/Cargo.lock') }}
91+
${{ runner.os }}-${{ inputs.cargo-cache-fallback-key }}
92+
93+
- name: Cache Local Cargo Dependencies
94+
if: ${{ inputs.cargo-cache-local-key }}
95+
uses: actions/cache@v4
96+
with:
97+
path: |
98+
.cargo/bin/
99+
.cargo/registry/index/
100+
.cargo/registry/cache/
101+
.cargo/git/db/
102+
key: ${{ runner.os }}-${{ inputs.cargo-cache-local-key }}-${{ hashFiles('**/Cargo.lock') }}
103+
restore-keys: ${{ runner.os }}-${{ inputs.cargo-cache-local-key }}

0 commit comments

Comments
 (0)