-
Notifications
You must be signed in to change notification settings - Fork 23
149 lines (139 loc) · 4.67 KB
/
ci.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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
name: CI
on:
pull_request:
push:
branches:
- "staging"
- "main"
env:
CARGO_INCREMENTAL: 0
CARGO_TERM_COLOR: always
jobs:
formatting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dprint/[email protected]
lint-commits:
runs-on: ubuntu-latest
if: github.event.ref != 'refs/heads/main'
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Get all commits on current main
run: git fetch origin main
- name: Log all commits we will analyze
run: git log --pretty=format:%s origin/main..HEAD
- name: Disallow fixup! commits
run: git log --pretty=format:%s origin/main..HEAD | grep -zv fixup!
- name: Disallow squash! commits
run: git log --pretty=format:%s origin/main..HEAD | grep -zv squash!
clippy:
runs-on: ubuntu-latest
needs: formatting
steps:
- uses: actions/checkout@v3
- uses: extractions/setup-just@v1
- name: Setup rust toolchain
run: rustup show
- uses: Swatinem/[email protected]
- uses: subosito/flutter-action@v2
with:
flutter-version: "3.10.5"
channel: "stable"
cache: true
- name: Install FFI bindings
run: just deps-gen
- name: Generate FFI bindings
run: just gen
- run: cargo clippy --all-targets --all-features -- -D warnings
lint-flutter:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: extractions/setup-just@v1
- uses: subosito/flutter-action@v2
with:
flutter-version: "3.10.5"
channel: "stable"
cache: true
- name: Setup rust toolchain
run: rustup show
- name: Install FFI bindings
run: just deps-gen
- name: Generate FFI bindings
run: just gen
- name: Verify flutter formatting
# Mocks are actually ignored by the linter because they include `// ignore_for_file: type=lint`, but `dart format` reports changes on them nonetheless.
# The solution using a `find` command is from here: https://github.com/dart-lang/dart_style/issues/864
run: dart format --output=none --set-exit-if-changed --line-length 100 $(find . -name "*.dart" -not \( -name "*.*freezed.dart" -o -name "*.mocks.dart" \) )
- name: Analyze flutter code
run: just lint-flutter
tests:
runs-on: ubuntu-latest
needs: clippy
steps:
- uses: actions/checkout@v3
- uses: extractions/setup-just@v1
- name: Setup rust toolchain
run: rustup show
- uses: Swatinem/[email protected]
- uses: subosito/flutter-action@v2
with:
flutter-version: "3.10.5"
channel: "stable"
- name: Install FFI bindings
run: just deps-gen
- name: Generate FFI bindings
run: just gen
- name: Running cargo tests
run: RUST_BACKTRACE=1 cargo test
- name: Running flutter tests
run: just flutter-test
ln-dlc-node-tests:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
- uses: extractions/setup-just@v1
- name: Setup rust toolchain
run: rustup show
- uses: Swatinem/[email protected]
- name: Start containers
run: |
docker-compose up -d
sleep 10 # We need to give docker a bit of time to startup
- name: Test containers are up
run: |
curl -d '{"address":"bcrt1qylgu6ffkp3p0m8tw8kp4tt2dmdh755f4r5dq7s", "amount":"0.1"}' -H "Content-Type: application/json" -X POST http://localhost:3000/faucet
- name: Run slow tests
run: RUST_BACKTRACE=1 cargo test -p ln-dlc-node -- --ignored --nocapture --test-threads=1
e2e-tests:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
- uses: extractions/setup-just@v1
- name: Setup rust toolchain
run: rustup show
- uses: Swatinem/[email protected]
- uses: subosito/flutter-action@v2
with:
flutter-version: "3.10.5"
channel: "stable"
- name: Install FFI bindings
run: just deps-gen
- name: Generate FFI bindings
run: just gen
- name: Build Rust project
run: cargo build --examples
- name: Start containers
run: |
docker-compose up -d
sleep 10 # We need to give docker a bit of time to startup
- name: Test containers are up
run: |
curl -d '{"address":"bcrt1qylgu6ffkp3p0m8tw8kp4tt2dmdh755f4r5dq7s", "amount":"0.1"}' -H "Content-Type: application/json" -X POST http://localhost:3000/faucet
- name: Run e2e tests
run: just e2e --nocapture