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
16 changes: 16 additions & 0 deletions .dprint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"toml": {
"lineWidth": 100,
"indentWidth": 4
},
"markdown": {
"lineWidth": 100,
"unorderedListKind": "asterisks",
"textWrap": "always"
},
"excludes": [],
"plugins": [
"https://plugins.dprint.dev/toml-0.7.0.wasm",
"https://plugins.dprint.dev/markdown-0.21.1.wasm"
]
}
23 changes: 23 additions & 0 deletions .github/get-release-notes.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash
set -o errexit
set -o pipefail
set -o nounset

VERSION="${1:?Usage: $0 <VERSION> <DESCRIPTION>}"
DESCRIPTION="${2:?Usage: $0 <VERSION> <DESCRIPTION>}"

CHANGELOG="$(git rev-parse --show-toplevel)/CHANGELOG.md"

# Output the version header
if ! grep "^# Deptangle - $VERSION -" "$CHANGELOG"; then
echo "ERROR: Could not find version '$VERSION' in '$CHANGELOG'" >&2
exit 1
fi

# Add the project description
echo "$DESCRIPTION"

# Extract everything between this version's header and the next
# 0,/pat1/d deletes from line 1 to pat1 inclusive
# /pat2/Q exits without printing on the first line to match pat2
sed "0,/^# Deptangle - $VERSION -/d;/^# Deptangle - /Q" "$CHANGELOG"
15 changes: 15 additions & 0 deletions .github/parse-manifest-key.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash
set -o errexit
set -o pipefail
set -o nounset
set -o noclobber

CARGO_MANIFEST="${1:-Cargo.toml}"
MANIFEST_KEY="${2:-version}"

cargo metadata \
--format-version=1 \
--manifest-path "$CARGO_MANIFEST" \
--no-deps |
jq ".packages[0].$MANIFEST_KEY" |
tr -d '"'
82 changes: 82 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: Lint
on: push
env:
CARGO_BUILD_WARNINGS: deny
CARGO_TERM_COLOR: always

jobs:
format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Setup Rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: rustfmt
- name: Run rustfmt
run: cargo fmt -- --check --config group_imports=StdExternalCrate,imports_granularity=Module

dprint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Setup dprint
uses: dprint/check@v2.2

build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Setup Rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: clippy
- name: Setup Rust cache
uses: swatinem/rust-cache@v2
- name: Build
run: cargo build --all-targets --all-features
- name: Clippy
run: cargo clippy --no-deps --all-targets --all-features

test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Setup Rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: llvm-tools-preview
- name: Setup Rust cache
uses: swatinem/rust-cache@v2
- name: Setup nextest
uses: taiki-e/install-action@v2
with:
tool: cargo-nextest,cargo-llvm-cov
- name: Test
run: |
cargo llvm-cov --no-report nextest --all-features
cargo llvm-cov report --cobertura --output-path coverage.xml
head coverage.xml
RATE="$(grep -o -m 1 -P '(?<=line-rate=").*?(?=")' coverage.xml | head -1)"
echo "RATE=$RATE"
PERCENT="$(echo "($RATE * 100)/1" | bc)"
echo "PERCENT=$PERCENT"
echo "COVERAGE_PERCENT=$PERCENT" >> $GITHUB_ENV
- name: Update coverage badge
uses: schneegans/dynamic-badges-action@v1.7.0
if: github.ref_name == github.event.repository.default_branch
with:
# https://github.com/Notgnoshi/deptangle/settings/secrets/actions
# https://github.com/settings/personal-access-tokens
# https://github.com/marketplace/actions/dynamic-badges
auth: ${{ secrets.DEPTANGLE_COVERAGE_GIST_TOKEN }}
gistID: 0e15edf83d41c5b3cace2ff71f4d2f53
filename: deptangle-coverage.json
label: Code Coverage
message: ${{ env.COVERAGE_PERCENT }}
valColorRange: ${{ env.COVERAGE_PERCENT }}
minColorRange: 60
maxColorRange: 95
52 changes: 52 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Release

# This workflow is not ordered after the 'Lint' workflow. And doing so is difficult, because
# workflow_run: only applies on the default branch, and I EXPRESSLY WANT this workflow to run in PRs
# too, because it validates some preconditions for making the release.
#
# So make the assumption that if the PR pipeline passed, and this workflow runs on the default
# branch, it's okay to make a release without waiting for the build and test
on: push

permissions:
contents: write

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6

- name: Extract Release Metadata
shell: bash
run: |
VERSION="$(.github/parse-manifest-key.sh Cargo.toml version)"
DESCRIPTION="${{ github.event.repository.description }}"
echo "VERSION=$VERSION" >> "$GITHUB_ENV"
echo "DESCRIPTION=$DESCRIPTION" >> "$GITHUB_ENV"

# Always generate release notes for the current version. If the version from the Cargo
# manifest isn't found in the CHANGELOG.md, then fail the pipeline (even in PRs)
- name: Generate Release Notes
shell: bash
run: .github/get-release-notes.sh "$VERSION" "$DESCRIPTION" | tee release.md

- name: Create Release
shell: bash
if: github.ref_name == github.event.repository.default_branch
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if gh release view "v$VERSION" &>/dev/null; then
echo "Release v$VERSION already exists. Skipping ..."
else
echo "Creating release v$VERSION ..."
PRERELEASE_FLAG=""
if [[ "$VERSION" == *-rc* ]]; then
PRERELEASE_FLAG="--prerelease"
fi
gh release create "v$VERSION" \
--title "v$VERSION" \
--notes-file release.md \
$PRERELEASE_FLAG
fi
1 change: 1 addition & 0 deletions .rustfmt.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
edition = "2024"
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Changelog

All notable changes to this project are documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project
adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

Entries from this changelog are copied verbatim into the generated GitHub release notes, so **keep
the focus on user impact** rather than the mechanics of the change.

# Deptangle - Unreleased - (YYYY-MM-DD)

<!-- Please add new changelog entries here -->

# Deptangle - 0.1.0 - (2026-08-29)

Migrate project from <https://github.com/Notgnoshi/csvizmo>
Loading