Skip to content

Commit 1383d53

Browse files
authored
CI: Update downstream SPL to program-specific repos (#4371)
* CI: Update downstream SPL to program-specific repos #### Problem SPL has been split up into multiple program-specific repos and will soon be archived, but the downstream jobs are still run against the SPL repo. #### Summary of changes Rather than use the SPL repo, check out the individual program-specific repos and run `check`, `build-sbf`, and `test`. Once other PRs land, we can add back other programs and repos. * Shellcheck * Add token-2022 since it was just fixed
1 parent dc67bdc commit 1383d53

4 files changed

+46
-75
lines changed

.github/scripts/downstream-project-spl-common.sh

+8-6
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,27 @@
22
set -e
33

44
here="$(dirname "${BASH_SOURCE[0]}")"
5+
program="$1"
56

67
#shellcheck source=ci/downstream-projects/common.sh
78
source "$here"/../../ci/downstream-projects/common.sh
89

910
set -x
10-
rm -rf spl
11-
git clone https://github.com/solana-labs/solana-program-library.git spl
11+
rm -rf "${program}"
12+
git clone https://github.com/solana-program/"${program}".git
1213

1314
# copy toolchain file to use solana's rust version
14-
cp "$SOLANA_DIR"/rust-toolchain.toml spl/
15-
cd spl || exit 1
15+
cp "$SOLANA_DIR"/rust-toolchain.toml "${program}"/
16+
cd "${program}" || exit 1
1617
echo "HEAD: $(git rev-parse HEAD)"
1718

18-
project_used_solana_version=$(sed -nE 's/solana-sdk = \"[>=<~]*(.*)\"/\1/p' <"token/program/Cargo.toml")
19+
project_used_solana_version=$(sed -nE 's/solana = \"(.*)\"/\1/p' <"Cargo.toml")
1920
echo "used solana version: $project_used_solana_version"
2021
if semverGT "$project_used_solana_version" "$SOLANA_VER"; then
2122
echo "skip"
2223
export SKIP_SPL_DOWNSTREAM_PROJECT_TEST=1
2324
return
2425
fi
2526

26-
./patch.crates-io.sh "$SOLANA_DIR"
27+
update_solana_dependencies . "$SOLANA_VER"
28+
patch_crates_io_solana Cargo.toml "$SOLANA_DIR"

.github/scripts/downstream-project-spl-install-deps.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
set -e
33

44
sudo apt-get update
5-
sudo apt-get install libudev-dev binutils-dev libunwind-dev protobuf-compiler -y
5+
sudo apt-get install libudev-dev protobuf-compiler -y

.github/workflows/downstream-project-anchor.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ env:
3838

3939
jobs:
4040
test:
41-
if: github.repository == 'anza-xyz/agave'
41+
#if: github.repository == 'anza-xyz/agave'
42+
if: false # restore once all program-specific repos are ready
4243
runs-on: ubuntu-latest
4344
strategy:
4445
matrix:

.github/workflows/downstream-project-spl.yml

+35-67
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,20 @@ jobs:
3939
check:
4040
if: github.repository == 'anza-xyz/agave'
4141
runs-on: ubuntu-latest
42+
strategy:
43+
matrix:
44+
programs:
45+
- associated-token-account
46+
- feature-proposal
47+
- instruction-padding
48+
- memo
49+
- record
50+
- single-pool
51+
- slashing
52+
- stake-pool
53+
- token-2022
54+
# re-enable with https://github.com/buffalojoec/mollusk/pull/74
55+
# - token
4256
steps:
4357
- uses: actions/checkout@v4
4458

@@ -53,45 +67,20 @@ jobs:
5367
- shell: bash
5468
run: |
5569
source .github/scripts/downstream-project-spl-install-deps.sh
56-
source .github/scripts/downstream-project-spl-common.sh
70+
source .github/scripts/downstream-project-spl-common.sh "${{ matrix.programs }}"
5771
if [ -n "$SKIP_SPL_DOWNSTREAM_PROJECT_TEST" ]; then
5872
exit 0
5973
fi
60-
6174
cargo check
6275
63-
test:
76+
test_cli:
6477
if: github.repository == 'anza-xyz/agave'
6578
runs-on: ubuntu-latest
6679
strategy:
6780
matrix:
68-
arrays:
69-
[
70-
{
71-
test_paths: ["token/cli"],
72-
required_programs:
73-
[
74-
"token/program",
75-
"token/program-2022",
76-
"associated-token-account/program",
77-
"instruction-padding/program",
78-
],
79-
},
80-
{
81-
test_paths: ["single-pool/cli"],
82-
required_programs:
83-
[
84-
"single-pool/program",
85-
],
86-
},
87-
{
88-
test_paths: ["token-upgrade/cli"],
89-
required_programs:
90-
[
91-
"token-upgrade/program",
92-
],
93-
},
94-
]
81+
programs:
82+
- single-pool
83+
- token-2022
9584
steps:
9685
- uses: actions/checkout@v4
9786

@@ -106,45 +95,30 @@ jobs:
10695
- shell: bash
10796
run: |
10897
source .github/scripts/downstream-project-spl-install-deps.sh
109-
source .github/scripts/downstream-project-spl-common.sh
98+
source .github/scripts/downstream-project-spl-common.sh "${{ matrix.programs }}"
11099
if [ -n "$SKIP_SPL_DOWNSTREAM_PROJECT_TEST" ]; then
111100
exit 0
112101
fi
113-
114-
programStr="${{ tojson(matrix.arrays.required_programs) }}"
115-
IFS=', ' read -ra programs <<<"${programStr//[\[\]$'\n'$'\r' ]/}"
116-
for program in "${programs[@]}"; do
117-
$CARGO_BUILD_SBF --manifest-path "$program"/Cargo.toml
118-
done
119-
120-
testPathsStr="${{ tojson(matrix.arrays.test_paths) }}"
121-
IFS=', ' read -ra test_paths <<<"${testPathsStr//[\[\]$'\n'$'\r' ]/}"
122-
for test_path in "${test_paths[@]}"; do
123-
cargo test --manifest-path "$test_path"/Cargo.toml
124-
done
102+
$CARGO_BUILD_SBF --manifest-path program/Cargo.toml
103+
cargo test --manifest-path clients/cli/Cargo.toml
125104
126105
cargo-test-sbf:
127106
if: github.repository == 'anza-xyz/agave'
128107
runs-on: ubuntu-latest
129108
strategy:
130109
matrix:
131110
programs:
132-
- [token/program]
133-
- [
134-
instruction-padding/program,
135-
token/program-2022,
136-
token/program-2022-test,
137-
]
138-
- [
139-
associated-token-account/program,
140-
associated-token-account/program-test,
141-
]
142-
- [token-upgrade/program]
143-
- [feature-proposal/program]
144-
- [governance/addin-mock/program, governance/program]
145-
- [name-service/program]
146-
- [stake-pool/program]
147-
- [single-pool/program]
111+
- associated-token-account
112+
- feature-proposal
113+
- instruction-padding
114+
- memo
115+
- record
116+
- single-pool
117+
- slashing
118+
- stake-pool
119+
- token-2022
120+
# re-enable with https://github.com/buffalojoec/mollusk/pull/74
121+
# - token
148122
steps:
149123
- uses: actions/checkout@v4
150124

@@ -159,14 +133,8 @@ jobs:
159133
- shell: bash
160134
run: |
161135
source .github/scripts/downstream-project-spl-install-deps.sh
162-
source .github/scripts/downstream-project-spl-common.sh
136+
source .github/scripts/downstream-project-spl-common.sh "${{ matrix.programs }}"
163137
if [ -n "$SKIP_SPL_DOWNSTREAM_PROJECT_TEST" ]; then
164138
exit 0
165139
fi
166-
167-
programStr="${{ tojson(matrix.programs) }}"
168-
IFS=', ' read -ra programs <<<"${programStr//[\[\]$'\n'$'\r' ]/}"
169-
170-
for program in "${programs[@]}"; do
171-
$CARGO_TEST_SBF --manifest-path "$program"/Cargo.toml
172-
done
140+
$CARGO_TEST_SBF --manifest-path program/Cargo.toml

0 commit comments

Comments
 (0)