-
Notifications
You must be signed in to change notification settings - Fork 76
128 lines (113 loc) · 4.1 KB
/
ic-ref.yml
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
name: ic-ref
on:
push:
branches:
- main
pull_request:
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
build: [linux-stable]
include:
- build: linux-stable
ic-hs-ref: "3d71032e"
wallet-tag: "20230308"
os: ubuntu-latest
rust: "1.71.1"
steps:
- uses: actions/setup-node@v3
with:
node-version: 16
- uses: actions/checkout@v2
with:
path: main
- name: Cargo cache
uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install Rust
run: |
rustup update ${{ matrix.rust }} --no-self-update
rustup default ${{ matrix.rust }}
rustup target add wasm32-unknown-unknown
- name: Download cycles-wallet canister
run: |
wget https://github.com/dfinity/cycles-wallet/releases/download/${{ matrix.wallet-tag }}/wallet.wasm
mv wallet.wasm $HOME/wallet.wasm
- name: Download ic-ref and universal-canister
run: |
wget https://download.dfinity.systems/ic-ref/ic-ref-0.0.1-${{ matrix.ic-hs-ref }}-x86_64-linux.tar.gz
tar -xvf ic-ref-0.0.1-${{ matrix.ic-hs-ref }}-x86_64-linux.tar.gz ic-ref
mkdir -p $HOME/bin
mv ic-ref $HOME/bin/ic-ref
wget https://download.dfinity.systems/ic-ref/ic-ref-test-0.0.1-${{ matrix.ic-hs-ref }}-x86_64-linux.tar.gz
tar -xvf ic-ref-test-0.0.1-${{ matrix.ic-hs-ref }}-x86_64-linux.tar.gz test-data/universal-canister.wasm
mv test-data/universal-canister.wasm $HOME/canister.wasm
- name: Run Integration Tests
run: |
set -ex
$HOME/bin/ic-ref --pick-port --write-port-to $HOME/ic_ref_port &
sleep 1
export IC_REF_PORT=$(cat $HOME/ic_ref_port)
export IC_UNIVERSAL_CANISTER_PATH=$HOME/canister.wasm
export IC_WALLET_CANISTER_PATH=$HOME/wallet.wasm
cd main
cargo test --all-features -- --ignored
killall ic-ref
env:
RUST_BACKTRACE: 1
- name: Install and Configure SoftHSM
run: |
set -ex
sudo apt-get install -f libsofthsm2 opensc-pkcs11 opensc
sudo usermod -a -G softhsm $USER
echo "SOFTHSM2_CONF=$HOME/softhsm.conf" >>$GITHUB_ENV
echo "directories.tokendir = $HOME/softhsm/tokens/" >$HOME/softhsm.conf
mkdir -p $HOME/softhsm/tokens
- name: Run Integration Tests with SoftHSM
run: |
set -ex
softhsm2-util --init-token --slot $HSM_SLOT_INDEX --label "agent-rs-token" --so-pin $HSM_SO_PIN --pin $HSM_PIN
# create key:
pkcs11-tool -k --module $HSM_PKCS11_LIBRARY_PATH --login --slot-index $HSM_SLOT_INDEX -d $HSM_KEY_ID --key-type EC:prime256v1 --pin $HSM_PIN
$HOME/bin/ic-ref --pick-port --write-port-to $HOME/ic_ref_port &
sleep 1
export IC_REF_PORT=$(cat $HOME/ic_ref_port)
export IC_UNIVERSAL_CANISTER_PATH=$HOME/canister.wasm
export IC_WALLET_CANISTER_PATH=$HOME/wallet.wasm
cd main/ref-tests
cargo test --all-features -- --ignored --nocapture --test-threads=1
killall ic-ref
env:
RUST_BACKTRACE: 1
HSM_PKCS11_LIBRARY_PATH: /usr/lib/softhsm/libsofthsm2.so
HSM_SO_PIN: 123456
HSM_PIN: 1234
HSM_SLOT_INDEX: 0
HSM_KEY_ID: abcdef
- name: Run Doc Tests
run: |
set -ex
$HOME/bin/ic-ref --pick-port --write-port-to $HOME/ic_ref_port &
sleep 1
export IC_REF_PORT=$(cat $HOME/ic_ref_port)
cd main
cargo test --all-features --doc -- --ignored
killall ic-ref
env:
RUST_BACKTRACE: 1
aggregate:
name: ic-ref:required
runs-on: ubuntu-latest
if: ${{ always() }}
needs: test
steps:
- name: Check ic-ref result
if: ${{ needs.test.result != 'success' }}
run: exit 1