Skip to content

Commit

Permalink
ci: modernize workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-orlovsky committed Aug 18, 2024
1 parent 9009cb4 commit 9f6cdc2
Show file tree
Hide file tree
Showing 8 changed files with 108 additions and 232 deletions.
71 changes: 33 additions & 38 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,15 @@ name: Build

on:
push:
branches: [ master ]
branches:
- master
tags:
- 'v[0-9]+\.*'
pull_request:
branches: [ master ]
branches:
- master
- develop
- 'v[0-9]+.[0-9]+'

env:
CARGO_TERM_COLOR: always
Expand All @@ -14,63 +20,52 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# NOTE: Dont use nix here, everything should be based on the ubuntu-latest
- name: Install rust stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Latest Ubuntu build check
uses: actions-rs/cargo@v1
with:
command: check
args: --workspace
- uses: dtolnay/rust-toolchain@stable
- run: cargo check --workspace
no-default:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- run: cargo check --workspace --no-default-features
features:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
feature:
- signers
- client-side-validation
- strict_encoding
- client-side-validation
- serde
steps:
- uses: actions/checkout@v4
- name: Install Nix
uses: cachix/install-nix-action@v26
- name: Check feature ${{ matrix.feature }} only
run: nix develop .#stable -c cargo check --no-default-features --features=${{ matrix.feature }}
- name: Check feature ${{ matrix.feature }} with defaults
run: nix develop .#stable -c cargo check --features=${{ matrix.feature }}
- uses: dtolnay/rust-toolchain@stable
- name: Feature ${{matrix.feature}}
run: cargo check --workspace --no-default-features --features=${{matrix.feature}}
- name: Feature ${{matrix.feature}}
run: cargo check --workspace --features=${{matrix.feature}}
platforms:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-20.04, ubuntu-22.04, macos-12, macos-13, windows-2019, windows-2022 ]
os: [ ubuntu-22.04, ubuntu-latest, macos-13, macos-latest, windows-2019, windows-latest ]
steps:
- uses: actions/checkout@v4
# NOTE: Don't use nix in platform checks everything should be based on the host system
- name: Install rust stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Build with all features
uses: actions-rs/cargo@v1
with:
command: check
args: --workspace --all-targets --all-features
- uses: dtolnay/rust-toolchain@stable
- name: Platform ${{matrix.os}}
run: cargo check --workspace --all-features # we skip test targets here to be sure that the main library can be built
toolchains:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
toolchain: [ nightly, beta, stable, msrv ]
toolchain: [ nightly, beta, stable, 1.75.0 ]
steps:
- uses: actions/checkout@v2
- name: Install Nix
uses: cachix/install-nix-action@v26
- name: Check Crates
run: nix develop ".#${{ matrix.toolchain }}" -c cargo check --workspace --all-targets --all-features
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{matrix.toolchain}}
- name: Toolchain ${{matrix.toolchain}}
run: cargo +${{matrix.toolchain}} check --workspace --all-targets --all-features
41 changes: 23 additions & 18 deletions .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,15 @@ name: Codecov

on:
push:
branches: [ master ]
branches:
- master
tags:
- 'v[0-9]+\.*'
pull_request:
branches: [ master ]
branches:
- master
- develop
- 'v[0-9]+.[0-9]+'

