feat: upgrade co-build and complete transfer/melt mutant spore test c… #143
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Capsule build/test | |
on: | |
push: | |
pull_request: | |
paths: | |
- contracts/** | |
- lib/** | |
- tests/** | |
jobs: | |
capsule-build-and-test: | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- target: debug | |
cargo-option: "" | |
target-dir: "build/debug" | |
- target: testnet | |
cargo-option: "--release" | |
target-dir: "build/release" | |
- target: mainnet | |
cargo-option: "--release -- --features release_export" | |
target-dir: "build/release" | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Prepare capsule v0.10.2 | |
run: | | |
if [ ! -f "/tmp/capsule.tar.gz" ]; then | |
curl -L https://github.com/nervosnetwork/capsule/releases/download/v0.10.2/capsule_v0.10.2_x86_64-linux.tar.gz -o /tmp/capsule.tar.gz | |
fi | |
tar -zxf /tmp/capsule.tar.gz -C /tmp | |
echo "/tmp/capsule_v0.10.2_x86_64-linux" >> $GITHUB_PATH | |
- name: Install cross | |
run: cargo install cross --git https://github.com/cross-rs/cross | |
- name: Capsule build | |
run: capsule build ${{ matrix.cargo-option }} | |
- name: Capsule test | |
run: capsule test ${{ matrix.cargo-option }} | |
- name: List all the contract binaries of ${{ github.ref }} | |
run: ls -l ${{ matrix.target-dir }} | |
- name: Archive the contract binaries ${{ github.sha }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: contract-binaries-${{ matrix.target }}-${{ github.sha }} | |
path: | | |
build/debug | |
build/release | |
outputs: | |
spore-contract-ref: ${{ github.sha }} | |
record-code-hash: | |
needs: capsule-build-and-test | |
strategy: | |
matrix: | |
target: [debug, testnet, mainnet] | |
runs-on: ubuntu-20.04 | |
steps: | |
# TODO: add this codehash util into the `tests` directory | |
# or, simply use `ckb-cli util blake2b --binary-path ...` to get the codehash | |
- name: Checkout a code_hash tool | |
uses: actions/checkout@v4 | |
with: | |
repository: Flouse/spore-contract | |
ref: codehash-tool | |
- uses: actions/download-artifact@v4 | |
with: | |
name: contract-binaries-${{ matrix.target }}-${{ needs.capsule-build-and-test.outputs.spore-contract-ref }} | |
path: build | |
- name: Build codehash-tool | |
working-directory: build | |
run: cargo build | |
- name: Record code_hash of contract binaries | |
working-directory: build | |
run: | | |
echo "spore-contract-commit: ${{ needs.capsule-build-and-test.outputs.spore-contract-ref }}\n" | |
./target/debug/code_hash |