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 20, 2024
1 parent 538d317 commit ef448ef
Show file tree
Hide file tree
Showing 9 changed files with 105 additions and 302 deletions.
87 changes: 32 additions & 55 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,95 +2,72 @@ 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

jobs:
cli:
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- name: checkout
uses: actions/checkout@v4
- name: Install Nix
uses: cachix/install-nix-action@v26
- name: Check rgb-wallet
run: nix run .#rgb -- -V | grep rgb-wallet
default:
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
- name: Install Nix
uses: cachix/install-nix-action@v26
- name: Latest Ubuntu build check no features
run: nix develop .#stable -c cargo check --workspace --no-default-features
- uses: dtolnay/rust-toolchain@stable
- run: cargo check --workspace --no-default-features
features:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
feature:
- fs
- cli
- esplora_blocking
- log
- electrum_blocking
- mempool_blocking
- serde
steps:
- uses: actions/checkout@v4
- 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-11, macos-12, windows-2019, windows-2022 ]
os: [ ubuntu-22.04, ubuntu-latest, macos-13, macos-latest, windows-2019, windows-latest ]
steps:
- uses: actions/checkout@v4
# NOTE: Dont use nix in platform checks everything should 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.76.0 ]
steps:
- name: checkout
uses: actions/checkout@v4
- name: Install Nix
uses: cachix/install-nix-action@v26
- name: Check rgb
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 --tests
- 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 to Codecov
- 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
38 changes: 22 additions & 16 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,26 +15,31 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- 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
- 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
- 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
- name: Install Nix
uses: cachix/install-nix-action@v26
- name: Doc
run: nix develop .#nightly -c cargo doc --workspace --all-features
- 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 --tests
- 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
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ fs = ["serde", "bp-wallet/fs", "rgb-std/fs"]
cli = ["fs", "bp-wallet/cli"]
esplora_blocking = ["bp-esplora"]
electrum_blocking = ["bp-electrum"]
serde = ["serde_crate", "serde_yaml", "bp-std/serde", "descriptors/serde", "rgb-psbt/serde"]
mempool_blocking = ["esplora_blocking"]
serde = ["serde_crate", "serde_yaml", "bp-std/serde", "descriptors/serde", "rgb-psbt/serde"]

[package.metadata.docs.rs]
features = ["all"]
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ ARG SRC_DIR=/usr/local/src/rgb
ARG BUILDER_DIR=/srv/rgb

# Base image
FROM rust:1.66.0-slim-bullseye as chef
FROM rust:1.76.0-slim-bookworm as chef

ARG SRC_DIR
ARG BUILDER_DIR
Expand Down
2 changes: 1 addition & 1 deletion cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ bp-wallet = { workspace = true, features = ["cli"] }
psbt = { workspace = true }
rgb-std = { workspace = true, features = ["serde"] }
rgb-interfaces = { workspace = true }
rgb-runtime = { version = "0.11.0-beta.6", path = "..", features = ["electrum_blocking", "esplora_blocking", "log", "serde", "fs", "cli"] }
rgb-runtime = { version = "0.11.0-beta.7", path = "..", features = ["electrum_blocking", "esplora_blocking", "log", "serde", "fs", "cli"] }
log = { workspace = true }
env_logger = "0.11.5"
clap = { version = "4.5.16", features = ["derive", "env"] }
Expand Down
Loading

0 comments on commit ef448ef

Please sign in to comment.