Skip to content

Commit

Permalink
chore(ci): modernize configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
paolobarbolini committed Nov 22, 2024
1 parent 24baf67 commit f7ccdcd
Showing 1 changed file with 22 additions and 48 deletions.
70 changes: 22 additions & 48 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,54 +1,35 @@
name: CI

on:
pull_request:
push:
branches:
- main

env:
CARGO_UNSTABLE_SPARSE_REGISTRY: true
on: [push, pull_request]

jobs:
fmt:
name: rustfmt / stable
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- uses: actions-rs/toolchain@v1
- uses: dtolnay/rust-toolchain@stable
with:
profile: minimal
toolchain: stable
override: true

- run: rustup component add rustfmt
components: rustfmt

- uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
- name: Rust rustfmt
run: cargo fmt --all -- --check

clippy:
name: clippy / stable
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- uses: actions-rs/toolchain@v1
- uses: dtolnay/rust-toolchain@stable
with:
profile: minimal
toolchain: stable
override: true

- run: rustup component add clippy
components: clippy

- uses: actions-rs/cargo@v1
with:
command: clippy
args: -- -D warnings
- name: Run clippy
run: cargo clippy -- -D warnings

test:
name: test / ${{ matrix.name }}
Expand All @@ -67,33 +48,26 @@ jobs:
rust: 1.63.0

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- uses: actions-rs/toolchain@v1
- uses: dtolnay/rust-toolchain@master
with:
profile: minimal
toolchain: ${{ matrix.rust }}
override: true

- uses: actions-rs/cargo@v1
with:
command: test
- name: Run tests
run: cargo test

coverage:
name: coverage / stable
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: dtolnay/rust-toolchain@stable

- name: Install cargo-tarpaulin
run: |
LINK="https://github.com/xd009642/tarpaulin/releases/download/0.20.1/cargo-tarpaulin-0.20.1-travis.tar.gz"
LINK="https://github.com/xd009642/tarpaulin/releases/download/0.31.2/cargo-tarpaulin-x86_64-unknown-linux-gnu.tar.gz"
curl -L --output tarpaulin.tar.gz "$LINK"
tar -xzvf tarpaulin.tar.gz
chmod +x cargo-tarpaulin
Expand All @@ -102,12 +76,12 @@ jobs:
run: ./cargo-tarpaulin tarpaulin --out Xml

- name: Upload to codecov.io
uses: codecov/codecov-action@v2
with:
token: ${{secrets.CODECOV_TOKEN}}
uses: codecov/codecov-action@v5
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

- name: Archive code coverage results
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: code-coverage-report
path: cobertura.xml

0 comments on commit f7ccdcd

Please sign in to comment.