Skip to content

Commit

Permalink
WIP: add cross-platform actions
Browse files Browse the repository at this point in the history
  • Loading branch information
nicbus committed May 21, 2024
1 parent ae42403 commit e064205
Show file tree
Hide file tree
Showing 4 changed files with 133 additions and 36 deletions.
57 changes: 57 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Build

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

env:
CARGO_TERM_COLOR: always

jobs:
build:
timeout-minutes: 30
runs-on: ${{ matrix.os }}
strategy:
matrix:
name: [linux, windows, macos]
include:
- name: linux
os: ubuntu-latest
- name: windows
os: windows-latest
- name: macos
os: macos-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Build with default features
run: cargo build

build_features:
timeout-minutes: 30
runs-on: ${{ matrix.os }}
strategy:
matrix:
name: [linux, windows, macos]
include:
- name: linux
os: ubuntu-latest
- name: windows
os: windows-latest
- name: macos
os: macos-latest

steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Build with electrum feature
run: cargo test --no-default-features --features electrum
- name: Build with esplora feature
run: cargo test --no-default-features --features esplora
- name: Build with no default features
run: cargo test --no-default-features
22 changes: 22 additions & 0 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Format code

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

env:
CARGO_TERM_COLOR: always

jobs:
format:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
components: rustfmt
- name: Format
run: cargo fmt --all -- --check
28 changes: 28 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Lint code

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

env:
CARGO_TERM_COLOR: always

jobs:
lint:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
components: clippy
- name: Lint with all features
run: cargo clippy --lib --all-features -- -D warnings
- name: Lint with no features
run: cargo clippy --lib --no-default-features -- -D warnings
- name: Lint with electrum feature
run: cargo clippy --lib --no-default-features --features electrum -- -D warnings
- name: Lint with esplora feature
run: cargo clippy --lib --no-default-features --features esplora -- -D warnings
62 changes: 26 additions & 36 deletions .github/workflows/checks.yml → .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Code checks
name: Run tests

on:
push:
Expand All @@ -10,57 +10,36 @@ env:
CARGO_TERM_COLOR: always

jobs:
lint:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
components: clippy
- name: Lint with all features
run: cargo clippy --lib --all-features -- -D warnings
- name: Lint with no features
run: cargo clippy --lib --no-default-features -- -D warnings
- name: Lint with electrum feature
run: cargo clippy --lib --no-default-features --features electrum -- -D warnings
- name: Lint with esplora feature
run: cargo clippy --lib --no-default-features --features esplora -- -D warnings

format:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
components: rustfmt
- name: Format
run: cargo fmt --all -- --check

test_and_coverage:
runs-on: ubuntu-latest
timeout-minutes: 30
runs-on: ${{ matrix.os }}
strategy:
matrix:
name: [linux, windows, macos]
include:
- name: linux
os: ubuntu-latest
- name: windows
os: windows-latest
- name: macos
os: macos-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
components: llvm-tools-preview
toolchain: stable

- name: Install llvm-cov
env:
LLVM_COV_RELEASES: https://github.com/taiki-e/cargo-llvm-cov/releases
run: |
host=$(rustc -Vv | grep host | sed 's/host: //')
curl -fsSL $LLVM_COV_RELEASES/latest/download/cargo-llvm-cov-$host.tar.gz | tar xzf - -C "$HOME/.cargo/bin"
- name: Test with all features and generate coverage report
run: cargo llvm-cov --lcov --output-path coverage.lcov --workspace --all-features

- name: Upload coverage report
uses: codecov/codecov-action@v4
with:
Expand All @@ -70,8 +49,19 @@ jobs:
token: ${{ secrets.CODECOV_TOKEN }}

test_features:
runs-on: ubuntu-latest
timeout-minutes: 30
runs-on: ${{ matrix.os }}
strategy:
matrix:
name: [linux, windows, macos]
include:
- name: linux
os: ubuntu-latest
- name: windows
os: windows-latest
- name: macos
os: macos-latest

steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
Expand All @@ -87,6 +77,6 @@ jobs:
cargo test --no-default-features --features esplora go_online::fail
cargo test --no-default-features --features esplora send::min_confirmations_esplora
cargo test --no-default-features --features esplora send::min_relay_fee_esplora
- name: Test with no features
- name: Test with no default features
run: |
cargo test --no-default-features

0 comments on commit e064205

Please sign in to comment.