Skip to content

Allow collab-closing legacy Lightning channels #4822

Allow collab-closing legacy Lightning channels

Allow collab-closing legacy Lightning channels #4822

Workflow file for this run

name: CI
on:
pull_request:
merge_group:
push:
branches:
- "staging"
- "main"
env:
CARGO_INCREMENTAL: 0
CARGO_TERM_COLOR: always
FLUTTER_VERSION: "3.13.4"
jobs:
formatting-dprint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt
- uses: dprint/check@v2.1
generate-ffi:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: extractions/setup-just@v1
- name: Setup rust toolchain
run: rustup show
- uses: Swatinem/rust-cache@v2.2.0
- uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
channel: "stable"
cache: true
cache-key: flutter-${{ env.FLUTTER_VERSION }}
cache-path: ${{ runner.tool_cache }}/flutter
- name: Install FFI bindings
run: just deps-gen
- name: Generate FFI bindings
run: just gen
- name: Upload Rust bridge_generated directory
uses: actions/upload-artifact@v2
with:
name: rust_bridge_generated
path: mobile/native/src/bridge_generated/
- name: Upload Dart bridge_generated directory
uses: actions/upload-artifact@v2
with:
name: dart_bridge_generated
path: mobile/lib/bridge_generated/
- name: Upload Dart mocks directory
uses: actions/upload-artifact@v2
with:
name: dart_mocks_generated
path: mobile/test/*.mocks.dart
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 analyse
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: generate-ffi
steps:
- uses: actions/checkout@v3
- uses: extractions/setup-just@v1
- name: Setup rust toolchain
run: rustup show
- uses: Swatinem/rust-cache@v2.2.0
- name: Download RUST FFI bindings
uses: actions/download-artifact@v2
with:
name: rust_bridge_generated
path: mobile/native/src/bridge_generated
- run: cargo clippy --all-targets --all-features -- -D warnings
flutter-format-and-lint:
runs-on: ubuntu-latest
needs: generate-ffi
name: "Format and lint Flutter code"
steps:
- uses: actions/checkout@v3
- uses: extractions/setup-just@v1
- uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
channel: "stable"
cache: true
cache-key: flutter-${{ env.FLUTTER_VERSION }}
cache-path: ${{ runner.tool_cache }}/flutter
- name: Download Dart mocks directory
uses: actions/download-artifact@v2
with:
name: dart_mocks_generated
path: mobile/test
- name: Download Dart bridge_generated directory
uses: actions/download-artifact@v2
with:
name: dart_bridge_generated
path: mobile/lib/bridge_generated
- 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: Analyse flutter code
run: just lint-flutter
unit-tests:
runs-on: ubuntu-latest
needs: [generate-ffi, clippy]
steps:
- uses: actions/checkout@v3
- uses: extractions/setup-just@v1
- name: Setup rust toolchain
run: rustup show
- uses: Swatinem/rust-cache@v2.2.0
- uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
channel: "stable"
cache: true
cache-key: flutter-${{ env.FLUTTER_VERSION }}
cache-path: ${{ runner.tool_cache }}/flutter
- name: Download Rust generated FFI flutter bindings
uses: actions/download-artifact@v2
with:
name: rust_bridge_generated
path: mobile/native/src/bridge_generated
- name: Running cargo tests
run: RUST_BACKTRACE=1 cargo test
# Flutter tests run `build_runner`, so no need to download mocks
- name: Download Dart bridge_generated directory
uses: actions/download-artifact@v2
with:
name: dart_bridge_generated
path: mobile/lib/bridge_generated
- 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/rust-cache@v2.2.0
- 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 LN-DLC tests
run: RUST_BACKTRACE=1 cargo test -p ln-dlc-node -- --ignored --nocapture --test-threads=1
- name: LND logs on e2e tests error
if: failure()
run: docker logs lnd
- name: bitcoin logs on e2e tests error
if: failure()
run: docker logs bitcoin
- name: faucet logs on e2e tests error
if: failure()
run: docker logs faucet
- name: electrs logs on e2e tests error
if: failure()
run: docker logs electrs
- name: esplora logs on e2e tests error
if: failure()
run: docker logs esplora
- name: show disk space after tests
if: always()
run: df -h
e2e-tests:
runs-on: ubuntu-latest
needs: generate-ffi
timeout-minutes: 30
steps:
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
# this might remove tools that are actually needed,
# when set to "true" but frees about 6 GB
tool-cache: false
large-packages: false
- uses: actions/checkout@v3
- uses: extractions/setup-just@v1
- name: Setup rust toolchain
run: rustup show
- uses: Swatinem/rust-cache@v2.2.0
- name: Download RUST FFI bindings
uses: actions/download-artifact@v2
with:
name: rust_bridge_generated
path: mobile/native/src/bridge_generated
- 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: show disk space before tests
run: df -h
- 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
- name: Print maker logs on e2e tests error
if: failure()
run: cat data/maker/regtest.log
- name: Print coordinator logs on e2e tests error
if: failure()
run: cat data/coordinator/regtest.log
- name: LND logs on e2e tests error
if: failure()
run: docker logs lnd
- name: bitcoin logs on e2e tests error
if: failure()
run: docker logs bitcoin
- name: faucet logs on e2e tests error
if: failure()
run: docker logs faucet
- name: electrs logs on e2e tests error
if: failure()
run: docker logs electrs
- name: esplora logs on e2e tests error
if: failure()
run: docker logs esplora
- name: show disk space after tests
if: always()
run: df -h
payout-curve:
runs-on: ubuntu-latest
needs: generate-ffi
timeout-minutes: 30
steps:
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
# this might remove tools that are actually needed,
# when set to "true" but frees about 6 GB
tool-cache: false
large-packages: false
- uses: actions/checkout@v3
- uses: extractions/setup-just@v1
- name: Setup rust toolchain
run: rustup show
- uses: Swatinem/rust-cache@v2.2.0
- name: Download RUST FFI bindings
uses: actions/download-artifact@v2
with:
name: rust_bridge_generated
path: mobile/native/src/bridge_generated
- name: Run payout curve example tests
run: cargo run -p payout_curve --example payout_curve_csv