Skip to content
Draft
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
11 changes: 11 additions & 0 deletions .clippy.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
allow-dbg-in-tests = true
allow-expect-in-tests = true
allow-indexing-slicing-in-tests = true
allow-print-in-tests = true
allow-unwrap-in-tests = true
cognitive-complexity-threshold = 30
large-error-threshold = 256
msrv = "1.95.0"
too-many-arguments-threshold = 8
too-many-lines-threshold = 120
type-complexity-threshold = 300
6 changes: 3 additions & 3 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space
indent_size = 2
indent_size = 4

[*.md]
trim_trailing_whitespace = false
[*.{toml,yml,yaml}]
indent_size = 2
77 changes: 77 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: CI

on:
pull_request:
branches:
- main
merge_group:
workflow_dispatch:

permissions:
contents: read

env:
CARGO_TERM_COLOR: always

jobs:
validate:
name: Validate ${{ matrix.name }}
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
include:
- name: ubuntu-24.04
os: ubuntu-24.04

- name: windows-2025
os: windows-2025

- name: macos-15-arm64
os: macos-15

steps:
- name: Checkout
uses: actions/checkout@v5

- name: Show Rust toolchain
run: rustup show

- name: Cargo metadata
run: cargo metadata --locked --format-version 1 --no-deps

- name: Format check
run: cargo fmt --all -- --check

- name: Clippy
run: cargo clippy --all-targets --all-features -- -D warnings

- name: Test
run: cargo test --all-features --locked

- name: Build
run: cargo build --release --locked

required:
name: CI Required
runs-on: ubuntu-24.04
needs:
- validate
if: always()

steps:
- name: Check required jobs
shell: bash
run: |
if [[ "${{ contains(needs.*.result, 'failure') }}" == "true" ]]; then
echo "One or more required jobs failed."
exit 1
fi

if [[ "${{ contains(needs.*.result, 'cancelled') }}" == "true" ]]; then
echo "One or more required jobs were cancelled."
exit 1
fi

echo "All required jobs passed."
131 changes: 131 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
name: Release binaries

on:
push:
tags:
- "v*.*.*"

permissions:
contents: write

env:
CARGO_TERM_COLOR: always

jobs:
build:
name: Build ${{ matrix.target }}
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-24.04
target: x86_64-unknown-linux-gnu

- os: windows-2025
target: x86_64-pc-windows-msvc

- os: macos-15-intel
target: x86_64-apple-darwin

- os: macos-15
target: aarch64-apple-darwin

steps:
- name: Checkout
uses: actions/checkout@v5

- name: Show Rust toolchain
run: rustup show

- name: Add target
run: rustup target add ${{ matrix.target }}

- name: Test
run: cargo test --all-features --locked

- name: Build binaries
run: cargo build --release --locked --target ${{ matrix.target }}

- name: Package Unix binaries
if: runner.os != 'Windows'
shell: bash
run: |
set -euo pipefail

rm -rf dist package
mkdir -p dist package

cp "target/${{ matrix.target }}/release/rustuse" package/
cp "target/${{ matrix.target }}/release/cargo-rustuse" package/

cp README.md package/ || true
cp LICENSE-MIT package/ || true
cp LICENSE-APACHE package/ || true

tar -C package -czf "dist/rustuse-${{ github.ref_name }}-${{ matrix.target }}.tar.gz" .

- name: Package Windows binaries
if: runner.os == 'Windows'
shell: pwsh
run: |
Remove-Item -Recurse -Force dist, package -ErrorAction SilentlyContinue

New-Item -ItemType Directory -Force dist | Out-Null
New-Item -ItemType Directory -Force package | Out-Null

Copy-Item "target/${{ matrix.target }}/release/rustuse.exe" package/
Copy-Item "target/${{ matrix.target }}/release/cargo-rustuse.exe" package/

if (Test-Path README.md) {
Copy-Item README.md package/
}

if (Test-Path LICENSE-MIT) {
Copy-Item LICENSE-MIT package/
}

if (Test-Path LICENSE-APACHE) {
Copy-Item LICENSE-APACHE package/
}

Compress-Archive `
-Path package/* `
-DestinationPath "dist/rustuse-${{ github.ref_name }}-${{ matrix.target }}.zip" `
-Force

- name: Upload packaged binary
uses: actions/upload-artifact@v6
with:
name: rustuse-${{ matrix.target }}
path: dist/*
if-no-files-found: error

publish:
name: Publish GitHub Release
needs:
- build
runs-on: ubuntu-24.04

steps:
- name: Checkout
uses: actions/checkout@v5

- name: Download packaged binaries
uses: actions/download-artifact@v7
with:
path: dist
merge-multiple: true

- name: Publish release
shell: bash
run: |
set -euo pipefail

gh release create "${GITHUB_REF_NAME}" \
dist/* \
--verify-tag \
--generate-notes
env:
GH_TOKEN: ${{ github.token }}
20 changes: 20 additions & 0 deletions .gitleaks.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
title = "RustUse Gitleaks configuration"

[extend]
useDefault = true

# Keep allowlists narrow and reviewed.
# Prefer, in order:
# 1. `gitleaks:allow` for explicit inline test fixtures.
# 2. rule-scoped allowlists in this file for stable repository fixtures.
# 3. `.gitleaksignore` fingerprints only for historical findings that cannot be removed immediately.
#
# Example rule extension shape:
# [[rules]]
# id = "generic-api-key"
# [[rules.allowlists]]
# description = "Reviewed test fixture"
# condition = "AND"
# paths = ['''^tests/fixtures/example\.txt$''']
# regexTarget = "line"
# regexes = ['''example-token''']
9 changes: 9 additions & 0 deletions .rustfmt.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
edition = "2024"
hard_tabs = false
match_block_trailing_comma = true
max_width = 100
newline_style = "Unix"
style_edition = "2024"
tab_spaces = 4
use_field_init_shorthand = true
use_small_heuristics = "Default"
31 changes: 31 additions & 0 deletions .taplo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
exclude = ["target/**"]
include = [
".cargo/*.toml",
".clippy.toml",
".rustfmt.toml",
".taplo.toml",
"Cargo.toml",
"deny.toml",
"shared/**/*.toml",
"tools/**/*.toml",
]

[formatting]
align_entries = false
allowed_blank_lines = 2
array_auto_collapse = true
array_auto_expand = true
array_trailing_comma = true
column_width = 100
compact_arrays = true
compact_entries = false
compact_inline_tables = false
crlf = false
indent_entries = false
indent_string = " "
indent_tables = false
inline_table_expand = true
reorder_arrays = true
reorder_inline_tables = true
reorder_keys = true
trailing_newline = true
Loading