|
| 1 | +name: Downstream Project - SPL |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + - v[0-9]+.[0-9]+ |
| 8 | + pull_request: |
| 9 | + branches: |
| 10 | + - master |
| 11 | + - v[0-9]+.[0-9]+ |
| 12 | + paths: |
| 13 | + - "**.rs" |
| 14 | + - "Cargo.toml" |
| 15 | + - "Cargo.lock" |
| 16 | + - "cargo-build-bpf" |
| 17 | + - "cargo-test-bpf" |
| 18 | + - "cargo-build-sbf" |
| 19 | + - "cargo-test-sbf" |
| 20 | + - "ci/downstream-projects/run-spl.sh" |
| 21 | + - ".github/workflows/downstream-project-spl.yml" |
| 22 | + workflow_call: |
| 23 | + inputs: |
| 24 | + branch: |
| 25 | + required: false |
| 26 | + type: string |
| 27 | + default: "master" |
| 28 | + |
| 29 | +env: |
| 30 | + SHELL: /bin/bash |
| 31 | + SCCACHE_GHA_ENABLED: "true" |
| 32 | + RUSTC_WRAPPER: "sccache" |
| 33 | + |
| 34 | +jobs: |
| 35 | + check: |
| 36 | + runs-on: ubuntu-latest |
| 37 | + steps: |
| 38 | + - uses: actions/checkout@v3 |
| 39 | + |
| 40 | + - shell: bash |
| 41 | + run: | |
| 42 | + .github/scripts/purge-ubuntu-runner.sh |
| 43 | +
|
| 44 | + - uses: mozilla-actions/sccache-action@v0.0.3 |
| 45 | + |
| 46 | + - shell: bash |
| 47 | + run: | |
| 48 | + source .github/scripts/downstream-project-spl-common.sh |
| 49 | +
|
| 50 | + sudo apt update |
| 51 | + sudo apt install libudev-dev binutils-dev libunwind-dev protobuf-compiler -y |
| 52 | +
|
| 53 | + cargo check |
| 54 | +
|
| 55 | + test: |
| 56 | + runs-on: ubuntu-latest |
| 57 | + strategy: |
| 58 | + matrix: |
| 59 | + arrays: |
| 60 | + [ |
| 61 | + { |
| 62 | + test_paths: ["token/cli"], |
| 63 | + required_programs: |
| 64 | + [ |
| 65 | + "token/program", |
| 66 | + "token/program-2022", |
| 67 | + "associated-token-account/program", |
| 68 | + ], |
| 69 | + }, |
| 70 | + { |
| 71 | + test_paths: ["single-pool/cli"], |
| 72 | + required_programs: |
| 73 | + [ |
| 74 | + "single-pool/program", |
| 75 | + ], |
| 76 | + }, |
| 77 | + { |
| 78 | + test_paths: ["token-upgrade/cli"], |
| 79 | + required_programs: |
| 80 | + [ |
| 81 | + "token-upgrade/program", |
| 82 | + ], |
| 83 | + }, |
| 84 | + ] |
| 85 | + steps: |
| 86 | + - uses: actions/checkout@v3 |
| 87 | + |
| 88 | + - shell: bash |
| 89 | + run: | |
| 90 | + .github/scripts/purge-ubuntu-runner.sh |
| 91 | +
|
| 92 | + - uses: mozilla-actions/sccache-action@v0.0.3 |
| 93 | + |
| 94 | + - shell: bash |
| 95 | + run: | |
| 96 | + source .github/scripts/downstream-project-spl-common.sh |
| 97 | +
|
| 98 | + sudo apt update |
| 99 | + sudo apt install libudev-dev binutils-dev libunwind-dev protobuf-compiler -y |
| 100 | +
|
| 101 | + programStr="${{ tojson(matrix.arrays.required_programs) }}" |
| 102 | + IFS=', ' read -ra programs <<<"${programStr//[\[\]$'\n'$'\r' ]/}" |
| 103 | + for program in "${programs[@]}"; do |
| 104 | + $CARGO_BUILD_SBF --manifest-path "$program"/Cargo.toml |
| 105 | + done |
| 106 | +
|
| 107 | + testPathsStr="${{ tojson(matrix.arrays.test_paths) }}" |
| 108 | + IFS=', ' read -ra test_paths <<<"${testPathsStr//[\[\]$'\n'$'\r' ]/}" |
| 109 | + for test_path in "${test_paths[@]}"; do |
| 110 | + cargo test --manifest-path "$test_path"/Cargo.toml |
| 111 | + done |
| 112 | +
|
| 113 | + cargo-test-sbf: |
| 114 | + runs-on: ubuntu-latest |
| 115 | + strategy: |
| 116 | + matrix: |
| 117 | + programs: |
| 118 | + - [token/program] |
| 119 | + - [ |
| 120 | + instruction-padding/program, |
| 121 | + token/program-2022, |
| 122 | + token/program-2022-test, |
| 123 | + ] |
| 124 | + - [ |
| 125 | + associated-token-account/program, |
| 126 | + associated-token-account/program-test, |
| 127 | + ] |
| 128 | + - [token-upgrade/program] |
| 129 | + - [feature-proposal/program] |
| 130 | + - [governance/addin-mock/program, governance/program] |
| 131 | + - [memo/program] |
| 132 | + - [name-service/program] |
| 133 | + - [stake-pool/program] |
| 134 | + - [single-pool/program] |
| 135 | + |
| 136 | + steps: |
| 137 | + - uses: actions/checkout@v3 |
| 138 | + |
| 139 | + - shell: bash |
| 140 | + run: | |
| 141 | + .github/scripts/purge-ubuntu-runner.sh |
| 142 | +
|
| 143 | + - uses: mozilla-actions/sccache-action@v0.0.3 |
| 144 | + |
| 145 | + - shell: bash |
| 146 | + run: | |
| 147 | + source .github/scripts/downstream-project-spl-common.sh |
| 148 | +
|
| 149 | + programStr="${{ tojson(matrix.programs) }}" |
| 150 | + IFS=', ' read -ra programs <<<"${programStr//[\[\]$'\n'$'\r' ]/}" |
| 151 | +
|
| 152 | + for program in "${programs[@]}"; do |
| 153 | + $CARGO_TEST_SBF --manifest-path "$program"/Cargo.toml |
| 154 | + done |
0 commit comments