2020-09-28 02:18:50 -04: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
|
|
|
|
|
|
|
|
- name: Install Rust
|
|
|
|
uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
profile: minimal
|
|
|
|
override: true
|
|
|
|
components: rustfmt, clippy
|
|
|
|
|
|
|
|
- name: Cache ~/.cargo/bin directory
|
|
|
|
uses: actions/cache@v1
|
|
|
|
with:
|
|
|
|
path: ~/.cargo/bin
|
|
|
|
key: ubuntu-rust-${{ env.RUST_TOOLCHAIN }}-cargo-bin-directory-v1
|
|
|
|
|
|
|
|
- name: Install tomlfmt
|
|
|
|
run: which cargo-tomlfmt || cargo install cargo-tomlfmt
|
|
|
|
|
|
|
|
- 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
|
|
|
|
|
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
|
|
|
|
|
|
|
|
build_test:
|
2020-12-21 18:58:17 -05:00
|
|
|
env:
|
|
|
|
RUST_TEST_TASKS: 2
|
2020-11-09 23:50:25 -05:00
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
target: [ x86_64-unknown-linux-gnu, x86_64-apple-darwin ]
|
|
|
|
include:
|
|
|
|
- target: x86_64-unknown-linux-gnu
|
|
|
|
os: ubuntu-latest
|
|
|
|
- target: x86_64-apple-darwin
|
|
|
|
os: macos-latest
|
|
|
|
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
|
|
|
|
|
|
|
|
- name: Install Rust toolchain
|
|
|
|
uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
profile: minimal
|
|
|
|
override: true
|
|
|
|
|
|
|
|
- name: Cache target directory
|
|
|
|
uses: actions/cache@v1
|
2020-11-09 23:50:25 -05:00
|
|
|
if: matrix.os == 'ubuntu-latest'
|
2020-09-28 02:18:50 -04:00
|
|
|
with:
|
|
|
|
path: target
|
2021-01-27 23:40:47 -05:00
|
|
|
key: rust-${{ matrix.target }}-target-directory-${{ hashFiles('Cargo.lock') }}-v1
|
2020-09-28 02:18:50 -04:00
|
|
|
|
|
|
|
- name: Cache ~/.cargo/registry directory
|
|
|
|
uses: actions/cache@v1
|
|
|
|
with:
|
|
|
|
path: ~/.cargo/registry
|
2021-01-27 23:40:47 -05:00
|
|
|
key: rust-${{ matrix.target }}-cargo-registry-directory-${{ hashFiles('Cargo.lock') }}-v1
|
2020-09-28 02:18:50 -04:00
|
|
|
|
|
|
|
- name: Cargo check release code with default features
|
2021-01-26 21:42:59 -05:00
|
|
|
run: cargo check --workspace
|
2020-09-28 02:18:50 -04:00
|
|
|
|
|
|
|
- name: Cargo check all features
|
2021-01-26 21:42:59 -05:00
|
|
|
run: cargo check --workspace --all-targets --all-features
|
2020-09-28 02:18:50 -04:00
|
|
|
|
2021-01-27 23:40:47 -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
|
2020-11-09 23:50:25 -05:00
|
|
|
|
|
|
|
- name: Build binary
|
|
|
|
run: |
|
|
|
|
cargo build -p swap --target ${{ matrix.target }}
|
|
|
|
|
2021-02-16 22:42:15 -05:00
|
|
|
- name: Upload swap_cli binary
|
2020-11-09 23:50:25 -05:00
|
|
|
uses: actions/upload-artifact@v2-preview
|
|
|
|
with:
|
|
|
|
name: swap-${{ matrix.target }}
|
2021-02-16 22:40:34 -05:00
|
|
|
path: target/${{ matrix.target }}/debug/swap_cli
|
2021-01-27 23:40:47 -05:00
|
|
|
|
2021-02-16 22:42:15 -05:00
|
|
|
- name: Upload nectar binary
|
|
|
|
uses: actions/upload-artifact@v2-preview
|
|
|
|
with:
|
|
|
|
name: nectar-${{ matrix.target }}
|
|
|
|
path: target/${{ matrix.target }}/debug/nectar
|
|
|
|
|
2021-01-27 23:40:47 -05: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 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-01-27 23:40:47 -05:00
|
|
|
]
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
|
|
|
|
- name: Checkout sources
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
|
|
|
|
- name: Install Rust toolchain
|
|
|
|
uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
profile: minimal
|
|
|
|
override: true
|
|
|
|
|
|
|
|
- name: Cache target directory
|
|
|
|
uses: actions/cache@v1
|
|
|
|
with:
|
|
|
|
path: target
|
|
|
|
key: rust-${{ env.TARGET }}-target-directory-${{ hashFiles('Cargo.lock') }}-v1
|
|
|
|
|
|
|
|
- name: Cache ~/.cargo/registry directory
|
|
|
|
uses: actions/cache@v1
|
|
|
|
with:
|
|
|
|
path: ~/.cargo/registry
|
|
|
|
key: rust-${{ env.TARGET }}-cargo-registry-directory-${{ hashFiles('Cargo.lock') }}-v1
|
|
|
|
|
|
|
|
- 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.
|