From 49e59ee88bdb254bce6946ac6f82dd8090be5d8a Mon Sep 17 00:00:00 2001 From: rustopian <96253492+rustopian@users.noreply.github.com> Date: Wed, 27 Aug 2025 17:26:56 +0100 Subject: [PATCH 1/4] build program first --- .github/workflows/publish-rust.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/publish-rust.yml b/.github/workflows/publish-rust.yml index 9e57cc83..d6b9b9fe 100644 --- a/.github/workflows/publish-rust.yml +++ b/.github/workflows/publish-rust.yml @@ -124,6 +124,7 @@ jobs: with: cargo-cache-key: cargo-publish-${{ inputs.package_path }} cargo-cache-fallback-key: cargo-publish + solana: ${{ inputs.package_path == 'program' }} - name: Install cargo-release uses: taiki-e/install-action@v2 @@ -144,6 +145,10 @@ jobs: git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" git config --global user.name "github-actions[bot]" + - name: Build SBF program first + if: ${{ inputs.package_path == 'program' }} + run: pnpm programs:build + - name: Publish Crate id: publish env: From bcf0fedbdd26677af43058c00724307c22918c5e Mon Sep 17 00:00:00 2001 From: rustopian <96253492+rustopian@users.noreply.github.com> Date: Wed, 27 Aug 2025 17:32:18 +0100 Subject: [PATCH 2/4] yank unnecessary condition --- .github/workflows/publish-rust.yml | 6 ++++-- scripts/rust/build-sbf.mjs | 1 - 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/publish-rust.yml b/.github/workflows/publish-rust.yml index d6b9b9fe..e0c99d40 100644 --- a/.github/workflows/publish-rust.yml +++ b/.github/workflows/publish-rust.yml @@ -61,6 +61,8 @@ jobs: run: pnpm zx ./scripts/rust/format.mjs "${{ inputs.package_path }}" - name: Lint + env: + CARGO_TARGET_DIR: target/host run: pnpm zx ./scripts/rust/lint.mjs "${{ inputs.package_path }}" - name: Build programs @@ -69,6 +71,8 @@ jobs: run: pnpm programs:build - name: Test + env: + CARGO_TARGET_DIR: target/host run: pnpm zx ./scripts/rust/test.mjs "${{ inputs.package_path }}" semver: @@ -124,7 +128,6 @@ jobs: with: cargo-cache-key: cargo-publish-${{ inputs.package_path }} cargo-cache-fallback-key: cargo-publish - solana: ${{ inputs.package_path == 'program' }} - name: Install cargo-release uses: taiki-e/install-action@v2 @@ -146,7 +149,6 @@ jobs: git config --global user.name "github-actions[bot]" - name: Build SBF program first - if: ${{ inputs.package_path == 'program' }} run: pnpm programs:build - name: Publish Crate diff --git a/scripts/rust/build-sbf.mjs b/scripts/rust/build-sbf.mjs index c27c38cb..64a80d34 100644 --- a/scripts/rust/build-sbf.mjs +++ b/scripts/rust/build-sbf.mjs @@ -7,5 +7,4 @@ import { const [folder, ...args] = cliArguments(); const manifestPath = path.join(workingDirectory, folder, 'Cargo.toml'); -process.env.CARGO_TARGET_DIR ||= path.join(workingDirectory, 'target', 'sbf'); await $`cargo-build-sbf --manifest-path ${manifestPath} ${args}`; From cb0d1f08ba92c8669aef9ef74023f6385b7188eb Mon Sep 17 00:00:00 2001 From: rustopian <96253492+rustopian@users.noreply.github.com> Date: Thu, 28 Aug 2025 12:16:42 +0100 Subject: [PATCH 3/4] let's cache bust --- .github/workflows/publish-rust.yml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/publish-rust.yml b/.github/workflows/publish-rust.yml index e0c99d40..f674279e 100644 --- a/.github/workflows/publish-rust.yml +++ b/.github/workflows/publish-rust.yml @@ -1,5 +1,8 @@ name: Publish Rust Crate +env: + CACHE_BUST_SUFFIX: '-v3' + on: workflow_dispatch: inputs: @@ -39,6 +42,10 @@ on: required: true type: boolean default: true + cache_bust: + description: Optional cache-bust suffix + required: false + type: string jobs: test: @@ -54,15 +61,13 @@ jobs: clippy: true rustfmt: true solana: true - cargo-cache-key: cargo-test-publish-${{ inputs.package_path }} + cargo-cache-key: cargo-test-publish-${{ inputs.package_path }}${{ env.CACHE_BUST_SUFFIX }} cargo-cache-fallback-key: cargo-test-publish - name: Format run: pnpm zx ./scripts/rust/format.mjs "${{ inputs.package_path }}" - name: Lint - env: - CARGO_TARGET_DIR: target/host run: pnpm zx ./scripts/rust/lint.mjs "${{ inputs.package_path }}" - name: Build programs @@ -71,8 +76,6 @@ jobs: run: pnpm programs:build - name: Test - env: - CARGO_TARGET_DIR: target/host run: pnpm zx ./scripts/rust/test.mjs "${{ inputs.package_path }}" semver: From 642a739161fee674ca5e2ff7b40422a2df066e3d Mon Sep 17 00:00:00 2001 From: rustopian <96253492+rustopian@users.noreply.github.com> Date: Thu, 28 Aug 2025 12:24:32 +0100 Subject: [PATCH 4/4] revert and clear cache on gh --- .github/workflows/publish-rust.yml | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/.github/workflows/publish-rust.yml b/.github/workflows/publish-rust.yml index f674279e..55f233d3 100644 --- a/.github/workflows/publish-rust.yml +++ b/.github/workflows/publish-rust.yml @@ -1,8 +1,5 @@ name: Publish Rust Crate -env: - CACHE_BUST_SUFFIX: '-v3' - on: workflow_dispatch: inputs: @@ -42,10 +39,6 @@ on: required: true type: boolean default: true - cache_bust: - description: Optional cache-bust suffix - required: false - type: string jobs: test: @@ -61,7 +54,7 @@ jobs: clippy: true rustfmt: true solana: true - cargo-cache-key: cargo-test-publish-${{ inputs.package_path }}${{ env.CACHE_BUST_SUFFIX }} + cargo-cache-key: cargo-test-publish-${{ inputs.package_path }} cargo-cache-fallback-key: cargo-test-publish - name: Format @@ -71,8 +64,6 @@ jobs: run: pnpm zx ./scripts/rust/lint.mjs "${{ inputs.package_path }}" - name: Build programs - env: - CARGO_TARGET_DIR: target/sbf run: pnpm programs:build - name: Test @@ -151,9 +142,6 @@ jobs: git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" git config --global user.name "github-actions[bot]" - - name: Build SBF program first - run: pnpm programs:build - - name: Publish Crate id: publish env: