Skip to content

Commit d8fadb9

Browse files
authored
Merge branch 'solana-foundation:master' into master
2 parents debf346 + 81d749b commit d8fadb9

File tree

344 files changed

+13947
-5593
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

344 files changed

+13947
-5593
lines changed

.cspell-anchor-dictionary.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ Solang
8484
solpg
8585
Solpg
8686
stdsimd
87+
surfpool
88+
Surfpool
8789
syscall
8890
syscalls
8991
sysvar

.git-blame-ignore-revs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
62865c636aecc6974fc9cfebfc6cf08ca4f0bb72

.github/actions/setup-surfpool/action.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@ runs:
2222
retry_on: error
2323
shell: bash
2424
command: |
25+
set -euxo pipefail
2526
echo "Installing Surfpool version ${{ env.SURFPOOL_CLI_VERSION }}"
26-
curl -sL https://run.surfpool.run/ | bash
27+
curl -sL https://run.surfpool.run/ | VERSION=v${{ env.SURFPOOL_CLI_VERSION }} bash
2728
echo "$HOME/.local/bin" >> $GITHUB_PATH
2829
echo "$PATH"
2930
ls -al $HOME/.local/bin

.github/pull_request_template.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
## Summary
2+
3+
Describe the change and why it is needed.
4+
5+
## Branch Target
6+
7+
If this contains breaking changes, it should target the `anchor-next` branch.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/usr/bin/env bash
2+
3+
# Asserts that the solana-program version in `cli/solana-program-version`
4+
# matches the version declared in the workspace `Cargo.toml`.
5+
#
6+
# This prevents the hardcoded version used for the duplicate-dependency check
7+
# from drifting out of sync when the workspace dependency is bumped.
8+
9+
set -euo pipefail
10+
11+
CARGO_TOML="Cargo.toml"
12+
VERSION_FILE="cli/solana-program-version"
13+
14+
if [[ ! -f "$VERSION_FILE" ]]; then
15+
echo "[!] Version file '$VERSION_FILE' not found" >&2
16+
exit 1
17+
fi
18+
19+
cargo_version=$(grep '^solana-program = ' "$CARGO_TOML" | sed 's/^solana-program = "\([^"]*\)".*/\1/')
20+
file_version=$(cat "$VERSION_FILE")
21+
22+
if [[ "$cargo_version" != "$file_version" ]]; then
23+
echo "[!] Version mismatch:" >&2
24+
echo " $CARGO_TOML: solana-program = \"$cargo_version\"" >&2
25+
echo " $VERSION_FILE: \"$file_version\"" >&2
26+
echo " Please update $VERSION_FILE to match $CARGO_TOML" >&2
27+
exit 1
28+
fi
29+
30+
echo "[+] solana-program version matches ($file_version)"

.github/scripts/publish-npmjs.sh

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
#!/usr/bin/env bash
2+
3+
set -xeuo pipefail
4+
5+
publish() {
6+
local dir="$1"
7+
pushd "$dir" >/dev/null
8+
9+
local name version
10+
name="$(node -p "require('./package.json').name")"
11+
version="$(node -p "require('./package.json').version")"
12+
13+
# We still build the package even if we don't publish it, as yarn workspace will
14+
# use the local version of each package, and if it's unbuilt then any subsequent
15+
# build will error out due to missing files.
16+
yarn --frozen-lockfile
17+
local dirname
18+
dirname="$(basename "$dir")"
19+
if [[ "$dirname" == spl-* ]]; then
20+
yarn build:npm
21+
else
22+
yarn build
23+
fi
24+
25+
if npm view "${name}@${version}" version >/dev/null 2>&1; then
26+
echo "The package $dir is already up to date, skipping"
27+
popd >/dev/null
28+
return 0
29+
fi
30+
31+
local publish_args=()
32+
# If version looks like X.Y.Z-<something> (e.g. 1.0.0-rc.2), publish under dist-tag "next"
33+
if [[ "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+-.+ ]]; then
34+
publish_args+=(--tag next)
35+
fi
36+
37+
if [[ "${DRY_RUN:-false}" == "true" ]]; then
38+
echo "Publishing $dir (${name}@${version}) as a dry-run"
39+
npm publish "${publish_args[@]}" --dry-run
40+
else
41+
echo "Publishing $dir (${name}@${version})"
42+
npm publish "${publish_args[@]}" --provenance --access public
43+
fi
44+
45+
popd >/dev/null
46+
}
47+
48+
base="ts/packages"
49+
50+
publish "$base/borsh"
51+
publish "$base/anchor-errors"
52+
publish "$base/anchor"
53+
#publish "$base/spl-associated-token-account"
54+
#publish "$base/spl-binary-option"
55+
#publish "$base/spl-binary-oracle-pair"
56+
#publish "$base/spl-feature-proposal"
57+
#publish "$base/spl-governance"
58+
#publish "$base/spl-memo"
59+
#publish "$base/spl-name-service"
60+
#publish "$base/spl-record"
61+
#publish "$base/spl-stake-pool"
62+
#publish "$base/spl-stateless-asks"
63+
publish "$base/spl-token"
64+
#publish "$base/spl-token-lending"
65+
#publish "$base/spl-token-swap"

.github/workflows/build-cli.yaml

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
name: Build CLI
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
dry_run:
7+
description: "If true, use 'dry-run' as the version string instead of the tag"
8+
required: true
9+
type: boolean
10+
dist:
11+
description: "Directory name for distribution artifacts (e.g. dist-v1.2.3 or dist-dry-run)"
12+
required: true
13+
type: string
14+
15+
jobs:
16+
build-cli:
17+
name: Build binaries${{ inputs.dry_run && ' (dry-run)' || '' }} (${{matrix.os}})
18+
runs-on: ${{ matrix.os }}
19+
permissions:
20+
contents: read
21+
id-token: write
22+
attestations: write
23+
24+
strategy:
25+
matrix:
26+
target:
27+
- aarch64-apple-darwin
28+
- x86_64-unknown-linux-gnu
29+
- x86_64-apple-darwin
30+
- x86_64-pc-windows-msvc
31+
include:
32+
- target: aarch64-apple-darwin
33+
os: macos-latest
34+
35+
- target: x86_64-unknown-linux-gnu
36+
os: ubuntu-latest
37+
38+
- target: x86_64-apple-darwin
39+
os: macos-latest
40+
41+
- target: x86_64-pc-windows-msvc
42+
os: windows-latest
43+
44+
steps:
45+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
46+
47+
- uses: dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9 # v1
48+
with:
49+
toolchain: stable
50+
target: ${{ matrix.target }}
51+
52+
- name: Install dependencies (Linux)
53+
if: runner.os == 'Linux'
54+
run: sudo apt-get update && sudo apt-get install -y libudev-dev
55+
56+
# FIXME: The global system LLVM on GitHub is very outdated, and LTO causes link errors
57+
- name: Build release binary (macOS)
58+
if: runner.os == 'macOS'
59+
env:
60+
CARGO_PROFILE_RELEASE_LTO: "off"
61+
RUSTFLAGS: -C embed-bitcode=no
62+
run: cargo build --package anchor-cli --release --locked --target ${{ matrix.target }}
63+
64+
- name: Build release binary
65+
if: runner.os != 'macOS'
66+
run: cargo build --package anchor-cli --release --locked --target ${{ matrix.target }}
67+
68+
- name: Prepare
69+
id: prepare
70+
shell: bash
71+
run: |
72+
if [[ "${{ inputs.dry_run }}" == "true" ]]; then
73+
version="dry-run"
74+
else
75+
version=$(echo $GITHUB_REF_NAME | cut -dv -f2)
76+
fi
77+
ext=""
78+
[[ "${{ matrix.os }}" == windows-latest ]] && ext=".exe"
79+
80+
mkdir ${{ inputs.dist }}
81+
mv "target/${{ matrix.target }}/release/anchor$ext" ${{ inputs.dist }}/anchor-$version-${{ matrix.target }}$ext
82+
83+
echo "version=$version" >> $GITHUB_OUTPUT
84+
85+
- name: Attest build provenance
86+
# `id-token: write` is not granted for PRs from forks
87+
if: ${{ github.event.pull_request.head.repo.fork != true }}
88+
uses: actions/attest-build-provenance@96278af6caaf10aea03fd8d33a09a777ca52d62f # v3.2.0
89+
with:
90+
subject-path: ${{ inputs.dist }}/anchor-${{ steps.prepare.outputs.version }}-${{ matrix.target }}*
91+
92+
- uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
93+
with:
94+
name: anchor-${{ steps.prepare.outputs.version }}-${{ matrix.target }}
95+
path: ${{ inputs.dist }}
96+
overwrite: true
97+
retention-days: 1

.github/workflows/no-caching-tests.yaml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,8 @@ jobs:
1313
uses: ./.github/workflows/reusable-tests.yaml
1414
with:
1515
cache: false
16-
solana_version: 3.0.0
16+
solana_version: 3.1.10
1717
node_version: 20.18.0
1818
cargo_profile: release
1919
anchor_binary_name: anchor-binary-no-caching
20-
# TODO: currently this value is only used to invalidate the cache and install latest, it is not
21-
# actually installing the specified version.
22-
# Issue: https://github.com/solana-foundation/anchor/issues/4160
23-
surfpool_cli_version: 1.0.0-rc1
20+
surfpool_cli_version: 1.1.1
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: Prepare Release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: "Version to bump to without the v[...] prefix (e.g. 1.0.0-rc.5)"
8+
required: true
9+
type: string
10+
11+
permissions:
12+
contents: write
13+
14+
jobs:
15+
prepare-release:
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
20+
with:
21+
fetch-depth: 0
22+
23+
- name: Force fetch upstream tags
24+
run: git fetch --tags --force
25+
26+
- uses: dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9 # v1
27+
with:
28+
toolchain: stable
29+
30+
- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
31+
with:
32+
node-version: "24"
33+
registry-url: "https://registry.npmjs.org"
34+
package-manager-cache: false
35+
36+
- name: Enable corepack (yarn)
37+
run: corepack enable
38+
39+
- uses: ./.github/actions/setup-solana/
40+
env:
41+
SOLANA_VERSION: "3.1.10"
42+
43+
- uses: ./.github/actions/setup-surfpool/
44+
env:
45+
SURFPOOL_CLI_VERSION: "1.1.1"
46+
47+
- name: Install cargo-release
48+
run: cargo install cargo-release --version 1.1.1 --locked
49+
50+
- name: Bump version
51+
env:
52+
VERSION: ${{ inputs.version }}
53+
run: |
54+
set -xeou pipefail
55+
56+
./setup-tests.sh
57+
./bump-version.sh "$VERSION"
58+
59+
# I would love to automatically create a PR here, but GitHub does not allow triggering CI jobs
60+
# on automatically created PRs to prevent recursion
61+
- name: Create release branch
62+
env:
63+
VERSION: ${{ inputs.version }}
64+
run: |
65+
set -xeou pipefail
66+
67+
BRANCH="release/v$VERSION"
68+
69+
git config user.name "github-actions[bot]"
70+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
71+
72+
git checkout -b "$BRANCH"
73+
git add -A
74+
git commit -m "v$VERSION"
75+
git push --set-upstream origin "$BRANCH"

0 commit comments

Comments
 (0)