-
Notifications
You must be signed in to change notification settings - Fork 100
ci: Refactor scripts #60
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
Changes from 29 commits
32034fc
6be0456
9455e7d
6492a14
7d2e20c
db04746
32e6669
9542414
d7c6e2a
ec01d10
4f7ad78
4bf599e
e64f87f
d376d52
62d045b
233b5de
a1de716
bc3cc18
3bf2d9f
0bc005f
ab956d7
84b19e2
4693995
343d9d3
503f35b
5982943
7db5221
45cecf0
3a7dc55
ffa73d6
4c846a0
23f37c2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
name: Setup environment | ||
|
||
inputs: | ||
cargo-cache-key: | ||
description: The key to cache cargo dependencies. Skips cargo caching if not provided. | ||
required: false | ||
toolchain: | ||
description: Rust toolchain to install. Comma-separated string of [`build`, `format`, `lint`, `test`]. | ||
required: false | ||
components: | ||
description: Cargo components to install. Comma-separated string of [`audit`, `hack``, `release`, `semver-checks]. | ||
required: false | ||
solana: | ||
description: Install Solana if `true`. Defaults to `false`. | ||
required: false | ||
|
||
runs: | ||
using: 'composite' | ||
steps: | ||
- name: Setup pnpm | ||
uses: pnpm/action-setup@v3 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20 | ||
cache: 'pnpm' | ||
|
||
- name: Install Dependencies | ||
run: pnpm install --frozen-lockfile | ||
shell: bash | ||
|
||
- name: Set Environment Variables | ||
shell: bash | ||
run: pnpm tsx ./scripts/setup/ci.mts | ||
|
||
- name: Install Rust 'build' Toolchain | ||
if: ${{ contains(inputs.toolchain, 'build') }} | ||
uses: dtolnay/rust-toolchain@master | ||
with: | ||
toolchain: ${{ env.TOOLCHAIN_BUILD }} | ||
|
||
- name: Install Rust 'format' Toolchain | ||
if: ${{ contains(inputs.toolchain, 'format') }} | ||
uses: dtolnay/rust-toolchain@master | ||
with: | ||
toolchain: ${{ env.TOOLCHAIN_FORMAT }} | ||
components: rustfmt | ||
|
||
- name: Install Rust 'lint' Toolchain | ||
if: ${{ contains(inputs.toolchain, 'lint') }} | ||
uses: dtolnay/rust-toolchain@master | ||
with: | ||
toolchain: ${{ env.TOOLCHAIN_LINT }} | ||
components: clippy | ||
|
||
- name: Install Rust 'test' Toolchain | ||
if: ${{ contains(inputs.toolchain, 'test') }} | ||
uses: dtolnay/rust-toolchain@master | ||
with: | ||
toolchain: ${{ env.TOOLCHAIN_TEST }} | ||
|
||
- name: Install Solana | ||
if: ${{ inputs.solana == 'true' }} | ||
uses: solana-program/actions/install-solana@v1 | ||
with: | ||
version: ${{ env.SOLANA_VERSION }} | ||
cache: true | ||
|
||
- name: Install 'cargo-audit' | ||
if: ${{ contains(inputs.components, 'audit') }} | ||
shell: bash | ||
run: cargo install cargo-audit | ||
|
||
- name: Install 'cargo-hack' | ||
if: ${{ contains(inputs.components, 'hack') }} | ||
shell: bash | ||
run: cargo install cargo-hack | ||
|
||
- name: Install 'cargo-release' | ||
if: ${{ contains(inputs.components, 'release') }} | ||
shell: bash | ||
run: cargo install cargo-release | ||
|
||
- name: Install 'cargo-semver-checks' | ||
if: ${{ contains(inputs.components, 'semver-checks') }} | ||
shell: bash | ||
run: cargo install cargo-semver-checks | ||
|
||
- 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 }} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
/node_modules | ||
/target |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"semi": true, | ||
"singleQuote": true, | ||
"trailingComma": "es5", | ||
"useTabs": false, | ||
"tabWidth": 2, | ||
"arrowParens": "always", | ||
"printWidth": 80 | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,5 +17,14 @@ repository = "https://github.com/anza-xyz/pinocchio" | |
|
||
[workspace.dependencies] | ||
five8_const = "0.1.3" | ||
pinocchio = { path = "sdk/pinocchio", version = ">= 0.6, <= 0.7" } | ||
pinocchio-pubkey = { path = "sdk/pubkey", version = "0.2.1" } | ||
pinocchio = { path = "sdk/pinocchio", version = ">= 0.6" } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is the version specified like that? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is probably me not using the workspace dependencies correctly. I was trying to avoid bumping dependencies on other packages unnecessarily. For example, if But perhaps this is not the correct way to do that. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah I see, let's just keep them all at the same version for now, I think it'll make things simpler in the long run. |
||
pinocchio-pubkey = { path = "sdk/pubkey", version = "0.2" } | ||
|
||
[workspace.metadata.cli] | ||
solana = "2.1.0" | ||
|
||
[workspace.metadata.toolchains] | ||
build = "1.81.0" | ||
format = "nightly-2024-08-08" | ||
lint = "nightly-2024-08-08" | ||
test = "1.81.0" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"private": true, | ||
"scripts": { | ||
"audit": "tsx ./scripts/audit.mjs", | ||
"build": "tsx ./scripts/build.mjs", | ||
febo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"clippy": "tsx ./scripts/clippy.mjs", | ||
"doc": "tsx ./scripts/doc.mjs", | ||
"format": "tsx ./scripts/format.mjs", | ||
"hack": "tsx ./scripts/hack.mjs", | ||
"lint": "tsx ./scripts/lint.mjs", | ||
"semver": "tsx ./scripts/semver.mjs", | ||
"test": "tsx ./scripts/test.mjs" | ||
}, | ||
"devDependencies": { | ||
"@iarna/toml": "^2.2.5", | ||
"tsx": "^4.19.2", | ||
"typescript": "^5.5.2", | ||
"zx": "^7.2.3" | ||
}, | ||
"engines": { | ||
"node": ">=v20.0.0" | ||
}, | ||
"packageManager": "pnpm@9.1.0" | ||
} |
Uh oh!
There was an error while loading. Please reload this page.