Skip to content
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

CI: Update downstream SPL to program-specific repos #4371

Merged
merged 3 commits into from
Jan 10, 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
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
Loading