2020-09-28 02:18:50 -04:00
|
|
|
name: CI
|
|
|
|
|
|
|
|
on:
|
2021-03-23 20:30:51 -04:00
|
|
|
pull_request: # Need to run on pull-requests, otherwise PRs from forks don't run
|
2020-09-28 02:18:50 -04:00
|
|
|
push:
|
|
|
|
branches:
|
2021-03-23 20:30:51 -04: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 02:18:50 -04:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
static_analysis:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout sources
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
|
2021-03-04 01:47:39 -05:00
|
|
|
- uses: Swatinem/rust-cache@v1.2.0
|
|
|
|
id: cache
|
2020-09-28 02:18:50 -04:00
|
|
|
|
|
|
|
- name: Install tomlfmt
|
2021-03-04 01:47:39 -05:00
|
|
|
if: steps.cache.outputs.cache-hit != 'true'
|
2021-02-16 22:53:35 -05:00
|
|
|
run: cargo install cargo-tomlfmt
|
2020-09-28 02:18:50 -04:00
|
|
|
|
|
|
|
- name: Check Cargo.toml formatting
|
|
|
|
run: |
|
|
|
|
cargo tomlfmt -d -p Cargo.toml
|
|
|
|
cargo tomlfmt -d -p monero-harness/Cargo.toml
|
2020-11-02 18:55:54 -05:00
|
|
|
cargo tomlfmt -d -p swap/Cargo.toml
|
2020-09-28 02:18:50 -04:00
|
|
|
|
|
|
|
- name: Check code formatting
|
|
|
|
run: cargo fmt --all -- --check
|
|
|
|
|
2021-03-23 19:40:02 -04:00
|
|
|
- name: Check markdown formatting
|
2021-04-05 05:10:08 -04:00
|
|
|
uses: dprint/check@v1.2
|
2021-03-23 19:40:02 -04:00
|
|
|
|
2020-10-27 20:18:14 -04:00
|
|
|
- name: Run clippy with default features
|
2020-10-27 01:02:32 -04:00
|
|
|
run: cargo clippy --workspace --all-targets -- -D warnings
|
|
|
|
|
2021-02-14 18:11:41 -05:00
|
|
|
- name: Run clippy with all features enabled
|
2020-09-28 02:18:50 -04:00
|
|
|
run: cargo clippy --workspace --all-targets --all-features -- -D warnings
|
|
|
|
|
2021-02-16 22:46:12 -05:00
|
|
|
build:
|
2020-11-09 23:50:25 -05:00
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
include:
|
|
|
|
- target: x86_64-unknown-linux-gnu
|
|
|
|
os: ubuntu-latest
|
2021-03-14 22:40:03 -04:00
|
|
|
- target: armv7-unknown-linux-gnueabihf
|
|
|
|
os: ubuntu-latest
|
2020-11-09 23:50:25 -05:00
|
|
|
- target: x86_64-apple-darwin
|
|
|
|
os: macos-latest
|
2021-03-01 19:12:01 -05:00
|
|
|
- target: x86_64-pc-windows-msvc
|
|
|
|
os: windows-latest
|
2020-11-09 23:50:25 -05:00
|
|
|
runs-on: ${{ matrix.os }}
|
2020-09-28 02:18:50 -04:00
|
|
|
steps:
|
2020-10-19 23:33:32 -04:00
|
|
|
|
2020-09-28 02:18:50 -04:00
|
|
|
- name: Checkout sources
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
|
2021-03-04 01:47:39 -05:00
|
|
|
- uses: Swatinem/rust-cache@v1.2.0
|
2020-09-28 02:18:50 -04:00
|
|
|
|
2021-03-11 19:25:30 -05:00
|
|
|
- name: Install compiler for armhf arch
|
|
|
|
if: matrix.target == 'armv7-unknown-linux-gnueabihf'
|
|
|
|
run: |
|
|
|
|
sudo apt-get update
|
|
|
|
sudo apt-get install gcc-arm-linux-gnueabihf
|
|
|
|
|
2020-11-09 23:50:25 -05:00
|
|
|
- name: Build binary
|
|
|
|
run: |
|
|
|
|
cargo build -p swap --target ${{ matrix.target }}
|
|
|
|
|
2021-03-05 00:14:21 -05:00
|
|
|
- name: Upload swap binary
|
2020-11-09 23:50:25 -05:00
|
|
|
uses: actions/upload-artifact@v2-preview
|
|
|
|
with:
|
|
|
|
name: swap-${{ matrix.target }}
|
2021-03-05 00:14:21 -05:00
|
|
|
path: target/${{ matrix.target }}/debug/swap
|
2021-01-27 23:40:47 -05:00
|
|
|
|
2021-02-21 18:24:11 -05:00
|
|
|
- name: Upload asb binary
|
2021-02-16 22:42:15 -05:00
|
|
|
uses: actions/upload-artifact@v2-preview
|
|
|
|
with:
|
2021-02-21 18:24:11 -05:00
|
|
|
name: asb-${{ matrix.target }}
|
|
|
|
path: target/${{ matrix.target }}/debug/asb
|
2021-02-16 22:42:15 -05:00
|
|
|
|
2021-02-16 22:46:12 -05:00
|
|
|
test:
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2021-03-24 01:02:43 -04:00
|
|
|
os: [ ubuntu-latest, macos-latest ]
|
2021-02-16 22:46:12 -05:00
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
steps:
|
|
|
|
- name: Checkout sources
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
|
2021-03-04 01:47:39 -05:00
|
|
|
- uses: Swatinem/rust-cache@v1.2.0
|
2021-02-16 22:46:12 -05: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-27 23:40:47 -05:00
|
|
|
docker_tests:
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
test_name: [
|
|
|
|
happy_path,
|
2021-03-22 01:28:59 -04:00
|
|
|
happy_path_restart_bob_after_xmr_locked,
|
|
|
|
happy_path_restart_bob_before_xmr_locked,
|
2021-03-26 00:38:30 -04:00
|
|
|
happy_path_restart_alice_after_xmr_locked,
|
2021-02-01 02:13:08 -05:00
|
|
|
bob_refunds_using_cancel_and_refund_command,
|
2021-02-09 20:06:41 -05:00
|
|
|
bob_refunds_using_cancel_and_refund_command_timelock_not_expired,
|
|
|
|
bob_refunds_using_cancel_and_refund_command_timelock_not_expired_force,
|
2021-03-26 00:38:30 -04:00
|
|
|
punish,
|
2021-04-01 02:36:45 -04:00
|
|
|
alice_punishes_after_restart_punish_timelock_expired,
|
|
|
|
alice_refunds_after_restart_bob_refunded
|
2021-01-27 23:40:47 -05:00
|
|
|
]
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
|
|
|
|
- name: Checkout sources
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
|
2021-03-04 01:47:39 -05:00
|
|
|
- uses: Swatinem/rust-cache@v1.2.0
|
2021-01-27 23:40:47 -05:00
|
|
|
|
|
|
|
- name: Run test ${{ matrix.test_name }}
|
|
|
|
run: cargo test --package swap --all-features --test ${{ matrix.test_name }} ""
|
|
|
|
env:
|
|
|
|
MONERO_ADDITIONAL_SLEEP_PERIOD: 60000
|