2020-09-28 06:18:50 +00:00
|
|
|
name: CI
|
|
|
|
|
|
|
|
on:
|
2021-03-24 00:30:51 +00:00
|
|
|
pull_request: # Need to run on pull-requests, otherwise PRs from forks don't run
|
2020-09-28 06:18:50 +00:00
|
|
|
push:
|
|
|
|
branches:
|
2022-04-04 10:49:02 +00:00
|
|
|
- "staging" # Bors uses this branch
|
|
|
|
- "trying" # Bors uses this branch
|
|
|
|
- "master" # Always build head of master for the badge in the README
|
2020-09-28 06:18:50 +00:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
static_analysis:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout sources
|
2023-01-06 11:01:44 +00:00
|
|
|
uses: actions/checkout@v3.3.0
|
2020-09-28 06:18:50 +00:00
|
|
|
|
2022-11-10 11:01:58 +00:00
|
|
|
- uses: Swatinem/rust-cache@v2.2.0
|
2020-09-28 06:18:50 +00:00
|
|
|
|
2021-04-29 07:32:42 +00:00
|
|
|
- name: Check formatting
|
2022-07-18 11:16:29 +00:00
|
|
|
uses: dprint/check@v2.1
|
2021-03-23 23:40:02 +00:00
|
|
|
|
2020-10-28 00:18:14 +00:00
|
|
|
- name: Run clippy with default features
|
2020-10-27 05:02:32 +00:00
|
|
|
run: cargo clippy --workspace --all-targets -- -D warnings
|
|
|
|
|
2021-02-14 23:11:41 +00:00
|
|
|
- name: Run clippy with all features enabled
|
2020-09-28 06:18:50 +00:00
|
|
|
run: cargo clippy --workspace --all-targets --all-features -- -D warnings
|
|
|
|
|
2022-11-22 13:39:42 +00:00
|
|
|
bdk_test:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout sources
|
2023-01-06 11:01:44 +00:00
|
|
|
uses: actions/checkout@v3.3.0
|
2022-11-22 13:39:42 +00:00
|
|
|
|
|
|
|
- uses: Swatinem/rust-cache@v2.0.2
|
|
|
|
|
|
|
|
- name: Build swap
|
|
|
|
run: cargo build --bin swap
|
|
|
|
|
|
|
|
- name: Run BDK regression script
|
|
|
|
run: ./swap/tests/bdk.sh
|
|
|
|
|
2022-11-30 11:39:20 +00:00
|
|
|
sqlx_test:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout sources
|
2023-01-06 11:01:44 +00:00
|
|
|
uses: actions/checkout@v3.3.0
|
2022-11-30 11:39:20 +00:00
|
|
|
|
|
|
|
- uses: Swatinem/rust-cache@v2.0.2
|
|
|
|
|
|
|
|
- name: Install sqlx-cli
|
|
|
|
run: cargo install sqlx-cli
|
|
|
|
|
|
|
|
- name: Run sqlite_dev_setup.sh script
|
|
|
|
run: |
|
|
|
|
cd swap
|
|
|
|
./sqlite_dev_setup.sh
|
|
|
|
|
2021-02-17 03:46:12 +00:00
|
|
|
build:
|
2020-11-10 04:50:25 +00:00
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
include:
|
|
|
|
- target: x86_64-unknown-linux-gnu
|
|
|
|
os: ubuntu-latest
|
2021-03-15 02:40:03 +00:00
|
|
|
- target: armv7-unknown-linux-gnueabihf
|
|
|
|
os: ubuntu-latest
|
2020-11-10 04:50:25 +00:00
|
|
|
- target: x86_64-apple-darwin
|
|
|
|
os: macos-latest
|
2021-03-02 00:12:01 +00:00
|
|
|
- target: x86_64-pc-windows-msvc
|
|
|
|
os: windows-latest
|
2020-11-10 04:50:25 +00:00
|
|
|
runs-on: ${{ matrix.os }}
|
2020-09-28 06:18:50 +00:00
|
|
|
steps:
|
|
|
|
- name: Checkout sources
|
2023-01-06 11:01:44 +00:00
|
|
|
uses: actions/checkout@v3.3.0
|
2020-09-28 06:18:50 +00:00
|
|
|
|
2022-11-10 11:01:58 +00:00
|
|
|
- uses: Swatinem/rust-cache@v2.2.0
|
2020-09-28 06:18:50 +00:00
|
|
|
|
2022-12-27 17:27:59 +00:00
|
|
|
- uses: dtolnay/rust-toolchain@stable
|
2022-11-18 12:58:58 +00:00
|
|
|
with:
|
2022-12-27 17:27:59 +00:00
|
|
|
targets: armv7-unknown-linux-gnueabihf
|
2021-03-12 00:25:30 +00:00
|
|
|
|
2020-11-10 04:50:25 +00:00
|
|
|
- name: Build binary
|
2022-11-18 12:58:58 +00:00
|
|
|
if: matrix.target != 'armv7-unknown-linux-gnueabihf'
|
2022-12-27 17:27:59 +00:00
|
|
|
run: cargo build -p swap --target ${{ matrix.target }}
|
|
|
|
|
|
|
|
- name: Install cross (armv7)
|
|
|
|
if: matrix.target == 'armv7-unknown-linux-gnueabihf'
|
|
|
|
run: cargo install cross --locked
|
2022-11-18 12:58:58 +00:00
|
|
|
|
|
|
|
- name: Build binary (armv7)
|
|
|
|
if: matrix.target == 'armv7-unknown-linux-gnueabihf'
|
2022-12-27 17:27:59 +00:00
|
|
|
run: cross build -p swap --target ${{ matrix.target }}
|
2020-11-10 04:50:25 +00:00
|
|
|
|
2021-03-05 05:14:21 +00:00
|
|
|
- name: Upload swap binary
|
2022-11-22 13:39:42 +00:00
|
|
|
uses: actions/upload-artifact@v3
|
2020-11-10 04:50:25 +00:00
|
|
|
with:
|
|
|
|
name: swap-${{ matrix.target }}
|
2021-03-05 05:14:21 +00:00
|
|
|
path: target/${{ matrix.target }}/debug/swap
|
2021-01-28 04:40:47 +00:00
|
|
|
|
2021-02-21 23:24:11 +00:00
|
|
|
- name: Upload asb binary
|
2022-11-22 13:39:42 +00:00
|
|
|
uses: actions/upload-artifact@v3
|
2021-02-17 03:42:15 +00:00
|
|
|
with:
|
2021-02-21 23:24:11 +00:00
|
|
|
name: asb-${{ matrix.target }}
|
|
|
|
path: target/${{ matrix.target }}/debug/asb
|
2021-02-17 03:42:15 +00:00
|
|
|
|
2021-02-17 03:46:12 +00:00
|
|
|
test:
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2022-04-04 10:49:02 +00:00
|
|
|
os: [ubuntu-latest, macos-latest]
|
2021-02-17 03:46:12 +00:00
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
steps:
|
|
|
|
- name: Checkout sources
|
2023-01-06 11:01:44 +00:00
|
|
|
uses: actions/checkout@v3.3.0
|
2021-02-17 03:46:12 +00:00
|
|
|
|
2022-11-10 11:01:58 +00:00
|
|
|
- uses: Swatinem/rust-cache@v2.2.0
|
2021-02-17 03:46:12 +00:00
|
|
|
|
|
|
|
- name: Build tests
|
|
|
|
run: cargo build --tests --workspace --all-features
|
|
|
|
|
|
|
|
- name: Run monero-harness tests
|
|
|
|
if: matrix.os == 'ubuntu-latest'
|
|
|
|
run: cargo test --package monero-harness --all-features
|
|
|
|
|
|
|
|
- name: Run library tests for swap
|
|
|
|
run: cargo test --package swap --lib --all-features
|
|
|
|
|
2021-01-28 04:40:47 +00:00
|
|
|
docker_tests:
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2022-04-04 10:49:02 +00:00
|
|
|
test_name:
|
|
|
|
[
|
2021-01-28 04:40:47 +00:00
|
|
|
happy_path,
|
2021-03-22 05:28:59 +00:00
|
|
|
happy_path_restart_bob_after_xmr_locked,
|
|
|
|
happy_path_restart_bob_before_xmr_locked,
|
2021-03-26 04:38:30 +00:00
|
|
|
happy_path_restart_alice_after_xmr_locked,
|
2021-04-27 04:51:53 +00:00
|
|
|
alice_and_bob_refund_using_cancel_and_refund_command,
|
2023-01-04 09:23:24 +00:00
|
|
|
alice_and_bob_refund_using_cancel_then_refund_command,
|
2021-04-27 04:51:53 +00:00
|
|
|
alice_and_bob_refund_using_cancel_and_refund_command_timelock_not_expired,
|
2021-03-26 04:38:30 +00:00
|
|
|
punish,
|
2021-04-28 06:13:04 +00:00
|
|
|
alice_punishes_after_restart_bob_dead,
|
|
|
|
alice_manually_punishes_after_bob_dead,
|
2021-04-08 08:56:26 +00:00
|
|
|
alice_refunds_after_restart_bob_refunded,
|
|
|
|
ensure_same_swap_id,
|
2021-04-28 06:13:04 +00:00
|
|
|
concurrent_bobs_before_xmr_lock_proof_sent,
|
2022-04-04 10:49:02 +00:00
|
|
|
alice_manually_redeems_after_enc_sig_learned,
|
|
|
|
]
|
2021-01-28 04:40:47 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout sources
|
2023-01-06 11:01:44 +00:00
|
|
|
uses: actions/checkout@v3.3.0
|
2021-01-28 04:40:47 +00:00
|
|
|
|
2022-11-10 11:01:58 +00:00
|
|
|
- uses: Swatinem/rust-cache@v2.2.0
|
2021-01-28 04:40:47 +00:00
|
|
|
|
|
|
|
- name: Run test ${{ matrix.test_name }}
|
2021-04-20 03:03:59 +00:00
|
|
|
run: cargo test --package swap --all-features --test ${{ matrix.test_name }} -- --nocapture
|