Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: split up CI jobs #52

Merged
merged 3 commits into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions .github/workflows/ci.yml
Copy link
Member Author

@robjtede robjtede Oct 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MrCroxx much of this CI setup is inspired by my other projects, happy to take questions about motivation for any changes

for example: only running tests in this file (used for the readme badge) prevents non-critical failures like formatting from surfacing there

Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: CI

on:
pull_request:
types: [opened, synchronize, reopened]
merge_group:
types: [checks_requested]
push:
branches: [master]

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
CARGO_TERM_COLOR: always

jobs:
read_msrv:
name: Read MSRV
uses: actions-rust-lang/msrv/.github/workflows/msrv.yml@v0.1.0

rust:
needs: read_msrv

strategy:
fail-fast: false
matrix:
os:
- { name: Linux, runner: ubuntu-latest }
- { name: macOS, runner: macos-latest }
- { name: Windows, runner: windows-latest }
toolchain:
- { name: stable, version: stable }
- { name: msrv, version: "${{ needs.read_msrv.outputs.msrv }}" }

name: ${{ matrix.os.name }} / ${{ matrix.toolchain.name }}
runs-on: ${{ matrix.os.runner }}

steps:
- uses: actions/checkout@v4

- name: Install Rust (${{ matrix.toolchain.name }})
uses: actions-rust-lang/setup-rust-toolchain@v1.10.1
with:
toolchain: ${{ matrix.toolchain.version }}

- name: Install just, nextest
uses: taiki-e/install-action@v2.44.25
with:
tool: just,nextest

- name: Test
run: just test
39 changes: 39 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Coverage

on:
push:
branches: [master]

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install Rust
uses: actions-rust-lang/setup-rust-toolchain@v1.10.1
with:
components: llvm-tools-preview

- name: Install just & cargo-llvm-cov
uses: taiki-e/install-action@v2.44.5
with:
tool: just,cargo-llvm-cov

- name: Generate code coverage
run: just test-coverage-codecov

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4.5.0
with:
files: codecov.json
fail_ci_if_error: true
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
84 changes: 84 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: Lint

on:
pull_request:
types: [opened, synchronize, reopened]

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
clippy:
runs-on: ubuntu-latest

permissions:
contents: read
checks: write

steps:
- uses: actions/checkout@v4

- name: Install Rust
uses: actions-rust-lang/setup-rust-toolchain@v1.10.1
with:
components: clippy

- name: Install just, cargo-hack
uses: taiki-e/install-action@v2.44.25
with:
tool: just,cargo-hack

- name: Check with Clippy
run: just clippy

rustfmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install Rust (nightly)
uses: actions-rust-lang/setup-rust-toolchain@v1.10.1
with:
toolchain: nightly
components: rustfmt

- name: Check with Rustfmt
run: cargo fmt -- --check

docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install Rust (nightly)
uses: actions-rust-lang/setup-rust-toolchain@v1.10.1
with:
toolchain: nightly
components: rust-docs

- name: Check for broken intra-doc links
env:
RUSTDOCFLAGS: -D warnings
run: cargo doc --workspace --no-deps --all-features

sorted-deps:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install Rust
uses: actions-rust-lang/setup-rust-toolchain@v1.10.1
with:
components: clippy

- name: Install just, cargo-sort
uses: taiki-e/install-action@v2.44.25
with:
tool: just,cargo-sort

- name: Check dependency requirements are sorted lexicographically
run: cargo sort --workspace --check
70 changes: 0 additions & 70 deletions .github/workflows/rust.yml

This file was deleted.

14 changes: 6 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
[package]
name = "bytesize"
description = "A utility for human-readable bytes representations. Forked from https://github.com/hyunsik/bytesize ."
version = "1.4.0-dev"
description = "A utility for human-readable byte count representations"
version = "1.3.0"
authors = ["Hyunsik Choi <hyunsik.choi@gmail.com>", "MrCroxx <mrcroxx@outlook.com>"]
edition = "2021"

homepage = "https://github.com/hyunsik/bytesize/"
documentation = "https://docs.rs/bytesize/"
repository = "https://github.com/hyunsik/bytesize/"
readme = "README.md"
keywords = ["byte", "byte-size", "utility", "human-readable", "format"]
categories = ["development-tools", "filesystem"]
repository = "https://github.com/hyunsik/bytesize"
license = "Apache-2.0"
edition = "2021"
rust-version = "1.65"

[dependencies]
arbitrary = { version = "1", features = ["derive"], optional = true }
Expand Down
8 changes: 0 additions & 8 deletions Makefile

This file was deleted.

Loading