xmr-btc-swap/.github/workflows/ci.yml
rishflab c91e9652aa Add alice punish test
Use reusable test init functions for happy path test

Extract tracing setup to reusable function

Move test initialization to seperate functions

Increase stack size in CI

Fix monero max finality time

Force Bob swarm polling to send message 2

Run Bob state to xmr_locked in punish test to force the sending of
message2. Previously Bob state was run until btc_locked. Although
this was the right thing to do, message2 was not being sent as the
swarm was not polled in btc_locked. Alice punish test passes.

Add info logging to executor
2020-12-04 17:23:37 +11:00

118 lines
3.7 KiB
YAML

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 xmr-btc/Cargo.toml
cargo tomlfmt -d -p monero-harness/Cargo.toml
cargo tomlfmt -d -p swap/Cargo.toml
- name: Check code formatting
run: cargo fmt --all -- --check
- name: Run clippy with default features
run: cargo clippy --workspace --all-targets -- -D warnings
- name: Run clippy with all features enabled (e.g. tor)
run: cargo clippy --workspace --all-targets --all-features -- -D warnings
build_test:
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
skip_tests: true # Most likely do not work due to docker usage, TODO: add feature flag to allow unit tests
runs-on: ${{ matrix.os }}
steps:
- name: Checkout sources
uses: actions/checkout@v2
- name: Install and stop tor in case it was running
if: (matrix.os == 'ubuntu-latest' && !matrix.skip_tests)
run: |
sudo apt install software-properties-common
sudo curl https://deb.torproject.org/torproject.org/A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89.asc | sudo gpg --import
sudo gpg --export A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89 | sudo apt-key add -
sudo add-apt-repository 'deb https://deb.torproject.org/torproject.org bionic main'
sudo apt update
sudo apt install tor deb.torproject.org-keyring
sudo /etc/init.d/tor stop
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
override: true
- name: Cache target directory
uses: actions/cache@v1
if: matrix.os == 'ubuntu-latest'
with:
path: target
key: rust-${{ matrix.target }}-${{ matrix.rust_toolchain }}-target-directory-${{ hashFiles('Cargo.lock') }}-v1
- name: Cache ~/.cargo/registry directory
uses: actions/cache@v1
with:
path: ~/.cargo/registry
key: rust-${{ matrix.target }}-${{ matrix.rust_toolchain }}-cargo-registry-directory-${{ hashFiles('Cargo.lock') }}-v1
- name: Cargo check release code with default features
run: cargo check --workspace
- name: Cargo check all features
run: cargo check --workspace --all-targets --all-features
- name: Cargo test
if: (!matrix.skip_tests)
run: cargo test --workspace --all-features
env:
MONERO_ADDITIONAL_SLEEP_PERIOD: 60000
RUST_MIN_STACK: 100000000000
- name: Build binary
run: |
cargo build -p swap --target ${{ matrix.target }}
- name: Upload binary
uses: actions/upload-artifact@v2-preview
with:
name: swap-${{ matrix.target }}
path: target/${{ matrix.target }}/debug/swap