Skip to content

Commit

Permalink
Merge pull request #4 from wiktor-k/wiktor/update-deps
Browse files Browse the repository at this point in the history
Update dependencies
  • Loading branch information
wiktor-k authored Oct 16, 2024
2 parents 2551a04 + fb509d7 commit 92ac809
Show file tree
Hide file tree
Showing 8 changed files with 304 additions and 223 deletions.
6 changes: 6 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Ubuntu packages
UBUNTU_PACKAGES=libpcsclite-dev
# Windows packages
WINDOWS_PACKAGES=
# macOS packages
MACOS_PACKAGES=
30 changes: 9 additions & 21 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,21 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: cargo install --locked just
- run: sudo apt-get install -y codespell
- name: Check spelling
run: just spelling
uses: codespell-project/actions-codespell@v2

formatting:
name: Check formatting
strategy:
matrix:
include:
- os: ubuntu-latest
libs: libpcsclite-dev
- os: macos-latest
- os: windows-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- run: cargo install --locked just
- uses: taiki-e/install-action@just
- run: rustup install nightly
- run: rustup component add rustfmt --toolchain nightly
- name: Check formatting
Expand All @@ -47,30 +44,23 @@ jobs:
matrix:
include:
- os: ubuntu-latest
libs: libpcsclite-dev
- os: macos-latest
- os: windows-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- run: sudo apt-get update && sudo apt-get install -y ${{ matrix.libs }}
if: ${{ matrix.libs }}
- run: cargo install --locked just
- uses: taiki-e/install-action@just
- run: just install-packages
- name: Run unit tests
run: just tests

deps:
name: Check dependencies
strategy:
matrix:
include:
- os: ubuntu-latest
- os: macos-latest
- os: windows-latest
runs-on: ${{ matrix.os }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: cargo install --locked just cargo-deny
- uses: taiki-e/install-action@just
- uses: taiki-e/install-action@cargo-deny
- name: Run dependencies check
run: just dependencies

Expand All @@ -80,14 +70,12 @@ jobs:
matrix:
include:
- os: ubuntu-latest
libs: libpcsclite-dev
- os: macos-latest
- os: windows-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- run: sudo apt-get update && sudo apt-get install -y ${{ matrix.libs }}
if: ${{ matrix.libs }}
- run: cargo install --locked just
- uses: taiki-e/install-action@just
- run: just install-packages
- name: Check for lints
run: just lints
21 changes: 20 additions & 1 deletion .justfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
#!/usr/bin/env -S just --working-directory . --justfile
# Load project-specific properties from the `.env` file

set dotenv-load := true

# Since this is a first recipe it's being run by default.
# Faster checks need to be executed first for better UX. For example

# codespell is very fast. cargo fmt does not need to download crates etc.

# Perform all checks
check: spelling formatting docs lints dependencies tests

# Checks common spelling mistakes
Expand Down Expand Up @@ -31,6 +36,16 @@ tests:
docs:
cargo doc --no-deps

# Installs packages required to build
[linux]
install-packages:
sudo apt-get install --assume-yes --no-install-recommends $UBUNTU_PACKAGES

[macos]
[windows]
install-packages:
echo no-op

# Checks for commit messages
check-commits REFS='main..':
#!/usr/bin/env bash
Expand All @@ -57,13 +72,17 @@ check-commits REFS='main..':
# Fixes common issues. Files need to be git add'ed
fix:
#!/usr/bin/env bash
set -euo pipefail
if ! git diff-files --quiet ; then
echo "Working tree has changes. Please stage them: git add ."
exit 1
fi
codespell --write-changes
just --unstable --fmt
# try to fix rustc issues
cargo fix --allow-staged
# try to fix clippy issues
cargo clippy --fix --allow-staged

# fmt must be last as clippy's changes may break formatting
Expand Down
Loading

0 comments on commit 92ac809

Please sign in to comment.