-
Notifications
You must be signed in to change notification settings - Fork 8
87 lines (76 loc) · 2.64 KB
/
capsule.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
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