2020-09-28 06:18:50 +00:00
|
|
|
name: CI
|
|
|
|
|
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- 'staging'
|
|
|
|
- 'trying'
|
|
|
|
- 'master'
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
static_analysis:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout sources
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
|
2021-03-04 06:47:39 +00:00
|
|
|
- uses: Swatinem/rust-cache@v1.2.0
|
|
|
|
id: cache
|
2020-09-28 06:18:50 +00:00
|
|
|
|
|
|
|
- name: Install tomlfmt
|
2021-03-04 06:47:39 +00:00
|
|
|
if: steps.cache.outputs.cache-hit != 'true'
|
2021-02-17 03:53:35 +00:00
|
|
|
run: cargo install cargo-tomlfmt
|
2020-09-28 06:18:50 +00:00
|
|
|
|
|
|
|
- name: Check Cargo.toml formatting
|
|
|
|
run: |
|
|
|
|
cargo tomlfmt -d -p Cargo.toml
|
|
|
|
cargo tomlfmt -d -p monero-harness/Cargo.toml
|
2020-11-02 23:55:54 +00:00
|
|
|
cargo tomlfmt -d -p swap/Cargo.toml
|
2020-09-28 06:18:50 +00:00
|
|
|
|
|
|
|
- name: Check code formatting
|
|
|
|
run: cargo fmt --all -- --check
|
|
|
|
|
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
|
|
|
|
|
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:
|
2020-10-20 03:33:32 +00:00
|
|
|
|
2020-09-28 06:18:50 +00:00
|
|
|
- name: Checkout sources
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
|
2021-03-04 06:47:39 +00:00
|
|
|
- uses: Swatinem/rust-cache@v1.2.0
|
2020-09-28 06:18:50 +00:00
|
|
|
|
2021-03-12 00:25:30 +00: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-10 04:50:25 +00:00
|
|
|
- name: Build binary
|
|
|
|
run: |
|
|
|
|
cargo build -p swap --target ${{ matrix.target }}
|
|
|
|
|
2021-03-05 05:14:21 +00:00
|
|
|
- name: Upload swap binary
|
2020-11-10 04:50:25 +00:00
|
|
|
uses: actions/upload-artifact@v2-preview
|
|
|
|
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
|
2021-02-17 03:42:15 +00:00
|
|
|
uses: actions/upload-artifact@v2-preview
|
|
|
|
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:
|
|
|
|
env:
|
|
|
|
RUST_TEST_TASKS: 2
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
include:
|
|
|
|
- target: x86_64-unknown-linux-gnu
|
|
|
|
os: ubuntu-latest
|
|
|
|
- target: x86_64-apple-darwin
|
|
|
|
os: macos-latest
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
steps:
|
|
|
|
|
|
|
|
- name: Checkout sources
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
|
2021-03-04 06:47:39 +00:00
|
|
|
- uses: Swatinem/rust-cache@v1.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:
|
|
|
|
env:
|
|
|
|
TARGET: x86_64-unknown-linux-gnu
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
test_name: [
|
|
|
|
happy_path,
|
|
|
|
happy_path_restart_bob_before_comm,
|
2021-02-01 07:13:08 +00:00
|
|
|
bob_refunds_using_cancel_and_refund_command,
|
2021-02-10 01:06:41 +00:00
|
|
|
bob_refunds_using_cancel_and_refund_command_timelock_not_expired,
|
|
|
|
bob_refunds_using_cancel_and_refund_command_timelock_not_expired_force,
|
2021-03-16 06:18:57 +00:00
|
|
|
punish
|
2021-01-28 04:40:47 +00:00
|
|
|
]
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
|
|
|
|
- name: Checkout sources
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
|
2021-03-04 06:47:39 +00:00
|
|
|
- uses: Swatinem/rust-cache@v1.2.0
|
2021-01-28 04:40:47 +00:00
|
|
|
|
|
|
|
- name: Run test ${{ matrix.test_name }}
|
|
|
|
run: cargo test --package swap --all-features --test ${{ matrix.test_name }} ""
|
|
|
|
env:
|
|
|
|
MONERO_ADDITIONAL_SLEEP_PERIOD: 60000
|
|
|
|
RUST_MIN_STACK: 16777216 # 16 MB. Default is 8MB. This is fine as in tests we start 2 programs: Alice and Bob.
|