Skip to content

Commit f401ac4

Browse files
authored
chore: modernize codebase and CI (#15)
Update to Rust edition 2024, remove wildcard imports, add GitHub Actions CI, configure linting and formatting tools, etc.
1 parent 73270b4 commit f401ac4

24 files changed

Lines changed: 1578 additions & 432 deletions

.github/dependabot.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "cargo"
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"
7+
assignees:
8+
- "CBenoit"
9+
open-pull-requests-limit: 3
10+
groups:
11+
windows:
12+
patterns:
13+
- "windows*"
14+
- "winreg"
15+
patch:
16+
dependency-type: "production"
17+
update-types:
18+
- "patch"
19+
dev:
20+
dependency-type: "development"

.github/workflows/ci.yml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
types: [opened, synchronize, reopened]
9+
workflow_dispatch:
10+
11+
env:
12+
# Disable incremental compilation. CI builds are often closer to from-scratch builds, as changes
13+
# are typically bigger than from a local edit-compile cycle.
14+
# Incremental compilation also significantly increases the amount of IO and the size of ./target
15+
# folder, which makes caching less effective.
16+
CARGO_INCREMENTAL: 0
17+
CARGO_NET_RETRY: 10
18+
RUSTUP_MAX_RETRIES: 10
19+
RUST_BACKTRACE: short
20+
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
21+
# Cache should never take more than a few seconds to get downloaded.
22+
# If it does, let's just rebuild from scratch instead of hanging "forever".
23+
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 1
24+
# Disabling debug info so compilation is faster and ./target folder is smaller.
25+
CARGO_PROFILE_DEV_DEBUG: 0
26+
27+
jobs:
28+
formatting:
29+
name: Check formatting
30+
runs-on: ubuntu-latest
31+
32+
steps:
33+
- uses: actions/checkout@v4
34+
35+
- name: Check formatting
36+
run: cargo fmt --all --check
37+
38+
checks:
39+
name: Checks [${{ matrix.os }}]
40+
runs-on: ${{ matrix.runner }}
41+
needs: formatting
42+
strategy:
43+
fail-fast: false
44+
matrix:
45+
os: [windows, linux, macos]
46+
include:
47+
- os: windows
48+
runner: windows-latest
49+
- os: linux
50+
runner: ubuntu-latest
51+
- os: macos
52+
runner: macos-latest
53+
54+
steps:
55+
- uses: actions/checkout@v4
56+
57+
- name: Rust cache
58+
uses: Swatinem/rust-cache@v2.8.2
59+
60+
- name: Lints
61+
run: cargo clippy --workspace --all-features --tests -v -- -Dwarnings
62+
63+
- name: Tests
64+
run: cargo test --workspace -v
65+
66+
success:
67+
name: Success
68+
runs-on: ubuntu-latest
69+
if: ${{ always() }}
70+
needs:
71+
- formatting
72+
- checks
73+
74+
steps:
75+
- name: CI succeeded
76+
id: succeeded
77+
if: ${{ !contains(needs.*.result, 'failure') }}
78+
run: exit 0
79+
80+
- name: CI failed
81+
if: ${{ steps.succeeded.outcome == 'skipped' }}
82+
run: exit 1
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Release crates
2+
3+
permissions:
4+
pull-requests: write
5+
contents: write
6+
7+
on:
8+
workflow_dispatch:
9+
push:
10+
branches:
11+
- master
12+
13+
jobs:
14+
# Create a PR with the new versions and changelog, preparing the next release.
15+
open-pr:
16+
name: Open release PR
17+
environment: cratesio-publish
18+
runs-on: ubuntu-latest
19+
concurrency:
20+
group: release-plz-${{ github.ref }}
21+
cancel-in-progress: false
22+
23+
steps:
24+
- name: Checkout repository
25+
uses: actions/checkout@v4
26+
with:
27+
fetch-depth: 512
28+
29+
- name: Run release-plz
30+
id: release-plz
31+
uses: Devolutions/actions-public/release-plz@v1
32+
with:
33+
command: release-pr
34+
git-name: Devolutions Bot
35+
git-email: bot@devolutions.net
36+
github-token: ${{ secrets.DEVOLUTIONSBOT_WRITE_TOKEN }}
37+
38+
# Release unpublished packages.
39+
release:
40+
name: Release crates
41+
runs-on: ubuntu-latest
42+
permissions:
43+
id-token: write
44+
45+
steps:
46+
- name: Checkout repository
47+
uses: actions/checkout@v4
48+
49+
- name: Authenticate with crates.io
50+
id: auth
51+
uses: rust-lang/crates-io-auth-action@v1
52+
53+
- name: Run release-plz
54+
uses: Devolutions/actions-public/release-plz@v1
55+
with:
56+
command: release
57+
registry-token: ${{ steps.auth.outputs.token }}

.gitignore

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
/target/
2-
Cargo.lock
32
.vs/
43
.idea/
54
.DS_Store
65
cmake-build-*
7-
8-
# These are backup files generated by rustfmt
9-
**/*.rs.bk

.travis.yml

Lines changed: 0 additions & 75 deletions
This file was deleted.

0 commit comments

Comments
 (0)