Skip to content

Commit

Permalink
CI: Update downstream SPL to program-specific repos (#4371)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
joncinque authored Jan 10, 2025
1 parent dc67bdc commit 1383d53
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 75 deletions.
14 changes: 8 additions & 6 deletions .github/scripts/downstream-project-spl-common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,27 @@
set -e

here="$(dirname "${BASH_SOURCE[0]}")"
program="$1"

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

set -x
rm -rf spl
git clone https://github.com/solana-labs/solana-program-library.git spl
rm -rf "${program}"
git clone https://github.com/solana-program/"${program}".git

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

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

./patch.crates-io.sh "$SOLANA_DIR"
update_solana_dependencies . "$SOLANA_VER"
patch_crates_io_solana Cargo.toml "$SOLANA_DIR"
2 changes: 1 addition & 1 deletion .github/scripts/downstream-project-spl-install-deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
set -e

sudo apt-get update
sudo apt-get install libudev-dev binutils-dev libunwind-dev protobuf-compiler -y
sudo apt-get install libudev-dev protobuf-compiler -y
3 changes: 2 additions & 1 deletion .github/workflows/downstream-project-anchor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ env:

jobs:
test:
if: github.repository == 'anza-xyz/agave'
#if: github.repository == 'anza-xyz/agave'
if: false # restore once all program-specific repos are ready
runs-on: ubuntu-latest
strategy:
matrix:
Expand Down
102 changes: 35 additions & 67 deletions .github/workflows/downstream-project-spl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,20 @@ jobs:
check:
if: github.repository == 'anza-xyz/agave'
runs-on: ubuntu-latest
strategy:
matrix:
programs:
- associated-token-account
- feature-proposal
- instruction-padding
- memo
- record
- single-pool
- slashing
- stake-pool
- token-2022
# re-enable with https://github.com/buffalojoec/mollusk/pull/74
# - token
steps:
- uses: actions/checkout@v4

Expand All @@ -53,45 +67,20 @@ jobs:
- shell: bash
run: |
source .github/scripts/downstream-project-spl-install-deps.sh
source .github/scripts/downstream-project-spl-common.sh
source .github/scripts/downstream-project-spl-common.sh "${{ matrix.programs }}"
if [ -n "$SKIP_SPL_DOWNSTREAM_PROJECT_TEST" ]; then
exit 0
fi
cargo check
test:
test_cli:
if: github.repository == 'anza-xyz/agave'
runs-on: ubuntu-latest
strategy:
matrix:
arrays:
[
{
test_paths: ["token/cli"],
required_programs:
[
"token/program",
"token/program-2022",
"associated-token-account/program",
"instruction-padding/program",
],
},
{
test_paths: ["single-pool/cli"],
required_programs:
[
"single-pool/program",
],
},
{
test_paths: ["token-upgrade/cli"],
required_programs:
[
"token-upgrade/program",
],
},
]
programs:
- single-pool
- token-2022
steps:
- uses: actions/checkout@v4

Expand All @@ -106,45 +95,30 @@ jobs:
- shell: bash
run: |
source .github/scripts/downstream-project-spl-install-deps.sh
source .github/scripts/downstream-project-spl-common.sh
source .github/scripts/downstream-project-spl-common.sh "${{ matrix.programs }}"
if [ -n "$SKIP_SPL_DOWNSTREAM_PROJECT_TEST" ]; then
exit 0
fi
programStr="${{ tojson(matrix.arrays.required_programs) }}"
IFS=', ' read -ra programs <<<"${programStr//[\[\]$'\n'$'\r' ]/}"
for program in "${programs[@]}"; do
$CARGO_BUILD_SBF --manifest-path "$program"/Cargo.toml
done
testPathsStr="${{ tojson(matrix.arrays.test_paths) }}"
IFS=', ' read -ra test_paths <<<"${testPathsStr//[\[\]$'\n'$'\r' ]/}"
for test_path in "${test_paths[@]}"; do
cargo test --manifest-path "$test_path"/Cargo.toml
done
$CARGO_BUILD_SBF --manifest-path program/Cargo.toml
cargo test --manifest-path clients/cli/Cargo.toml
cargo-test-sbf:
if: github.repository == 'anza-xyz/agave'
runs-on: ubuntu-latest
strategy:
matrix:
programs:
- [token/program]
- [
instruction-padding/program,
token/program-2022,
token/program-2022-test,
]
- [
associated-token-account/program,
associated-token-account/program-test,
]
- [token-upgrade/program]
- [feature-proposal/program]
- [governance/addin-mock/program, governance/program]
- [name-service/program]
- [stake-pool/program]
- [single-pool/program]
- associated-token-account
- feature-proposal
- instruction-padding
- memo
- record
- single-pool
- slashing
- stake-pool
- token-2022
# re-enable with https://github.com/buffalojoec/mollusk/pull/74
# - token
steps:
- uses: actions/checkout@v4

Expand All @@ -159,14 +133,8 @@ jobs:
- shell: bash
run: |
source .github/scripts/downstream-project-spl-install-deps.sh
source .github/scripts/downstream-project-spl-common.sh
source .github/scripts/downstream-project-spl-common.sh "${{ matrix.programs }}"
if [ -n "$SKIP_SPL_DOWNSTREAM_PROJECT_TEST" ]; then
exit 0
fi
programStr="${{ tojson(matrix.programs) }}"
IFS=', ' read -ra programs <<<"${programStr//[\[\]$'\n'$'\r' ]/}"
for program in "${programs[@]}"; do
$CARGO_TEST_SBF --manifest-path "$program"/Cargo.toml
done
$CARGO_TEST_SBF --manifest-path program/Cargo.toml

0 comments on commit 1383d53

Please sign in to comment.