-
Notifications
You must be signed in to change notification settings - Fork 40
118 lines (115 loc) · 3.57 KB
/
rust.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
on:
push:
branches:
- master
- 'testci/**'
pull_request:
name: Continuous integration
jobs:
lint:
name: lint
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- name: install clippy
run: rustup component add clippy
- name: Run clippy
run: cargo clippy -- -D warnings
fmt:
name: rustfmt-check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- name: Check format
run: cargo fmt --all --check
no-std:
name: no-std lint
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- name: install clippy
run: rustup component add clippy
- name: Run clippy dlc
run: cargo clippy --no-default-features --features no-std -p dlc -- -D warnings
- name: Run clippy dlc-messages
run: cargo clippy --no-default-features --features no-std -p dlc-messages -- -D warnings
- name: Run clippy dlc-trie
run: cargo clippy --no-default-features --features no-std -p dlc-trie -- -D warnings
unit-tests:
name: unit-tests
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- name: Build
run: cargo build --verbose
- name: Test
run: cargo test --verbose --all-features
integration_tests_prepare:
runs-on: ubuntu-latest
timeout-minutes: 30
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/cache@v3
env:
cache-name: test-cache
with:
path: target/debug/deps
key: test-cache-${{ github.run_id }}-${{ github.run_number }}
- uses: actions/checkout@v4
- id: set-matrix
run: cargo test --no-run && echo "::set-output name=matrix::$(scripts/get_test_list.sh execution manager channel_execution)"
integration_tests:
name: integration-tests
needs: integration_tests_prepare
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
matrix:
tests: ${{ fromJson(needs.integration_tests_prepare.outputs.matrix) }}
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v3
env:
cache-name: test-cache
with:
path: target/debug/deps
key: test-cache-${{ github.run_id }}-${{ github.run_number }}
- name: Start bitcoin node
run: docker compose up -d
- name: Wait for container to run
run: ./scripts/wait_for_container.sh bitcoin-node
- name: Wait for electrs to be ready
run: ./scripts/wait_for_electrs.sh
- name: Run test
run: RUST_BACKTRACE=1 ${{ matrix.tests }} --ignored
- name: Stop bitcoin node
run: ./scripts/stop_node.sh
sample_test:
name: sample-test
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- name: Start environment
run: docker compose --profile oracle up -d
- name: Wait for container to run
run: ./scripts/wait_for_container.sh oracle-server
- name: Wait for electrs to be ready
run: ./scripts/wait_for_electrs.sh
- name: Create wallets
run: docker exec bitcoin-node /scripts/create_wallets.sh
- name: Run test
run: |
if ! cargo test -- --ignored sample; then
cat sample/dlc_sample_alice/.dlc/logs/logs.txt
cat sample/dlc_sample_bob/.dlc/logs/logs.txt
exit 1
fi