Skip to content

Bump CI to Rust 1.81.0 #116

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

Merged
merged 9 commits into from
Mar 31, 2025
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
48 changes: 24 additions & 24 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ env:
ANCHOR_VERSION: 0.30.0
NODE_VERSION : 20
SOLANA_VERSION: 1.18.18
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we also bump this to 2.1?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Famous last words.

TOOLCHAIN: 1.75.0
TOOLCHAIN: 1.81.0

jobs:
lint:
Expand Down Expand Up @@ -59,6 +59,19 @@ jobs:
cache: "pnpm"
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Cache cargo crates
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
./projects/**/.cargo/
./projects/**/target/
key: ${{ runner.os }}-crates-solana-v${{ matrix.solana }}-${{ hashFiles('projects/**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-crates-solana-v${{ matrix.solana }}
- name: Install Solana
uses: solana-program/actions/install-solana@v1
with:
Expand All @@ -80,19 +93,6 @@ jobs:
version: ${{ matrix.anchor }}
- name: Pre-scaffold projects for caching purposes
run: pnpm snapshot ${{ matrix.project }} --scaffold-only
- name: Cache cargo crates
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
./projects/**/.cargo/
./projects/**/target/
key: ${{ runner.os }}-crates-solana-v${{ matrix.solana }}-${{ hashFiles('projects/**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-crates-solana-v${{ matrix.solana }}
- name: Build and run tests
run: pnpm snapshot ${{ matrix.project }} --test

Expand All @@ -118,16 +118,6 @@ jobs:
cache: "pnpm"
- name: Install Dependencies
run: pnpm install --frozen-lockfile
- name: Install Solana
uses: solana-program/actions/install-solana@v1
with:
version: ${{ env.SOLANA_VERSION }}
- name: Install Anchor
uses: metaplex-foundation/actions/install-anchor-cli@v1
with:
version: ${{ env.ANCHOR_VERSION }}
- name: Pre-scaffold projects for caching purposes
run: pnpm snapshot --scaffold-only
- name: Cache cargo crates
uses: actions/cache@v4
with:
Expand All @@ -141,6 +131,16 @@ jobs:
key: ${{ runner.os }}-crates-solana-v${{ env.SOLANA_VERSION }}-${{ hashFiles('projects/**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-crates-solana-v${{ env.SOLANA_VERSION }}
- name: Install Solana
uses: solana-program/actions/install-solana@v1
with:
version: ${{ env.SOLANA_VERSION }}
- name: Install Anchor
uses: metaplex-foundation/actions/install-anchor-cli@v1
with:
version: ${{ env.ANCHOR_VERSION }}
- name: Pre-scaffold projects for caching purposes
run: pnpm snapshot --scaffold-only
- name: Setup git user
run: |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
Expand Down
2 changes: 1 addition & 1 deletion template/anchor/clients/js/clients/js/test/_setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {
setTransactionMessageFeePayerSigner,
setTransactionMessageLifetimeUsingBlockhash,
signTransactionMessageWithSigners,
} from '@solana/web3.js';
} from '@solana/kit';
import { getCreateInstruction } from '../src';

type Client = {
Expand Down
2 changes: 1 addition & 1 deletion template/anchor/clients/js/clients/js/test/create.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
appendTransactionMessageInstruction,
generateKeyPairSigner,
pipe,
} from '@solana/web3.js';
} from '@solana/kit';
import test from 'ava';
import { Counter, fetchCounter, getCreateInstruction } from '../src';
import {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
isSolanaError,
lamports,
pipe,
} from '@solana/web3.js';
} from '@solana/kit';
import test from 'ava';
import {
{{ programName | snakeCase | upper }}_ERROR__INVALID_AUTHORITY,
Expand Down
4 changes: 2 additions & 2 deletions template/clients/js/clients/js/package.json.njk
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@
"homepage": "{{ repositoryUrl }}#readme",
"license": "MIT",
"peerDependencies": {
"@solana/web3.js": "^2.0.0"
"@solana/kit": "^2.1.0"
},
"devDependencies": {
"@ava/typescript": "^4.1.0",
"@solana/eslint-config-solana": "^3.0.3",
"@solana/web3.js": "^2.0.0",
"@solana/kit": "^2.1.0",
"@types/node": "^20",
"@typescript-eslint/eslint-plugin": "^7.16.1",
"@typescript-eslint/parser": "^7.16.1",
Expand Down
2 changes: 1 addition & 1 deletion template/clients/rust/clients/rust/Cargo.toml.njk
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ test-sbf = []
serde = ["dep:serde", "dep:serde_with"]

[dependencies]
anchor-lang = { version = "0.30.0", optional = true }
anchor-lang = { version = "{{ anchorVersion.full }}", optional = true }
borsh = "^0.10"
num-derive = "^0.3"
num-traits = "^0.2"
Expand Down
2 changes: 1 addition & 1 deletion template/shank/clients/js/clients/js/test/_setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {
setTransactionMessageFeePayerSigner,
setTransactionMessageLifetimeUsingBlockhash,
signTransactionMessageWithSigners,
} from '@solana/web3.js';
} from '@solana/kit';
import { findCounterPda, getCreateInstructionAsync } from '../src';

type Client = {
Expand Down
2 changes: 1 addition & 1 deletion template/shank/clients/js/clients/js/test/create.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {
Account,
appendTransactionMessageInstruction,
pipe,
} from '@solana/web3.js';
} from '@solana/kit';
import test from 'ava';
import {
Counter,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
isSolanaError,
lamports,
pipe,
} from '@solana/web3.js';
} from '@solana/kit';
import test from 'ava';
import {
{{ programName | snakeCase | upper }}_ERROR__INVALID_PDA,
Expand Down
5 changes: 4 additions & 1 deletion utils/renderContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,15 @@ export function getRenderContext({
const repositoryUrl = `https://github.com/${inputs.organizationName}/${inputs.targetDirectoryName}`;

// Versions.
const anchorVersion = resolveAnchorVersion(anchorVersionDetected);
const solanaVersion = resolveSolanaVersion(
language,
inputs.solanaVersion,
solanaVersionDetected
);
const anchorVersion = resolveAnchorVersion(
anchorVersionDetected,
solanaVersion
);
const rustVersion = resolveRustVersion(
language,
solanaVersion,
Expand Down
19 changes: 15 additions & 4 deletions utils/versionAnchor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
getVersionFromStdout,
ResolvedVersion,
Version,
VersionWithoutPatch,
} from './versionCore';

export async function detectAnchorVersion(
Expand All @@ -20,10 +21,20 @@ export async function detectAnchorVersion(
}

export function resolveAnchorVersion(
detectedVersion: Version | undefined
detectedVersion: Version | undefined,
solanaVersion: ResolvedVersion
): ResolvedVersion | undefined {
if (!detectedVersion) return undefined;
const [full, withoutPatch] =
getVersionAndVersionWithoutPatch(detectedVersion);
const fallbackVersionMap: Record<VersionWithoutPatch, Version> = {
'1.17': '0.29.0',
'1.18': '0.30.0',
'2.0': '0.30.0',
'2.1': '0.31.0',
'2.2': '0.31.0',
};
const fallbackVersion: Version =
fallbackVersionMap[solanaVersion.withoutPatch] ?? '0.30.0';
const [full, withoutPatch] = getVersionAndVersionWithoutPatch(
detectedVersion ?? fallbackVersion
);
return { full, withoutPatch, detected: detectedVersion };
}
6 changes: 5 additions & 1 deletion utils/versionRust.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,11 @@ export function resolveRustVersion(
'1.17': '1.75.0',
'1.18': '1.75.0',
'2.0': '1.75.0',
'2.1': '1.79.0',
'2.2': '1.79.0',
};
const fallbackVersion =
solanaToRustMap[solanaVersion.withoutPatch] ?? '1.75.0';
solanaToRustMap[solanaVersion.withoutPatch] ?? '1.79.0';

const version = inputVersion ?? detectedVersion ?? fallbackVersion;
assertIsValidVersion(language, 'Rust', version);
Expand All @@ -53,6 +55,8 @@ function warnAboutSolanaRustVersionMismatch(
'1.17': '1.68.0',
'1.18': '1.75.0',
'2.0': '1.75.0',
'2.1': '1.79.0',
'2.2': '1.79.0',
};
const minimumViableRustVersion: Version | undefined =
minimumViableRustVersionPerSolanaVersion[solanaVersion.withoutPatch];
Expand Down
1 change: 1 addition & 0 deletions utils/versionSolana.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export function resolveSolanaVersion(
const [full, withoutPatch] = getVersionAndVersionWithoutPatch(version, {
'1.17': '1.17.34',
'1.18': '1.18.18',
'2.1': '2.1.16',
});
return { full, withoutPatch, detected: detectedVersion };
}