Skip to content

Commit 683bb98

Browse files
authored
Bump CI to Rust 1.81.0 (#116)
1 parent f7b88fb commit 683bb98

File tree

13 files changed

+58
-39
lines changed

13 files changed

+58
-39
lines changed

.github/workflows/main.yml

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ env:
1010
ANCHOR_VERSION: 0.30.0
1111
NODE_VERSION : 20
1212
SOLANA_VERSION: 1.18.18
13-
TOOLCHAIN: 1.75.0
13+
TOOLCHAIN: 1.81.0
1414

1515
jobs:
1616
lint:
@@ -59,6 +59,19 @@ jobs:
5959
cache: "pnpm"
6060
- name: Install dependencies
6161
run: pnpm install --frozen-lockfile
62+
- name: Cache cargo crates
63+
uses: actions/cache@v4
64+
with:
65+
path: |
66+
~/.cargo/bin/
67+
~/.cargo/registry/index/
68+
~/.cargo/registry/cache/
69+
~/.cargo/git/db/
70+
./projects/**/.cargo/
71+
./projects/**/target/
72+
key: ${{ runner.os }}-crates-solana-v${{ matrix.solana }}-${{ hashFiles('projects/**/Cargo.lock') }}
73+
restore-keys: |
74+
${{ runner.os }}-crates-solana-v${{ matrix.solana }}
6275
- name: Install Solana
6376
uses: solana-program/actions/install-solana@v1
6477
with:
@@ -80,19 +93,6 @@ jobs:
8093
version: ${{ matrix.anchor }}
8194
- name: Pre-scaffold projects for caching purposes
8295
run: pnpm snapshot ${{ matrix.project }} --scaffold-only
83-
- name: Cache cargo crates
84-
uses: actions/cache@v4
85-
with:
86-
path: |
87-
~/.cargo/bin/
88-
~/.cargo/registry/index/
89-
~/.cargo/registry/cache/
90-
~/.cargo/git/db/
91-
./projects/**/.cargo/
92-
./projects/**/target/
93-
key: ${{ runner.os }}-crates-solana-v${{ matrix.solana }}-${{ hashFiles('projects/**/Cargo.lock') }}
94-
restore-keys: |
95-
${{ runner.os }}-crates-solana-v${{ matrix.solana }}
9696
- name: Build and run tests
9797
run: pnpm snapshot ${{ matrix.project }} --test
9898

@@ -118,16 +118,6 @@ jobs:
118118
cache: "pnpm"
119119
- name: Install Dependencies
120120
run: pnpm install --frozen-lockfile
121-
- name: Install Solana
122-
uses: solana-program/actions/install-solana@v1
123-
with:
124-
version: ${{ env.SOLANA_VERSION }}
125-
- name: Install Anchor
126-
uses: metaplex-foundation/actions/install-anchor-cli@v1
127-
with:
128-
version: ${{ env.ANCHOR_VERSION }}
129-
- name: Pre-scaffold projects for caching purposes
130-
run: pnpm snapshot --scaffold-only
131121
- name: Cache cargo crates
132122
uses: actions/cache@v4
133123
with:
@@ -141,6 +131,16 @@ jobs:
141131
key: ${{ runner.os }}-crates-solana-v${{ env.SOLANA_VERSION }}-${{ hashFiles('projects/**/Cargo.lock') }}
142132
restore-keys: |
143133
${{ runner.os }}-crates-solana-v${{ env.SOLANA_VERSION }}
134+
- name: Install Solana
135+
uses: solana-program/actions/install-solana@v1
136+
with:
137+
version: ${{ env.SOLANA_VERSION }}
138+
- name: Install Anchor
139+
uses: metaplex-foundation/actions/install-anchor-cli@v1
140+
with:
141+
version: ${{ env.ANCHOR_VERSION }}
142+
- name: Pre-scaffold projects for caching purposes
143+
run: pnpm snapshot --scaffold-only
144144
- name: Setup git user
145145
run: |
146146
git config --global user.email "github-actions[bot]@users.noreply.github.com"

template/anchor/clients/js/clients/js/test/_setup.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import {
2121
setTransactionMessageFeePayerSigner,
2222
setTransactionMessageLifetimeUsingBlockhash,
2323
signTransactionMessageWithSigners,
24-
} from '@solana/web3.js';
24+
} from '@solana/kit';
2525
import { getCreateInstruction } from '../src';
2626

