mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2024-06-29 08:02:32 +00:00
Split build_test
into build
and test
Building binaries and building tests results in different artifacts inside the `target` directory. If we use distinct caches for these commands, the caches are more useful because less code has to be re-built.
This commit is contained in:
parent
e57c005920
commit
f1b097877b
78
.github/workflows/ci.yml
vendored
78
.github/workflows/ci.yml
vendored
|
@ -46,7 +46,57 @@ jobs:
|
||||||
- name: Run clippy with all features enabled
|
- name: Run clippy with all features enabled
|
||||||
run: cargo clippy --workspace --all-targets --all-features -- -D warnings
|
run: cargo clippy --workspace --all-targets --all-features -- -D warnings
|
||||||
|
|
||||||
build_test:
|
build:
|
||||||
|
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 }}
|
||||||
|
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
|
||||||
|
if: matrix.os == 'ubuntu-latest'
|
||||||
|
with:
|
||||||
|
path: target
|
||||||
|
key: rust-${{ matrix.target }}-target-directory-build-${{ hashFiles('Cargo.lock') }}-v1
|
||||||
|
|
||||||
|
- name: Cache ~/.cargo/registry directory
|
||||||
|
uses: actions/cache@v1
|
||||||
|
with:
|
||||||
|
path: ~/.cargo/registry
|
||||||
|
key: rust-${{ matrix.target }}-cargo-registry-directory-${{ hashFiles('Cargo.lock') }}-v1
|
||||||
|
|
||||||
|
- name: Build binary
|
||||||
|
run: |
|
||||||
|
cargo build -p swap --target ${{ matrix.target }}
|
||||||
|
|
||||||
|
- name: Upload swap_cli binary
|
||||||
|
uses: actions/upload-artifact@v2-preview
|
||||||
|
with:
|
||||||
|
name: swap-${{ matrix.target }}
|
||||||
|
path: target/${{ matrix.target }}/debug/swap_cli
|
||||||
|
|
||||||
|
- name: Upload nectar binary
|
||||||
|
uses: actions/upload-artifact@v2-preview
|
||||||
|
with:
|
||||||
|
name: nectar-${{ matrix.target }}
|
||||||
|
path: target/${{ matrix.target }}/debug/nectar
|
||||||
|
|
||||||
|
test:
|
||||||
env:
|
env:
|
||||||
RUST_TEST_TASKS: 2
|
RUST_TEST_TASKS: 2
|
||||||
strategy:
|
strategy:
|
||||||
|
@ -74,7 +124,7 @@ jobs:
|
||||||
if: matrix.os == 'ubuntu-latest'
|
if: matrix.os == 'ubuntu-latest'
|
||||||
with:
|
with:
|
||||||
path: target
|
path: target
|
||||||
key: rust-${{ matrix.target }}-target-directory-${{ hashFiles('Cargo.lock') }}-v1
|
key: rust-${{ matrix.target }}-target-directory-test-${{ hashFiles('Cargo.lock') }}-v1
|
||||||
|
|
||||||
- name: Cache ~/.cargo/registry directory
|
- name: Cache ~/.cargo/registry directory
|
||||||
uses: actions/cache@v1
|
uses: actions/cache@v1
|
||||||
|
@ -82,12 +132,6 @@ jobs:
|
||||||
path: ~/.cargo/registry
|
path: ~/.cargo/registry
|
||||||
key: rust-${{ matrix.target }}-cargo-registry-directory-${{ hashFiles('Cargo.lock') }}-v1
|
key: rust-${{ matrix.target }}-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: Build tests
|
- name: Build tests
|
||||||
run: cargo build --tests --workspace --all-features
|
run: cargo build --tests --workspace --all-features
|
||||||
|
|
||||||
|
@ -98,22 +142,6 @@ jobs:
|
||||||
- name: Run library tests for swap
|
- name: Run library tests for swap
|
||||||
run: cargo test --package swap --lib --all-features
|
run: cargo test --package swap --lib --all-features
|
||||||
|
|
||||||
- name: Build binary
|
|
||||||
run: |
|
|
||||||
cargo build -p swap --target ${{ matrix.target }}
|
|
||||||
|
|
||||||
- name: Upload swap_cli binary
|
|
||||||
uses: actions/upload-artifact@v2-preview
|
|
||||||
with:
|
|
||||||
name: swap-${{ matrix.target }}
|
|
||||||
path: target/${{ matrix.target }}/debug/swap_cli
|
|
||||||
|
|
||||||
- name: Upload nectar binary
|
|
||||||
uses: actions/upload-artifact@v2-preview
|
|
||||||
with:
|
|
||||||
name: nectar-${{ matrix.target }}
|
|
||||||
path: target/${{ matrix.target }}/debug/nectar
|
|
||||||
|
|
||||||
docker_tests:
|
docker_tests:
|
||||||
env:
|
env:
|
||||||
TARGET: x86_64-unknown-linux-gnu
|
TARGET: x86_64-unknown-linux-gnu
|
||||||
|
@ -142,7 +170,7 @@ jobs:
|
||||||
uses: actions/cache@v1
|
uses: actions/cache@v1
|
||||||
with:
|
with:
|
||||||
path: target
|
path: target
|
||||||
key: rust-${{ env.TARGET }}-target-directory-${{ hashFiles('Cargo.lock') }}-v1
|
key: rust-${{ matrix.target }}-target-directory-test-${{ hashFiles('Cargo.lock') }}-v1
|
||||||
|
|
||||||
- name: Cache ~/.cargo/registry directory
|
- name: Cache ~/.cargo/registry directory
|
||||||
uses: actions/cache@v1
|
uses: actions/cache@v1
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
status = [
|
status = [
|
||||||
"static_analysis",
|
"static_analysis",
|
||||||
"build_test (x86_64-unknown-linux-gnu)",
|
"build (x86_64-unknown-linux-gnu)",
|
||||||
"build_test (x86_64-apple-darwin)",
|
"build (x86_64-apple-darwin)",
|
||||||
|
"test (x86_64-unknown-linux-gnu)",
|
||||||
|
"test (x86_64-apple-darwin)",
|
||||||
"docker_tests (happy_path)",
|
"docker_tests (happy_path)",
|
||||||
"docker_tests (happy_path_restart_bob_before_comm)",
|
"docker_tests (happy_path_restart_bob_before_comm)",
|
||||||
"docker_tests (bob_refunds_using_cancel_and_refund_command)",
|
"docker_tests (bob_refunds_using_cancel_and_refund_command)",
|
||||||
|
|
Loading…
Reference in New Issue
Block a user