-
Notifications
You must be signed in to change notification settings - Fork 1
93 lines (79 loc) · 3.19 KB
/
tests.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
88
89
90
91
92
93
name: 'Code tests'
on:
pull_request:
types:
- opened
- edited
- reopened
- synchronize
- labeled
merge_group:
types: [checks_requested]
branches:
- main
env:
# When getting Rust dependencies, retry on network error:
CARGO_NET_RETRY: 10
# Use the local .curlrc
CURL_HOME: .
jobs:
rust_test:
name: 'rust-tests:required'
runs-on: ubuntu-latest
steps:
- name: 'Checkout'
uses: actions/checkout@v3
- name: Setup DFX
uses: dfinity/setup-dfx@main
with:
dfx-version: 'auto'
- name: Install PocketIC server
uses: dfinity/pocketic@main
with:
pocket-ic-server-version: '7.0.0'
- name: Confirm successful installation
run: ${POCKET_IC_BIN} --version
- name: Build canisters
run: dfx build --check
- name: Test Cargo crates
run: cargo test --all-features
motoko_tests:
name: 'motoko-tests:required'
runs-on: ubuntu-latest
steps:
- name: 'Checkout code'
uses: actions/checkout@v4
- name: Setup DFX
uses: dfinity/setup-dfx@main
with:
dfx-version: 'auto'
- name: 'Start DFX'
run: dfx start --background
- name: 'Test cns_root canister'
# NOTE: The functionality of cns_root depends on whether the caller is a controller or not,
# so we proceed in two steps. Initially the test canister (i.e. cns_root) is not a controller,
# so we test the behaviour for non-controller callers. Afterwards we make the test canister
# a controller of cns_root, and test the behaviour for controller callers.
run: |
dfx deploy --no-wallet cns_root_test
echo "Calling runTestsIfNotController on canister cns_root_test ..."
dfx canister call cns_root_test runTestsIfNotController "()"
echo "Adding cns_root_test-canister as a controller of cns_root-canister..."
dfx canister update-settings cns_root --add-controller `dfx canister id cns_root_test`
echo "Calling runTests on canister cns_root_test..."
dfx canister call cns_root_test runTests "()"
- name: 'Test tld_operator canister'
# NOTE: The functionality of tld_operator depends on whehter the caller is a controller or not,
# so we proceed in two steps. Initially the test canister (i.e. tld_operator_test) is not a controller,
# so we test the behaviour for non-controller callers. Afterwards we make the test canister
# a controller of tld_operator, and test the behaviour for controller callers.
run: |
dfx deploy --no-wallet tld_operator_test
echo "Calling runTestsIfNotController on canister tld_operator_test ..."
dfx canister call tld_operator_test runTestsIfNotController "()"
echo "Adding tld_operator_test-canister as a controller of tld_operator-canister..."
dfx canister update-settings tld_operator --add-controller `dfx canister id tld_operator_test`
echo "Calling runTests on canister tld_operator_test..."
dfx canister call tld_operator_test runTests "()"
- name: 'Stop DFX'
run: dfx stop