Skip to content

Commit

Permalink
Merge branch 'improve-ci'
Browse files Browse the repository at this point in the history
  • Loading branch information
faern committed Aug 22, 2024
2 parents 6793345 + 769dd0a commit e56dcf9
Show file tree
Hide file tree
Showing 6 changed files with 174 additions and 85 deletions.
69 changes: 69 additions & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
---
name: Build and test
on:
pull_request:
paths:
- .github/workflows/build-and-test.yml
- '**/*.rs'
- Cargo.toml
- Cargo.lock
workflow_dispatch:

permissions: {}

env:
CARGO_TERM_COLOR: always
RUSTFLAGS: --deny warnings

jobs:
build-and-test:
strategy:
matrix:
# Keep MSRV in sync with rust-version in Cargo.toml
rust: [stable, beta, nightly, 1.64.0]
runs-on: macos-latest
steps:
- uses: actions/checkout@v4

- uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af #v1.0.7
with:
toolchain: ${{ matrix.rust }}
profile: minimal
default: true

- name: Build
run: cargo build --all-targets --locked

- name: Test
run: cargo test --locked

# Make sure documentation builds without warnings (broken links etc)
- name: Generate documentation
if: matrix.rust == 'stable'
run: RUSTDOCFLAGS="--deny warnings" cargo doc

# Make sure the library builds with all dependencies downgraded to their
# oldest versions allowed by the semver spec. This ensures we have not
# under-specified any dependency
minimal-versions:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4

- name: Install stable Rust
uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af #v1.0.7
with:
toolchain: stable
profile: minimal

- name: Install nightly Rust
uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af #v1.0.7
with:
toolchain: nightly
profile: minimal

- name: Downgrade dependencies to minimal versions
run: cargo +nightly update -Z minimal-versions

- name: Compile with minimal versions
run: cargo +stable build --all-targets --locked
85 changes: 0 additions & 85 deletions .github/workflows/ci.yml

This file was deleted.

28 changes: 28 additions & 0 deletions .github/workflows/formatting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
name: Rust formatting
on:
pull_request:
paths:
- .github/workflows/formatting.yml
- '**/*.rs'
workflow_dispatch:

permissions: {}

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

- uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af #v1.0.7
with:
toolchain: stable
profile: minimal
components: rustfmt
default: true

- name: Check formatting
run: |
rustfmt --version
cargo fmt -- --check
28 changes: 28 additions & 0 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
name: Rust linting
on:
pull_request:
paths:
- .github/workflows/linting.yml
- '**/*.rs'
workflow_dispatch:

permissions: {}

jobs:
clippy-linting:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4

- uses: actions-rs/[email protected]
with:
toolchain: stable
profile: minimal
components: clippy
default: true

- name: Clippy check
env:
RUSTFLAGS: --deny warnings
run: cargo clippy --locked --all-targets
48 changes: 48 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions system-configuration/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ repository = "https://github.com/mullvad/system-configuration-rs"
license = "MIT OR Apache-2.0"
readme = "../README.md"
edition = "2021"
rust-version = "1.64.0"

[dependencies]
core-foundation = "0.9"
Expand Down

0 comments on commit e56dcf9

Please sign in to comment.