Skip to content

Commit c222cb0

Browse files
committed
feat: add continuous integration
1 parent 16b99f5 commit c222cb0

2 files changed

Lines changed: 128 additions & 1 deletion

File tree

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
name: CI
2+
3+
on: [push, pull_request]
4+
5+
permissions:
6+
contents: read
7+
pull-requests: write
8+
9+
jobs:
10+
changes:
11+
name: Detect changes
12+
runs-on: ubuntu-latest
13+
outputs:
14+
wallet: ${{ steps.filter.outputs.wallet }}
15+
protocol: ${{ steps.filter.outputs.protocol }}
16+
steps:
17+
- uses: actions/checkout@v4
18+
- name: Check changed paths
19+
id: filter
20+
uses: dorny/paths-filter@v3
21+
with:
22+
filters: |
23+
wallet:
24+
- 'wallet/**'
25+
protocol:
26+
- 'protocol/**'
27+
28+
wallet:
29+
name: Build and test wallet
30+
needs: changes
31+
if: needs.changes.outputs.wallet == 'true'
32+
runs-on: ubuntu-latest
33+
strategy:
34+
matrix:
35+
rust:
36+
- stable
37+
features:
38+
- --features default
39+
- --no-default-features
40+
- --all-features
41+
steps:
42+
- name: Checkout
43+
uses: actions/checkout@v4
44+
- name: Generate cache key
45+
run: echo "${{ matrix.rust }} ${{ matrix.features }}" | tee .cache_key
46+
- name: Cache
47+
uses: actions/cache@v4
48+
with:
49+
path: |
50+
~/.cargo/registry
51+
~/.cargo/git
52+
target
53+
key: ${{ runner.os }}-cargo-${{ hashFiles('.cache_key') }}-${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }}
54+
- name: Setup Rust Toolchain
55+
uses: actions-rs/toolchain@v1
56+
with:
57+
toolchain: ${{ matrix.rust }}
58+
profile: minimal
59+
override: true
60+
components: rustfmt, clippy
61+
62+
- name: Build
63+
run: cargo build ${{ matrix.features }}
64+
65+
- name: Clippy
66+
run: cargo clippy -- -D warnings
67+
68+
- name: Unit and Integration tests
69+
run: cargo test
70+
71+
protocol:
72+
name: Build and test protocol
73+
needs: changes
74+
if: needs.changes.outputs.protocol == 'true'
75+
runs-on: ubuntu-latest
76+
strategy:
77+
matrix:
78+
rust:
79+
- stable
80+
features:
81+
- --features default
82+
- --no-default-features
83+
- --all-features
84+
steps:
85+
- name: Checkout
86+
uses: actions/checkout@v4
87+
- name: Generate cache key
88+
run: echo "${{ matrix.rust }} ${{ matrix.features }}" | tee .cache_key
89+
- name: Cache
90+
uses: actions/cache@v4
91+
with:
92+
path: |
93+
~/.cargo/registry
94+
~/.cargo/git
95+
target
96+
key: ${{ runner.os }}-cargo-${{ hashFiles('.cache_key') }}-${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }}
97+
- name: Setup Rust Toolchain
98+
uses: actions-rs/toolchain@v1
99+
with:
100+
toolchain: ${{ matrix.rust }}
101+
profile: minimal
102+
override: true
103+
components: rustfmt, clippy
104+
- name: Build
105+
run: cargo build ${{ matrix.features }}
106+
- name: Clippy
107+
run: cargo clippy -- -D warnings
108+
- name: Unit and Integration tests
109+
run: cargo test
110+
111+
fmt:
112+
name: Rust fmt
113+
needs: changes
114+
if: needs.changes.outputs.wallet == 'true' || needs.changes.outputs.protocol == 'true'
115+
runs-on: ubuntu-latest
116+
steps:
117+
- name: Checkout
118+
uses: actions/checkout@v4
119+
- name: Setup Rust Toolchain
120+
uses: actions-rs/toolchain@v1
121+
with:
122+
toolchain: stable
123+
profile: minimal
124+
override: true
125+
components: rustfmt
126+
- name: Check fmt
127+
run: cargo fmt --all -- --check

testenv/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ impl TestEnv {
330330
pub fn bitcoin_core_rpc_client(&self) -> bitcoincore_rpc::Result<bitcoincore_rpc::Client> {
331331
let url = &self.bitcoind.rpc_url();
332332
let auth: Auth = Auth::CookieFile(self.bitcoind.params.cookie_file.clone());
333-
bitcoincore_rpc::Client::new(&url, auth)
333+
bitcoincore_rpc::Client::new(url, auth)
334334
}
335335

336336
/// Get the electrum URL

0 commit comments

Comments
 (0)