Skip to content

Commit

Permalink
Replace interface build for test
Browse files Browse the repository at this point in the history
  • Loading branch information
febo committed Oct 31, 2024
1 parent fc74c91 commit 0f8f5ac
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 7 deletions.
8 changes: 7 additions & 1 deletion .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ inputs:
description: The key to cache local cargo dependencies. Skips local cargo caching if not provided.
required: false
toolchain:
description: Rust toolchain to install. Comma-separated string of [`build`, `format`, `lint`].
description: Rust toolchain to install. Comma-separated string of [`build`, `format`, `lint`, `test`].
required: false
solana:
description: Install Solana if `true`. Defaults to `false`.
Expand Down Expand Up @@ -57,6 +57,12 @@ runs:
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
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
- name: Lint Interface
run: pnpm interface:lint

build_interface:
test_interface:
name: Build Interface
runs-on: ubuntu-latest
needs: format_and_lint_interface
Expand All @@ -69,7 +69,7 @@ jobs:
- name: Setup Environment
uses: ./.github/actions/setup
with:
toolchain: build
toolchain: test
cargo-cache-key: cargo-interface
solana: true

Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ solana = "edge"
# Specify Rust toolchains for rustfmt, clippy, and build.
# Any unprovided toolchains default to stable.
[workspace.metadata.toolchains]
build = "nightly"
format = "nightly"
lint = "nightly"
test = "nightly"
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
"clients:rust:lint": "zx ./scripts/client/lint-rust.mjs",
"clients:rust:publish": "zx ./scripts/client/publish-rust.mjs",
"clients:rust:test": "zx ./scripts/client/test-rust.mjs",
"interface:build": "zx ./scripts/interface/build.mjs",
"interface:format": "zx ./scripts/interface/format.mjs",
"interface:lint": "zx ./scripts/interface/lint.mjs",
"interface:test": "zx ./scripts/interface/test.mjs",
"template:upgrade": "zx ./scripts/upgrade-template.mjs"
},
"devDependencies": {
Expand Down
1 change: 1 addition & 0 deletions scripts/ci/set-env.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ await $`echo "SOLANA_VERSION=${getSolanaVersion()}" >> $GITHUB_ENV`;
await $`echo "TOOLCHAIN_BUILD=${getToolchain('build')}" >> $GITHUB_ENV`;
await $`echo "TOOLCHAIN_FORMAT=${getToolchain('format')}" >> $GITHUB_ENV`;
await $`echo "TOOLCHAIN_LINT=${getToolchain('lint')}" >> $GITHUB_ENV`;
await $`echo "TOOLCHAIN_TEST=${getToolchain('test')}" >> $GITHUB_ENV`;
4 changes: 2 additions & 2 deletions scripts/interface/build.mjs → scripts/interface/test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import {
// Configure additional arguments here, e.g.:
// ['--arg1', '--arg2', ...cliArguments()]
const buildArgs = cliArguments();
const toolchain = getToolchainArgument('build');
const toolchain = getToolchainArgument('test');
const manifestPath = path.join(workingDirectory, 'interface', 'Cargo.toml');

// Build the programs.
await $`cargo ${toolchain} build --all-features --manifest-path ${manifestPath} ${buildArgs}`;
await $`cargo ${toolchain} test --all-features --manifest-path ${manifestPath} ${buildArgs}`;

0 comments on commit 0f8f5ac

Please sign in to comment.