Skip to content
Merged
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
4 changes: 4 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,15 @@ updates:
github-actions:
patterns:
- "*"
cooldown:
default-days: 30

- package-ecosystem: "cargo"
directory: "/"
schedule:
interval: "monthly"
cooldown:
default-days: 30
# Security updates only:
open-pull-requests-limit: 0
groups:
Expand Down
34 changes: 0 additions & 34 deletions .github/workflows/dependabot-prek.yaml

This file was deleted.

114 changes: 56 additions & 58 deletions .github/workflows/pr-checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,90 +7,88 @@ on:
- main
pull_request:

permissions: {}

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

env:
CLICOLOR: 1

# These would more naturally be separate jobs, but GitHub actions “bills” each
# job separately and rounds up to the next minute, so four 10 second jobs “cost”
# my account 4 action minutes.
jobs:
clippy:
name: cargo clippy
checks:
name: Checks
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
- os: windows-latest
- os: macos-latest
timeout-minutes: 30
permissions:
security-events: write # SARIF reporting for zizmor

steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false

- uses: actions-rust-lang/setup-rust-toolchain@46268bd060767258de96ed93c1251119784f2ab6 # v1.16.1
with:
toolchain: stable
components: clippy
- run: cargo clippy --all-features --all-targets
- name: check doc lints
env:
RUSTDOCFLAGS: --document-private-items -Dwarnings
run: cargo doc --no-deps --all-features

deny:
name: cargo deny
runs-on: ubuntu-latest
- uses: actions-rust-lang/setup-rust-toolchain@46268bd060767258de96ed93c1251119784f2ab6 # v1.16.1
with:
toolchain: nightly
components: rustfmt

steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- uses: EmbarkStudios/cargo-deny-action@bb137d7af7e4fb67e5f82a49c4fce4fad40782fe # v2.0.20
- uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1

- uses: taiki-e/install-action@e49978b799e49ff429d162b7a30601a569ab6538 # v2.81.1
with:
rust-version: "1.85.0"
tool: cargo-msrv

fmt:
name: cargo fmt
runs-on: ubuntu-latest
- uses: crate-ci/typos@37bb98842b0d8c4ffebdb75301a13db0267cef89 # v1.47.2
if: ${{ !cancelled() && runner.os == 'Linux' }}

steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- uses: actions-rust-lang/setup-rust-toolchain@46268bd060767258de96ed93c1251119784f2ab6 # v1.16.1
- uses: zizmorcore/zizmor-action@5f14fd08f7cf1cb1609c1e344975f152c7ee938d # v0.5.6
if: ${{ !cancelled() && runner.os == 'Linux' }}
with:
components: rustfmt
- uses: actions-rust-lang/rustfmt@4066006ec54a31931b9b1fddfd38f2fdf2d27143 # v1.1.2
persona: pedantic

msrv:
name: cargo msrv
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
- os: windows-latest
- os: macos-latest
- uses: actions-rust-lang/rustfmt@4066006ec54a31931b9b1fddfd38f2fdf2d27143 # v1.1.2
if: ${{ !cancelled() && runner.os == 'Linux' }}

steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
- uses: taiki-e/install-action@25435dc8dd3baed7417e0c96d3fe89013a5b2e09 # v2.81.3
- uses: EmbarkStudios/cargo-deny-action@bb137d7af7e4fb67e5f82a49c4fce4fad40782fe # v2.0.20
if: ${{ !cancelled() && runner.os == 'Linux' }}
with:
tool: cargo-msrv
- run: cargo msrv verify
rust-version: "1.85.0"

test:
name: cargo test
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
- os: windows-latest
- os: macos-latest
- name: cargo clippy
if: ${{ !cancelled() }}
run: cargo +stable clippy --all-features --all-targets

steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- uses: actions-rust-lang/setup-rust-toolchain@46268bd060767258de96ed93c1251119784f2ab6 # v1.16.1
- run: cargo build --tests --all-features
- run: cargo test --all-features
- name: cargo doc lints
if: ${{ !cancelled() }}
env:
RUSTDOCFLAGS: --document-private-items -Dwarnings
run: cargo +stable doc --no-deps --all-features