2727
type Client = {

template/anchor/clients/js/clients/js/test/create.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {
33
appendTransactionMessageInstruction,
44
generateKeyPairSigner,
55
pipe,
6-
} from '@solana/web3.js';
6+
} from '@solana/kit';
77
import test from 'ava';
88
import { Counter, fetchCounter, getCreateInstruction } from '../src';
99
import {

template/anchor/clients/js/clients/js/test/increment.test.ts.njk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
isSolanaError,
77
lamports,
88
pipe,
9-
} from '@solana/web3.js';
9+
} from '@solana/kit';
1010
import test from 'ava';
1111
import {
1212
{{ programName | snakeCase | upper }}_ERROR__INVALID_AUTHORITY,

template/clients/js/clients/js/package.json.njk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,12 @@
4242
"homepage": "{{ repositoryUrl }}#readme",
4343
"license": "MIT",
4444
"peerDependencies": {
45-
"@solana/web3.js": "^2.0.0"
45+
"@solana/kit": "^2.1.0"
4646
},
4747
"devDependencies": {
4848
"@ava/typescript": "^4.1.0",
4949
"@solana/eslint-config-solana": "^3.0.3",
50-
"@solana/web3.js": "^2.0.0",
50+
"@solana/kit": "^2.1.0",
5151
"@types/node": "^20",
5252
"@typescript-eslint/eslint-plugin": "^7.16.1",
5353
"@typescript-eslint/parser": "^7.16.1",

template/clients/rust/clients/rust/Cargo.toml.njk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ test-sbf = []
1313
serde = ["dep:serde", "dep:serde_with"]
1414

1515
[dependencies]
16-
anchor-lang = { version = "0.30.0", optional = true }
16+
anchor-lang = { version = "{{ anchorVersion.full }}", optional = true }
1717
borsh = "^0.10"
1818
num-derive = "^0.3"
1919
num-traits = "^0.2"

template/shank/clients/js/clients/js/test/_setup.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import {
2222
setTransactionMessageFeePayerSigner,
2323
setTransactionMessageLifetimeUsingBlockhash,
2424
signTransactionMessageWithSigners,
25-
} from '@solana/web3.js';
25+
} from '@solana/kit';
2626
import { findCounterPda, getCreateInstructionAsync } from '../src';
2727

2828
type Client = {

template/shank/clients/js/clients/js/test/create.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import {
22
Account,
33
appendTransactionMessageInstruction,
44
pipe,
5-
} from '@solana/web3.js';
5+
} from '@solana/kit';
66
import test from 'ava';
77
import {
88
Counter,

template/shank/clients/js/clients/js/test/increment.test.ts.njk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
isSolanaError,
66
lamports,
77
pipe,
8-
} from '@solana/web3.js';
8+
} from '@solana/kit';
99
import test from 'ava';
1010
import {
1111
{{ programName | snakeCase | upper }}_ERROR__INVALID_PDA,

utils/renderContext.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,15 @@ export function getRenderContext({
5757
const repositoryUrl = `https://github.com/${inputs.organizationName}/${inputs.targetDirectoryName}`;
5858

5959
// Versions.
60-
const anchorVersion = resolveAnchorVersion(anchorVersionDetected);
6160
const solanaVersion = resolveSolanaVersion(
6261
language,
6362
inputs.solanaVersion,
6463
solanaVersionDetected
6564
);
65+
const anchorVersion = resolveAnchorVersion(
66+
anchorVersionDetected,
67+
solanaVersion
68+
);
6669
const rustVersion = resolveRustVersion(
6770
language,
6871
solanaVersion,

utils/versionAnchor.ts

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
getVersionFromStdout,
66
ResolvedVersion,
77
Version,
8+
VersionWithoutPatch,
89
} from './versionCore';
910

1011
export async function detectAnchorVersion(
@@ -20,10 +21,20 @@ export async function detectAnchorVersion(
2021
}
2122

2223
export function resolveAnchorVersion(
23-
detectedVersion: Version | undefined
24+
detectedVersion: Version | undefined,
25+
solanaVersion: ResolvedVersion
2426
): ResolvedVersion | undefined {
25-
if (!detectedVersion) return undefined;
26-
const [full, withoutPatch] =
27-
getVersionAndVersionWithoutPatch(detectedVersion);
27+
const fallbackVersionMap: Record<VersionWithoutPatch, Version> = {
28+
'1.17': '0.29.0',
29+
'1.18': '0.30.0',
30+
'2.0': '0.30.0',
31+
'2.1': '0.31.0',
32+
'2.2': '0.31.0',
33+
};
34+
const fallbackVersion: Version =
35+
fallbackVersionMap[solanaVersion.withoutPatch] ?? '0.30.0';
36+
const [full, withoutPatch] = getVersionAndVersionWithoutPatch(
37+
detectedVersion ?? fallbackVersion
38+
);
2839
return { full, withoutPatch, detected: detectedVersion };
2940
}

utils/versionRust.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,11 @@ export function resolveRustVersion(
2929
'1.17': '1.75.0',
3030
'1.18': '1.75.0',
3131
'2.0': '1.75.0',
32+
'2.1': '1.79.0',
33+
'2.2': '1.79.0',
3234
};
3335
const fallbackVersion =
34-
solanaToRustMap[solanaVersion.withoutPatch] ?? '1.75.0';
36+
solanaToRustMap[solanaVersion.withoutPatch] ?? '1.79.0';
3537

3638
const version = inputVersion ?? detectedVersion ?? fallbackVersion;
3739
assertIsValidVersion(language, 'Rust', version);
@@ -53,6 +55,8 @@ function warnAboutSolanaRustVersionMismatch(
5355
'1.17': '1.68.0',
5456
'1.18': '1.75.0',
5557
'2.0': '1.75.0',
58+
'2.1': '1.79.0',
59+
'2.2': '1.79.0',
5660
};
5761
const minimumViableRustVersion: Version | undefined =
5862
minimumViableRustVersionPerSolanaVersion[solanaVersion.withoutPatch];

utils/versionSolana.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export function resolveSolanaVersion(
3030
const [full, withoutPatch] = getVersionAndVersionWithoutPatch(version, {
3131
'1.17': '1.17.34',
3232
'1.18': '1.18.18',
33+
'2.1': '2.1.16',
3334
});
3435
return { full, withoutPatch, detected: detectedVersion };
3536
}

0 commit comments

Comments
 (0)