Skip to content

Commit

Permalink
Update CI jobs
Browse files Browse the repository at this point in the history
Replaces some of the jobs with reusable workflows, and others
with more modern actions.
  • Loading branch information
HDauven committed Oct 18, 2023
1 parent 8f9cf5a commit 5487338
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 114 deletions.
136 changes: 23 additions & 113 deletions .github/workflows/dusk_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,35 +7,15 @@ name: Continuous integration

jobs:
analyze:
name: Dusk Analyzer
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
- uses: actions-rs/cargo@v1
with:
command: install
args: --git https://github.com/dusk-network/cargo-dusk-analyzer
- uses: actions-rs/cargo@v1
with:
command: dusk-analyzer
name: Code Analysis
uses: dusk-network/.github/.github/workflows/code-analysis.yml@main
with:
clippy_default: false
clippy_args: --features=rkyv/size_32

fmt:
name: Check code formatting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
- run: rustup component add rustfmt
- uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
dusk_analyzer:
name: Dusk Analyzer
uses: dusk-network/.github/.github/workflows/dusk-analysis.yml@main

build_docs:
name: Build documentation
Expand All @@ -47,101 +27,31 @@ jobs:

build_no_std:
name: Build no_std
strategy:
fail-fast: false
matrix:
toolchain:
- nightly
target: [ thumbv6m-none-eabi ]
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v2

- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.toolchain }}

- name: Add target
run: rustup target add ${{ matrix.target }}

- name: Run cargo check
uses: actions-rs/cargo@v1
with:
command: check
args: --all-targets
- uses: actions/checkout@v3
- run: rustup target add thumbv6m-none-eabi
- uses: Swatinem/rust-cache@v2

- name: Build project with alloc
uses: actions-rs/cargo@v1
with:
command: build
args: --release --no-default-features --features alloc --target ${{ matrix.target }}
run: cargo build --release --no-default-features --features alloc --target thumbv6m-none-eabi

- name: Build project without alloc
uses: actions-rs/cargo@v1
with:
command: build
args: --release --no-default-features --target ${{ matrix.target }}
run: cargo build --release --no-default-features --target thumbv6m-none-eabi

ci:
name: Test with all features
strategy:
fail-fast: false
matrix:
toolchain:
- nightly
os:
- ubuntu-latest
runs-on: ${{ matrix.os }}
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v2

- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.toolchain }}

- name: Run cargo check
uses: actions-rs/cargo@v1
with:
command: check
args: --all-targets

- name: Test project
if: ${{ matrix.os != 'ubuntu-latest' || matrix.toolchain != 'nightly' }}
uses: actions-rs/cargo@v1
with:
command: test
args: --release --all-features

- name: Install kcov
if: ${{ matrix.os == 'ubuntu-latest' && matrix.toolchain == 'nightly' }}
run: sudo apt install -y kcov

- name: Build test executable
if: ${{ matrix.os == 'ubuntu-latest' && matrix.toolchain == 'nightly' }}
uses: actions-rs/cargo@v1
env:
RUSTFLAGS: '-Cdebuginfo=2 -Cinline-threshold=0 -Clink-dead-code'
RUSTDOCFLAGS: '-Cdebuginfo=2 -Cinline-threshold=0 -Clink-dead-code'
with:
command: test
args: --release --all-features --no-run

- name: Test with kcov
if: ${{ matrix.os == 'ubuntu-latest' && matrix.toolchain == 'nightly' }}
# Find every executable resulting from building the tests and run each
# one of them with kcov. This ensures all the code we cover is measured.
run: >
find target/release/deps -type f -executable ! -name "*.*" |
- uses: actions/checkout@v3
- run: sudo apt install -y kcov
- uses: Swatinem/rust-cache@v2
- name: Collect coverage
run: |
RUSTFLAGS='-C link-dead-code' cargo test --release --no-run --all-features
find target/debug/deps -type f -executable ! -name "*.*" |
xargs -n1 kcov --exclude-pattern=/.cargo,/usr/lib --verify target/cov
- name: Upload coverage
if: ${{ matrix.os == 'ubuntu-latest' && matrix.toolchain == 'nightly' }}
uses: codecov/[email protected]
uses: codecov/codecov-action@v3
with:
token: ${{secrets.CODECOV_TOKEN}}
token: ${{secrets.CODECOV_TOKEN}}
1 change: 0 additions & 1 deletion rust-toolchain

This file was deleted.

3 changes: 3 additions & 0 deletions rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[toolchain]
channel = "nightly-2023-05-24"
components = ["rustfmt", "clippy"]

0 comments on commit 5487338

Please sign in to comment.