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
13 changes: 11 additions & 2 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ inputs:
rustfmt:
description: Install Rustfmt if `true`. Defaults to `false`.
required: false
nightly-toolchain:
description: Install nightly toolchain if `true`. Defaults to `false`.
required: false
solana:
description: Install Solana if `true`. Defaults to `false`.
required: false
Expand Down Expand Up @@ -44,16 +47,22 @@ runs:
if: ${{ inputs.rustfmt == 'true' }}
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.TOOLCHAIN_FORMAT }}
toolchain: ${{ env.TOOLCHAIN_NIGHTLY }}
components: rustfmt

- name: Install Clippy
if: ${{ inputs.clippy == 'true' }}
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.TOOLCHAIN_LINT }}
toolchain: ${{ env.TOOLCHAIN_NIGHTLY }}
components: clippy

- name: Install nightly toolchain
if: ${{ inputs.nightly-toolchain == 'true' }}
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.TOOLCHAIN_NIGHTLY }}

- name: Install Solana
if: ${{ inputs.solana == 'true' }}
uses: solana-program/actions/install-solana@v1
Expand Down
22 changes: 22 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,28 @@ jobs:
- name: Build
run: pnpm ${{ matrix.library }}:build

hack_rust:
name: Check Powerset
runs-on: ubuntu-latest
steps:
- name: Git Checkout
uses: actions/checkout@v4

- name: Setup Environment
uses: ./.github/actions/setup
with:
nightly-toolchain: true
cargo-cache-key: cargo-hack-check
cargo-cache-fallback-key: cargo-hack

- name: Install cargo-hack
uses: taiki-e/cache-cargo-install-action@v2
with:
tool: cargo-hack

- name: Hack check
run: pnpm rust:hack

test_rust:
name: Test Rust
runs-on: ubuntu-latest
Expand Down
3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ solana = "2.2.0"
# Specify Rust toolchains for rustfmt, clippy, and build.
# Any unprovided toolchains default to stable.
[workspace.metadata.toolchains]
format = "nightly-2024-11-22"
lint = "nightly-2024-11-22"
nightly = "nightly-2024-11-22"

[workspace.metadata.spellcheck]
config = "scripts/spellcheck.toml"
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"template:upgrade": "zx ./scripts/upgrade-template.mjs",
"rust:spellcheck": "cargo spellcheck --code 1",
"rust:audit": "zx ./scripts/rust/audit.mjs",
"rust:hack": "zx ./scripts/rust/hack.mjs",
"rust:semver": "cargo semver-checks"
},
"devDependencies": {
Expand Down
3 changes: 1 addition & 2 deletions scripts/ci/set-env.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@
import { getSolanaVersion, getToolchain } from '../utils.mjs';

await $`echo "SOLANA_VERSION=${getSolanaVersion()}" >> $GITHUB_ENV`;
await $`echo "TOOLCHAIN_FORMAT=${getToolchain('format')}" >> $GITHUB_ENV`;
await $`echo "TOOLCHAIN_LINT=${getToolchain('lint')}" >> $GITHUB_ENV`;
await $`echo "TOOLCHAIN_NIGHTLY=${getToolchain('nightly')}" >> $GITHUB_ENV`;
2 changes: 1 addition & 1 deletion scripts/rust/format.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const [folder, ...formatArgs] = cliArguments();

const fix = popArgument(formatArgs, '--fix');
const [cargoArgs, fmtArgs] = partitionArguments(formatArgs, '--');
const toolchain = getToolchainArgument('format');
const toolchain = getToolchainArgument('nightly');

const manifestPath = path.join(workingDirectory, folder, 'Cargo.toml');

Expand Down
6 changes: 6 additions & 0 deletions scripts/rust/hack.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env zx
import 'zx/globals';
import { cliArguments, getToolchainArgument } from '../utils.mjs';

const toolchain = getToolchainArgument('nightly');
await $`cargo ${toolchain} hack check --all-targets --feature-powerset ${cliArguments()}`;
2 changes: 1 addition & 1 deletion scripts/rust/lint.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const lintArgs = [
];

const fix = popArgument(lintArgs, '--fix');
const toolchain = getToolchainArgument('lint');
const toolchain = getToolchainArgument('nightly');

const manifestPath = path.join(workingDirectory, folder, 'Cargo.toml');

Expand Down
2 changes: 1 addition & 1 deletion tlv-account-resolution/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ solana-decode-error = "2.2.1"
solana-instruction = { version = "2.2.1", features = ["std"] }
solana-program-error = "2.2.1"
solana-msg = "2.2.1"
solana-pubkey = "2.2.1"
solana-pubkey = { version = "2.2.1", features = ["curve25519"] }
spl-discriminator = { version = "0.4.0", path = "../discriminator" }
spl-program-error = { version = "0.6.0", path = "../program-error" }
spl-pod = { version = "0.5.0", path = "../pod" }
Expand Down
Loading