typos:
name: typos
runs-on: ubuntu-latest
- name: cargo msrv
if: ${{ !cancelled() }}
run: cargo msrv verify

steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- uses: crate-ci/typos@44e2070e6017f834bf069503acb35ca0ca0b75f2 # v1.47.1
- name: cargo build
id: cargo_build
if: ${{ !cancelled() }}
run: cargo +stable build --tests --all-features

- name: cargo test
if: ${{ !cancelled() && steps.cargo_build.outcome == 'success' }}
run: cargo +stable test --all-features
29 changes: 29 additions & 0 deletions .github/workflows/prek-auto-update.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: prek auto-update

on:
schedule:
- cron: "0 12 * * 5" # Every Friday at 12:00 UTC (5am PDT / 4am PST).
workflow_dispatch:

permissions: {}

concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true

jobs:
prek-auto-update:
name: prek auto-update
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: write # Change files
pull-requests: write # Create and update PRs
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
# zizmor: ignore[artipacked] no archive; needed for git
persist-credentials: true
- uses: danielparks/github-actions/prek-auto-update@2f6c98c73f0a8130d737500b59a0fddf749b484d # v1.1.1
with:
token: ${{ secrets.AUTO_UPDATE_TOKEN }}
20 changes: 12 additions & 8 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
# Mostly copied from https://github.com/taiki-e/cargo-hack/blob/main/.github/workflows/release.yml
name: Release

permissions:
contents: read

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

permissions: {}

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
CARGO_INCREMENTAL: 0
CARGO_NET_GIT_FETCH_WITH_CLI: true
Expand All @@ -21,22 +24,24 @@ env:
jobs:
create-release:
if: github.repository_owner == 'danielparks'
runs-on: ubuntu-latest
name: Create
timeout-minutes: 5
permissions:
contents: write
contents: write # To create release
runs-on: ubuntu-latest
steps:
- uses: danielparks/github-actions/create-release@e6897e1bad61baaecaf6683db8a69747ddcf40f1 # v1.0.0
with:
token: ${{ secrets.GITHUB_TOKEN }}

upload-assets:
name: ${{ matrix.target }}
if: github.repository_owner == 'danielparks'
name: ${{ matrix.target }}
needs:
- create-release
timeout-minutes: 60
permissions:
contents: write
contents: write # To upload artifacts to release
strategy:
matrix:
include:
Expand Down Expand Up @@ -67,4 +72,3 @@ jobs:
with:
target: ${{ matrix.target }}
token: ${{ secrets.GITHUB_TOKEN }}

9 changes: 9 additions & 0 deletions .pinact.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/suzuki-shunsuke/pinact/refs/heads/main/json-schema/pinact.json
# pinact - https://github.com/suzuki-shunsuke/pinact
version: 3
min_age:
value: 30
rules:
- min_age: 0
conditions:
- expr: ActionRepoOwner == "danielparks"
7 changes: 7 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ repos:
- id: typos
args: []
exclude: "target/"
- repo: https://github.com/zizmorcore/zizmor-pre-commit
rev: v1.25.2
hooks:
- id: zizmor
args:
- "--no-progress" # https://github.com/zizmorcore/zizmor/issues/582
- "--persona=pedantic"
- repo: local
hooks:
- id: cargo clippy
Expand Down
3 changes: 3 additions & 0 deletions rustfmt.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@ max_width = 80
newline_style = "Unix"
struct_lit_width = 60
use_field_init_shorthand = true

unstable_features = true
wrap_comments = true
8 changes: 4 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,14 +118,14 @@ pub struct Head {

/// How many commits are we ahead of upstream?
///
/// `None` means that there is no upstream, or there is no equivalent branch
/// in upstream.
/// `None` means that there is no upstream, or there is no equivalent
/// branch in upstream.
pub ahead_of_upstream: Option<usize>,

/// How many commits are we behind upstream?
///
/// `None` means that there is no upstream, or there is no equivalent branch
/// in upstream.
/// `None` means that there is no upstream, or there is no equivalent
/// branch in upstream.
pub behind_upstream: Option<usize>,

/// An error encountered trying to calculate differences with upstream.
Expand Down
Loading