env:
CARGO_TERM_COLOR: always
Expand All @@ -14,22 +20,21 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Nix
uses: cachix/install-nix-action@v26
- name: Build
run: nix develop .#codecov -c cargo build --release
- name: Test
run: nix develop .#codecov -c cargo test --all-features --no-fail-fast
- name: Install grcov
run: nix develop .#codecov -c cargo install grcov
- name: Generate coverage
run: nix develop .#codecov -c grcov . --binary-path target/debug/deps/ -s . -t lcov --branch --ignore-not-existing --ignore '../**' --ignore '/*' -o coverage.lcov
- name: Upload coverage
- uses: dtolnay/rust-toolchain@nightly
with:
components: llvm-tools-preview
- uses: taiki-e/install-action@cargo-llvm-cov
- uses: taiki-e/install-action@nextest
- name: Collect coverage data (including doctests)
run: |
cargo +nightly llvm-cov --no-report nextest --workspace --all-features
cargo +nightly llvm-cov --no-report --doc --workspace --all-features
cargo +nightly llvm-cov report --doctests --lcov --output-path lcov.info
- name: Upload coverage data to codecov
uses: codecov/codecov-action@v4
with:
files: ./coverage.lcov
flags: rust
# TODO: set true when CODECOV_TOKEN is set
fail_ci_if_error: false
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
files: lcov.info
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
37 changes: 23 additions & 14 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
name: Lints

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
branches:
- master
- develop
- 'v[0-9]+.[0-9]+'

env:
CARGO_TERM_COLOR: always
Expand All @@ -14,23 +15,31 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Nix
uses: cachix/install-nix-action@v26
- uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt
- name: Formatting
run: nix develop .#nightly -c cargo fmt --all -- --check
run: cargo +nightly fmt --all -- --check
clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Nix
uses: cachix/install-nix-action@v26
- name: Clippy
run: nix develop .#stable -c cargo clippy --workspace --all-features --all-targets -- -D warnings
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- name: Formatting
run: cargo clippy --workspace --all-features --all-targets -- -D warnings
doc:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Nix
uses: cachix/install-nix-action@v26
- name: Doc
run: nix develop .#nightly -c cargo doc --workspace --all-features
- uses: dtolnay/rust-toolchain@nightly
with:
components: rust-docs
- name: Formatting
run: cargo +nightly doc --workspace --all-features
typos:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: crate-ci/typos@master
31 changes: 25 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,38 @@ name: Tests

on:
push:
branches: [ master ]
branches:
- master
tags:
- 'v[0-9]+\.*'
pull_request:
branches: [ master ]
branches:
- master
- develop
- 'v[0-9]+.[0-9]+'

env:
CARGO_TERM_COLOR: always

jobs:
testing:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, macos-13, macos-latest, windows-latest ]
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Test ${{matrix.os}}
run: cargo test --workspace --all-features --no-fail-fast
wasm-testing:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Nix
uses: cachix/install-nix-action@v26
- name: Build & test
run: nix develop .#stable -c cargo test --workspace --all-features --no-fail-fast --lib
- uses: dtolnay/rust-toolchain@nightly
- uses: jetli/[email protected]
- name: Add wasm32 target
run: rustup target add wasm32-unknown-unknown
- name: Test in headless Chrome
run: wasm-pack test --headless --chrome
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ categories = ["cryptography::cryptocurrencies"]
authors = ["Dr Maxim Orlovsky <[email protected]>"]
homepage = "https://lnp-bp.org"
repository = "https://github.com/BP-WG/bp-wallet"
rust-version = "1.75.0" # Due to descriptors
rust-version = "1.75.0" # Due to amplify
edition = "2021"
license = "Apache-2.0"

Expand Down Expand Up @@ -58,7 +58,7 @@ serde_crate = { workspace = true, optional = true }

[features]
default = []
all = ["signers", "client-side-validation", "strict_encoding", "serde"]
all = ["signers", "client-side-validation", "strict_encoding", "serde", "psbt/all"]
signers = ["secp256k1/global-context", "secp256k1/rand-std"]
strict_encoding = ["psbt/strict_encoding"]
client-side-validation = ["bp-core", "psbt/client-side-validation"]
Expand Down
4 changes: 2 additions & 2 deletions MANIFEST.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
Name: bp-wallet
Name: bp-std
Type: Library
Kind: Free software
License: Apache-2.0
Language: Rust
Compiler: 1.69
Compiler: 1.75
Author: Maxim Orlovsky
Maintained: LNP/BP Standards Association, Switzerland
Maintainers:
Expand Down
85 changes: 0 additions & 85 deletions flake.lock

This file was deleted.

Loading

0 comments on commit 9f6cdc2

Please sign in to comment.