-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from yanganto/ci
Add CI
- Loading branch information
Showing
8 changed files
with
334 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
name: Build | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
pull_request: | ||
branches: [ master ] | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
|
||
jobs: | ||
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 | ||
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 | ||
features: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
feature: | ||
- esplora_blocking | ||
- log | ||
- 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 }} | ||
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 ] | ||
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 | ||
toolchains: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
toolchain: [ nightly, beta, stable, msrv ] | ||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v4 | ||
- name: Install Nix | ||
uses: cachix/install-nix-action@v26 | ||
- name: Check rgb-interfaces | ||
run: nix develop ".#${{ matrix.toolchain }}" -c cargo check --workspace --all-targets --all-features |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: Codecov | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
pull_request: | ||
branches: [ master ] | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
|
||
jobs: | ||
codecov: | ||
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: 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 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: Lints | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
pull_request: | ||
branches: [ master ] | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
|
||
jobs: | ||
fmt: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/checkout@v4 | ||
- name: Install Nix | ||
uses: cachix/install-nix-action@v26 | ||
- name: Formatting | ||
run: nix develop .#nightly -c cargo 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 | ||
doc: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
name: Tests | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
pull_request: | ||
branches: [ master ] | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
|
||
jobs: | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,3 +11,4 @@ | |
*.swp | ||
|
||
/dep_test | ||
default_*.profraw |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ categories = ["cryptography::cryptocurrencies"] | |
authors = ["Dr Maxim Orlovsky <[email protected]>"] | ||
homepage = "https://github.com/RGB-WG" | ||
repository = "https://github.com/RGB-WG/rgb-interfaces" | ||
rust-version = "1.67" | ||
rust-version = "1.75.0" # rgb-std | ||
edition = "2021" | ||
license = "Apache-2.0" | ||
readme = "README.md" | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
{ | ||
inputs = { | ||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; | ||
rust-overlay = { | ||
url = "github:oxalica/rust-overlay"; | ||
inputs.nixpkgs.follows = "nixpkgs"; | ||
inputs.flake-utils.follows = "flake-utils"; | ||
}; | ||
|
||
flake-utils.url = "github:numtide/flake-utils"; | ||
}; | ||
|
||
outputs = { self, rust-overlay, nixpkgs, flake-utils }: | ||
flake-utils.lib.eachDefaultSystem (system: | ||
let | ||
overlays = [ (import rust-overlay) ]; | ||
pkgs = import nixpkgs { | ||
inherit system overlays; | ||
}; | ||
|
||
cargoToml = builtins.fromTOML (builtins.readFile ./Cargo.toml); | ||
|
||
stableWithLlvm = pkgs.rust-bin.nightly.latest.default.override { | ||
extensions = [ "rustfmt" "llvm-tools-preview" ]; | ||
targets = [ ]; | ||
}; | ||
in | ||
with pkgs; | ||
{ | ||
devShells = rec { | ||
default = msrv; | ||
|
||
msrv = mkShell { | ||
buildInputs = [ | ||
rust-bin.stable."${cargoToml.package."rust-version"}".default | ||
]; | ||
}; | ||
|
||
stable = mkShell { | ||
buildInputs = [ | ||
rust-bin.stable.latest.default | ||
]; | ||
}; | ||
|
||
beta = mkShell { | ||
buildInputs = [ | ||
rust-bin.beta.latest.default | ||
]; | ||
}; | ||
|
||
nightly = mkShell { | ||
buildInputs = [ | ||
rust-bin.nightly.latest.default | ||
]; | ||
}; | ||
|
||
codecov = mkShell { | ||
buildInputs = [ | ||
stableWithLlvm | ||
]; | ||
CARGO_INCREMENTAL = "0"; | ||
RUSTFLAGS = "-Cinstrument-coverage"; | ||
RUSTDOCFLAGS = "-Cinstrument-coverage"; | ||
}; | ||
}; | ||
} | ||
); | ||
} |