Skip to content

Commit

Permalink
ci: Improve GitHub actions
Browse files Browse the repository at this point in the history
* CI: Simplify workflow, restrict permissions, test more extensively
* CI: Added dependabot
* Bump MSRV
  • Loading branch information
pentamassiv authored Oct 22, 2023
1 parent 060e9e4 commit 1fe4793
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 67 deletions.
14 changes: 14 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: 2
updates:

# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"

# Maintain dependencies for cargo
- package-ecosystem: "cargo"
directory: "/"
schedule:
interval: "daily"
100 changes: 35 additions & 65 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,93 +18,63 @@

name: CI

permissions:
contents: read
on:
push:
branches:
- master
pull_request:
workflow_dispatch:

env:
RUSTFLAGS: -Dwarnings
clippy_version: 1.60.0
CARGO_TERM_COLOR: always

jobs:
rustfmt:
name: rustfmt
CI:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- rust: stable
rust:
- stable
- beta
- nightly
- 1.58.1

steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Install Rust
uses: actions-rs/toolchain@v1
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
profile: minimal
override: true
components: rustfmt
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v1
- name: Run rustfmt
if: matrix.rust == 'stable' # Avoid differences between the versions
run: cargo fmt --check

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

steps:
- uses: actions/checkout@v3
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ env.clippy_version }}
override: true
components: clippy
- uses: Swatinem/rust-cache@v1
- name: Run Clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: --all --tests --all-features

test:
runs-on: ubuntu-latest
strategy:
matrix:
toolchain:
- stable
- beta
- nightly

steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.toolchain }}
override: true
- uses: Swatinem/rust-cache@v1

- name: Test
if: matrix.rust == 'stable' # Avoid differences between the versions
run: cargo clippy --all-features
- name: Check clippy lints for the examples
if: matrix.rust == 'stable' # Avoid differences between the versions
run: cargo clippy --all-features --examples
- name: Check clippy lints for the tests
if: matrix.rust == 'stable' # Avoid differences between the versions
run: cargo clippy --all-features --tests
- name: Build the crate
run: cargo build --all-features
- name: Build the examples
run: cargo build --all-features --examples
- name: Run the tests
run: cargo test
- name: Run the tests with all features enabled
run: cargo test --all-features
- name: Build the docs
run: cargo doc
- name: Build the docs with all features enabled
run: cargo doc --all-features

msrv:
name: Build MSRV
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: 1.48.0
override: true
- uses: Swatinem/rust-cache@v1
- name: Build
run: cargo build


2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ description = "A library for working with X11 keysyms"
repository = "https://github.com/notgull/xkeysym"
license = "MIT OR Apache-2.0 OR Zlib"
keywords = ["x11", "keysym", "keysyms"]
rust-version = "1.48.0"
rust-version = "1.58.1"

[dev-dependencies]
bytemuck = "1.12.3"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ In addition, this crate contains no unsafe code and is fully compatible with

## MSRV Policy

The Minimum Safe Rust Version for this crate is **1.48.0**.
The Minimum Safe Rust Version for this crate is **1.58.1**.

## License

Expand Down

0 comments on commit 1fe4793

Please sign in to comment.