dark-matter-cli 0.1.4__tar.gz → 0.2.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. {dark_matter_cli-0.1.4 → dark_matter_cli-0.2.1}/.github/renovate.json +5 -5
  2. dark_matter_cli-0.2.1/.github/workflows/ci.yml +216 -0
  3. dark_matter_cli-0.2.1/.github/workflows/nightly-parity.yml +117 -0
  4. dark_matter_cli-0.2.1/.github/workflows/release.yml +341 -0
  5. dark_matter_cli-0.2.1/.gitignore +15 -0
  6. {dark_matter_cli-0.1.4 → dark_matter_cli-0.2.1}/.pre-commit-config.yaml +16 -35
  7. dark_matter_cli-0.2.1/.rumdl.toml +31 -0
  8. dark_matter_cli-0.2.1/Cargo.lock +2503 -0
  9. dark_matter_cli-0.2.1/Cargo.toml +60 -0
  10. dark_matter_cli-0.2.1/PKG-INFO +282 -0
  11. dark_matter_cli-0.2.1/README.md +261 -0
  12. dark_matter_cli-0.2.1/assets/logo.svg +8 -0
  13. dark_matter_cli-0.2.1/assets/readme-dark.svg +78 -0
  14. dark_matter_cli-0.2.1/assets/readme-light.svg +85 -0
  15. dark_matter_cli-0.2.1/branding/readme-dark-source.svg +19 -0
  16. dark_matter_cli-0.2.1/branding/readme-light-source.svg +20 -0
  17. dark_matter_cli-0.2.1/cliff.toml +42 -0
  18. dark_matter_cli-0.2.1/justfile +77 -0
  19. dark_matter_cli-0.2.1/pyproject.toml +30 -0
  20. dark_matter_cli-0.2.1/src/cli.rs +1107 -0
  21. dark_matter_cli-0.2.1/src/core.rs +2595 -0
  22. dark_matter_cli-0.2.1/src/display.rs +1317 -0
  23. dark_matter_cli-0.2.1/src/error.rs +72 -0
  24. dark_matter_cli-0.2.1/src/homebrew.rs +3817 -0
  25. dark_matter_cli-0.2.1/src/lib.rs +8 -0
  26. dark_matter_cli-0.2.1/src/main.rs +3 -0
  27. dark_matter_cli-0.2.1/src/model.rs +283 -0
  28. dark_matter_cli-0.2.1/tests/cli_tests.rs +1120 -0
  29. dark_matter_cli-0.2.1/tests/parity.rs +116 -0
  30. dark_matter_cli-0.2.1/tests/smoke.rs +91 -0
  31. dark_matter_cli-0.1.4/.github/workflows/ci.yml +0 -65
  32. dark_matter_cli-0.1.4/.github/workflows/release.yml +0 -39
  33. dark_matter_cli-0.1.4/.gitignore +0 -16
  34. dark_matter_cli-0.1.4/.python-version +0 -1
  35. dark_matter_cli-0.1.4/PKG-INFO +0 -200
  36. dark_matter_cli-0.1.4/README.md +0 -156
  37. dark_matter_cli-0.1.4/justfile +0 -92
  38. dark_matter_cli-0.1.4/pyproject.toml +0 -174
  39. dark_matter_cli-0.1.4/src/dark_matter_cli/__init__.py +0 -35
  40. dark_matter_cli-0.1.4/src/dark_matter_cli/cli.py +0 -295
  41. dark_matter_cli-0.1.4/src/dark_matter_cli/core.py +0 -304
  42. dark_matter_cli-0.1.4/src/dark_matter_cli/display.py +0 -131
  43. dark_matter_cli-0.1.4/src/dark_matter_cli/homebrew.py +0 -320
  44. dark_matter_cli-0.1.4/src/dark_matter_cli/logger.py +0 -21
  45. dark_matter_cli-0.1.4/src/dark_matter_cli/py.typed +0 -0
  46. dark_matter_cli-0.1.4/tests/conftest.py +0 -26
  47. dark_matter_cli-0.1.4/tests/test_cli.py +0 -123
  48. dark_matter_cli-0.1.4/tests/test_core.py +0 -146
  49. dark_matter_cli-0.1.4/tests/test_display.py +0 -56
  50. dark_matter_cli-0.1.4/tests/test_homebrew.py +0 -110
  51. dark_matter_cli-0.1.4/uv.lock +0 -964
  52. {dark_matter_cli-0.1.4 → dark_matter_cli-0.2.1}/.github/ISSUE_TEMPLATE/bug_report.yml +0 -0
  53. {dark_matter_cli-0.1.4 → dark_matter_cli-0.2.1}/.github/ISSUE_TEMPLATE/config.yml +0 -0
  54. {dark_matter_cli-0.1.4 → dark_matter_cli-0.2.1}/.github/ISSUE_TEMPLATE/feature_request.yml +0 -0
  55. {dark_matter_cli-0.1.4 → dark_matter_cli-0.2.1}/CODE_OF_CONDUCT.md +0 -0
  56. {dark_matter_cli-0.1.4 → dark_matter_cli-0.2.1}/LICENSE +0 -0
@@ -38,14 +38,14 @@
38
38
  "minimumReleaseAge": "2 weeks"
39
39
  },
40
40
  {
41
- "description": "Group all python dev-dependencies (ruff, mypy, pytest) into one PR and automerge them.",
42
- "matchFileNames": [
43
- "pyproject.toml"
41
+ "description": "Group Rust dev-dependencies into one PR and automerge them.",
42
+ "matchManagers": [
43
+ "cargo"
44
44
  ],
45
45
  "matchDepTypes": [
46
- "dependency-groups"
46
+ "dev-dependencies"
47
47
  ],
48
- "groupName": "python-dev-tools",
48
+ "groupName": "rust-dev-deps",
49
49
  "automerge": true
50
50
  },
51
51
  {
@@ -0,0 +1,216 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [ "main" ]
6
+ # Run on PRs targeting any branch so stacked PRs are checked too.
7
+ pull_request:
8
+ # Lets the release workflow run the same checks before publishing.
9
+ workflow_call:
10
+
11
+ permissions:
12
+ contents: read
13
+
14
+ # Replace stale PR runs, and keep a separate run for each push to main.
15
+ concurrency:
16
+ group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
17
+ cancel-in-progress: ${{ github.event_name == 'pull_request' }}
18
+
19
+ env:
20
+ CARGO_TERM_COLOR: always
21
+
22
+ jobs:
23
+ # All OS- and architecture-agnostic checks run on a single ARM Ubuntu runner.
24
+ checks:
25
+ name: Lint, Format & Security
26
+ runs-on: ubuntu-24.04-arm
27
+ timeout-minutes: 15
28
+
29
+ steps:
30
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
31
+ with:
32
+ persist-credentials: false
33
+
34
+ - name: Install Rust toolchain
35
+ uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8 # v1
36
+ with:
37
+ toolchain: 1.100.0
38
+ components: rustfmt, clippy
39
+
40
+ - name: Cache Cargo dependencies
41
+ uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
42
+ with:
43
+ key: checks-aarch64-unknown-linux-gnu
44
+ cache-on-failure: true
45
+ cache-all-crates: true
46
+
47
+ - name: Check Rust formatting
48
+ run: cargo fmt --all -- --check
49
+
50
+ - name: Run Clippy
51
+ run: cargo clippy --locked --all-targets -- -D warnings
52
+
53
+ - name: Lint Markdown
54
+ uses: rvben/rumdl@1e0f1d13c87418c31e0d59dacddd98f27a02efcc # v0.3.2
55
+ with:
56
+ version: "0.3.2"
57
+ report-type: annotations
58
+
59
+ - name: Validate workflows
60
+ uses: raven-actions/actionlint@3d39aea434753780c3b3d4a1a31c854b4dbf49d7 # v2.2.0
61
+ with:
62
+ version: "1.7.12"
63
+ pyflakes: false
64
+
65
+ - name: Audit workflow security
66
+ uses: zizmorcore/zizmor-action@45d7276c9ca790aabd705e31ca99c6185c3e76dd # v0.8.1
67
+ with:
68
+ version: "1.32.0"
69
+ inputs: .github/
70
+ token: ${{ github.token }}
71
+ advanced-security: false
72
+ annotations: true
73
+
74
+ # Architecture-agnostic coverage check on ARM Ubuntu.
75
+ coverage:
76
+ name: Coverage
77
+ runs-on: ubuntu-24.04-arm
78
+ timeout-minutes: 20
79
+
80
+ steps:
81
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
82
+ with:
83
+ persist-credentials: false
84
+
85
+ - name: Install Rust toolchain
86
+ uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8 # v1
87
+ with:
88
+ toolchain: 1.100.0
89
+ components: llvm-tools-preview
90
+
91
+ - name: Install cargo-llvm-cov
92
+ uses: taiki-e/install-action@fe3acb53a98b62c772db35de75ce0e4595e7ca8c # v2
93
+ with:
94
+ tool: cargo-llvm-cov
95
+
96
+ - name: Cache Cargo dependencies
97
+ uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
98
+ with:
99
+ key: coverage-aarch64-unknown-linux-gnu
100
+ cache-on-failure: true
101
+ cache-all-crates: true
102
+
103
+ - name: Run tests with coverage floor
104
+ run: cargo llvm-cov --locked --all-targets --fail-under-lines 85
105
+
106
+ # OS- and architecture-specific test matrix only (macOS, Linux, Windows x arm64 & x64).
107
+ test:
108
+ name: Test / ${{ matrix.platform }}
109
+ runs-on: ${{ matrix.os }}
110
+ timeout-minutes: 25
111
+ defaults:
112
+ run:
113
+ shell: bash
114
+ strategy:
115
+ fail-fast: false
116
+ matrix:
117
+ include:
118
+ - platform: macOS arm64
119
+ os: macos-15
120
+ target: aarch64-apple-darwin
121
+ - platform: macOS x64
122
+ os: macos-15-intel
123
+ target: x86_64-apple-darwin
124
+ - platform: Linux x64
125
+ os: ubuntu-24.04
126
+ target: x86_64-unknown-linux-gnu
127
+ - platform: Linux arm64
128
+ os: ubuntu-24.04-arm
129
+ target: aarch64-unknown-linux-gnu
130
+ - platform: Windows x64
131
+ os: windows-2025
132
+ target: x86_64-pc-windows-msvc
133
+ - platform: Windows arm64
134
+ os: windows-11-arm
135
+ target: aarch64-pc-windows-msvc
136
+
137
+ steps:
138
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
139
+ with:
140
+ persist-credentials: false
141
+
142
+ - name: Install native Rust toolchain
143
+ uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8 # v1
144
+ with:
145
+ toolchain: 1.100.0-${{ matrix.target }}
146
+
147
+ - name: Confirm native Rust architecture
148
+ env:
149
+ EXPECTED_TARGET: ${{ matrix.target }}
150
+ run: |
151
+ rustc -vV
152
+ test "$(rustc -vV | awk '/^host: / {print $2}' | tr -d '\r')" = "$EXPECTED_TARGET"
153
+
154
+ - name: Cache Cargo dependencies
155
+ uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
156
+ with:
157
+ key: test-${{ matrix.target }}
158
+ cache-on-failure: true
159
+ cache-all-crates: true
160
+
161
+ - name: Run unit and integration tests
162
+ run: cargo test --locked --all-targets --no-fail-fast
163
+
164
+ smoke:
165
+ name: Smoke test against Homebrew
166
+ runs-on: macos-15
167
+ timeout-minutes: 20
168
+ env:
169
+ HOMEBREW_NO_INSTALL_CLEANUP: "1"
170
+ HOMEBREW_NO_ENV_HINTS: "1"
171
+
172
+ steps:
173
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
174
+ with:
175
+ persist-credentials: false
176
+
177
+ - name: Install Rust toolchain
178
+ uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8 # v1
179
+ with:
180
+ toolchain: 1.100.0-aarch64-apple-darwin
181
+
182
+ - name: Cache Cargo dependencies
183
+ uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
184
+ with:
185
+ key: smoke-aarch64-apple-darwin
186
+ cache-on-failure: true
187
+ cache-all-crates: true
188
+
189
+ - name: Build release binary
190
+ run: cargo build --locked --release
191
+
192
+ # A small formula with one dependency, so attribution has a graph to walk.
193
+ - name: Install a test formula
194
+ run: brew install watch
195
+
196
+ - name: Run installed-mode commands
197
+ run: |
198
+ ./target/release/dark-matter --verbose analyze --top 5
199
+ ./target/release/dark-matter inspect watch
200
+ ./target/release/dark-matter explain watch --tree
201
+ ./target/release/dark-matter reclaim watch
202
+ ./target/release/dark-matter orphans
203
+ ./target/release/dark-matter cleanup
204
+ ./target/release/dark-matter export --format json > export.json
205
+
206
+ - name: Check the export
207
+ env:
208
+ SMOKE_EXPORT_JSON: export.json
209
+ SMOKE_PACKAGE: watch
210
+ SMOKE_DEPENDENCY: ncurses
211
+ run: cargo test --locked --test smoke -- --ignored
212
+
213
+ - name: Run catalog-mode commands
214
+ run: |
215
+ ./target/release/dark-matter inspect watch --source catalog
216
+ ./target/release/dark-matter explain watch --source catalog
@@ -0,0 +1,117 @@
1
+ name: Nightly Homebrew Parity
2
+
3
+ on:
4
+ schedule:
5
+ - cron: "0 7 * * *"
6
+ workflow_dispatch:
7
+
8
+ permissions:
9
+ contents: read
10
+
11
+ concurrency:
12
+ group: nightly-parity
13
+ cancel-in-progress: false
14
+
15
+ env:
16
+ CARGO_TERM_COLOR: always
17
+ HOMEBREW_NO_INSTALL_CLEANUP: "1"
18
+ HOMEBREW_NO_ENV_HINTS: "1"
19
+
20
+ jobs:
21
+ parity:
22
+ name: Parity on ${{ matrix.os }}
23
+ runs-on: ${{ matrix.os }}
24
+ timeout-minutes: 25
25
+ permissions:
26
+ contents: read
27
+ issues: write
28
+ strategy:
29
+ fail-fast: false
30
+ matrix:
31
+ os: [macos-15, ubuntu-24.04]
32
+
33
+ steps:
34
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
35
+ with:
36
+ persist-credentials: false
37
+
38
+ - name: Install Rust toolchain
39
+ uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8 # v1
40
+ with:
41
+ toolchain: 1.100.0
42
+
43
+ - name: Cache Cargo dependencies
44
+ uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
45
+ with:
46
+ key: parity-${{ matrix.os }}
47
+ cache-on-failure: true
48
+ cache-all-crates: true
49
+
50
+ - name: Ensure Homebrew is on PATH (Linux)
51
+ if: runner.os == 'Linux'
52
+ run: |
53
+ if [ -x /home/linuxbrew/.linuxbrew/bin/brew ]; then
54
+ echo "/home/linuxbrew/.linuxbrew/bin" >> "$GITHUB_PATH"
55
+ else
56
+ NONINTERACTIVE=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
57
+ echo "/home/linuxbrew/.linuxbrew/bin" >> "$GITHUB_PATH"
58
+ fi
59
+
60
+ - name: Install representative formulae and casks
61
+ run: |
62
+ brew update
63
+ brew install watch jq
64
+ if [ "$(uname -s)" = "Darwin" ]; then
65
+ brew install --cask font-jetbrains-mono
66
+ fi
67
+
68
+ - name: Run native vs brew-cli parity suite
69
+ id: parity
70
+ continue-on-error: true
71
+ run: cargo test --locked --test parity -- --ignored --nocapture
72
+
73
+ - name: Report drift issue on scheduled failure
74
+ if: steps.parity.outcome == 'failure' && github.event_name == 'schedule'
75
+ env:
76
+ MATRIX_OS: ${{ matrix.os }}
77
+ uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8
78
+ with:
79
+ script: |
80
+ const os = process.env.MATRIX_OS;
81
+ const runUrl = `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`;
82
+ const title = `Homebrew receipt parity drift detected on ${os}`;
83
+ const body = [
84
+ `The nightly parity check comparing \`dark-matter\`'s direct receipt reader against \`brew info --json=v2 --installed\` failed on **${os}**.`,
85
+ "",
86
+ `Workflow run: ${runUrl}`,
87
+ "",
88
+ "Users remain unaffected when fallback triggers, or via `DARK_MATTER_USE_BREW_CLI=1`, until the receipt reader is updated."
89
+ ].join("\n");
90
+
91
+ const existing = await github.rest.issues.listForRepo({
92
+ owner: context.repo.owner,
93
+ repo: context.repo.repo,
94
+ state: "open",
95
+ labels: "homebrew-drift",
96
+ });
97
+ const match = existing.data.find((i) => i.title === title);
98
+ if (match) {
99
+ await github.rest.issues.createComment({
100
+ owner: context.repo.owner,
101
+ repo: context.repo.repo,
102
+ issue_number: match.number,
103
+ body,
104
+ });
105
+ } else {
106
+ await github.rest.issues.create({
107
+ owner: context.repo.owner,
108
+ repo: context.repo.repo,
109
+ title,
110
+ body,
111
+ labels: ["homebrew-drift"],
112
+ });
113
+ }
114
+
115
+ - name: Fail job if parity check failed
116
+ if: steps.parity.outcome == 'failure'
117
+ run: exit 1
@@ -0,0 +1,341 @@
1
+ name: Release
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - "v*.*.*"
7
+ workflow_dispatch:
8
+
9
+ permissions: {}
10
+
11
+ concurrency:
12
+ group: release-${{ github.ref_name }}
13
+ cancel-in-progress: false
14
+
15
+ env:
16
+ CARGO_TERM_COLOR: always
17
+
18
+ jobs:
19
+ # Runs in parallel with builds; nothing publishes unless checks pass.
20
+ checks:
21
+ name: CI
22
+ permissions:
23
+ contents: read
24
+ uses: ./.github/workflows/ci.yml # zizmor: ignore[self-repository]
25
+
26
+ verify:
27
+ name: Verify version & generate notes
28
+ runs-on: ubuntu-24.04-arm
29
+ timeout-minutes: 10
30
+ permissions:
31
+ contents: read
32
+ outputs:
33
+ version: ${{ steps.meta.outputs.version }}
34
+ steps:
35
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
36
+ with:
37
+ persist-credentials: false
38
+ # git-cliff needs the full history and tags to find this release's commits.
39
+ fetch-depth: 0
40
+
41
+ - name: Extract and verify version
42
+ id: meta
43
+ env:
44
+ EVENT_NAME: ${{ github.event_name }}
45
+ REF_NAME: ${{ github.ref_name }}
46
+ run: |
47
+ version="$(awk -F'"' '/^version = / { print $2; exit }' Cargo.toml)"
48
+ if [[ -z "$version" ]]; then
49
+ echo "::error::Could not read version from Cargo.toml"
50
+ exit 1
51
+ fi
52
+ if [[ "$EVENT_NAME" == "push" && "$REF_NAME" != "v${version}" ]]; then
53
+ echo "::error::Tag ${REF_NAME} does not match Cargo.toml version v${version}"
54
+ exit 1
55
+ fi
56
+ echo "version=${version}" >> "$GITHUB_OUTPUT"
57
+
58
+ - name: Install uv (for git-cliff)
59
+ uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
60
+ with:
61
+ enable-cache: false
62
+
63
+ - name: Generate release notes
64
+ env:
65
+ EVENT_NAME: ${{ github.event_name }}
66
+ run: |
67
+ if [[ "$EVENT_NAME" == "push" ]]; then
68
+ uvx git-cliff@2.14.2 --latest --strip all --output RELEASE_NOTES.md
69
+ else
70
+ uvx git-cliff@2.14.2 --unreleased --strip all --output RELEASE_NOTES.md
71
+ fi
72
+
73
+ - name: Upload release notes
74
+ uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
75
+ with:
76
+ name: release-notes
77
+ path: RELEASE_NOTES.md
78
+ if-no-files-found: error
79
+
80
+ # Fan out all 6 OS x Arch native binary builds in parallel alongside CI.
81
+ build-binaries:
82
+ name: Build binary / ${{ matrix.platform }}
83
+ needs: verify
84
+ runs-on: ${{ matrix.os }}
85
+ timeout-minutes: 30
86
+ permissions:
87
+ contents: read
88
+ defaults:
89
+ run:
90
+ shell: bash
91
+ strategy:
92
+ fail-fast: false
93
+ matrix:
94
+ include:
95
+ - platform: macOS arm64
96
+ os: macos-15
97
+ target: aarch64-apple-darwin
98
+ ext: ""
99
+ archive: tar.gz
100
+ - platform: macOS x64
101
+ os: macos-15-intel
102
+ target: x86_64-apple-darwin
103
+ ext: ""
104
+ archive: tar.gz
105
+ - platform: Linux x64
106
+ os: ubuntu-24.04
107
+ target: x86_64-unknown-linux-gnu
108
+ ext: ""
109
+ archive: tar.gz
110
+ - platform: Linux arm64
111
+ os: ubuntu-24.04-arm
112
+ target: aarch64-unknown-linux-gnu
113
+ ext: ""
114
+ archive: tar.gz
115
+ - platform: Windows x64
116
+ os: windows-2025
117
+ target: x86_64-pc-windows-msvc
118
+ ext: ".exe"
119
+ archive: zip
120
+ - platform: Windows arm64
121
+ os: windows-11-arm
122
+ target: aarch64-pc-windows-msvc
123
+ ext: ".exe"
124
+ archive: zip
125
+
126
+ steps:
127
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
128
+ with:
129
+ persist-credentials: false
130
+
131
+ - name: Install native Rust toolchain
132
+ uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8 # v1
133
+ with:
134
+ toolchain: 1.100.0-${{ matrix.target }}
135
+
136
+ - name: Build release binary
137
+ env:
138
+ TARGET: ${{ matrix.target }}
139
+ run: cargo build --release --locked --target "$TARGET"
140
+
141
+ - name: Smoke-check and package archive
142
+ env:
143
+ VERSION: ${{ needs.verify.outputs.version }}
144
+ TARGET: ${{ matrix.target }}
145
+ EXT: ${{ matrix.ext }}
146
+ ARCHIVE_FMT: ${{ matrix.archive }}
147
+ run: |
148
+ bin="target/${TARGET}/release/dark-matter${EXT}"
149
+ "$bin" --version | grep -F "$VERSION"
150
+
151
+ mkdir -p dist-bin
152
+ if [[ "$ARCHIVE_FMT" == "tar.gz" ]]; then
153
+ archive="dark-matter-v${VERSION}-${TARGET}.tar.gz"
154
+ tar -czf "dist-bin/${archive}" -C "target/${TARGET}/release" "dark-matter${EXT}"
155
+ else
156
+ archive="dark-matter-v${VERSION}-${TARGET}.zip"
157
+ pwsh -NoProfile -Command "Compress-Archive -Path '${bin}' -DestinationPath 'dist-bin/${archive}'"
158
+ fi
159
+
160
+ if command -v sha256sum >/dev/null 2>&1; then
161
+ (cd dist-bin && sha256sum "${archive}" > "${archive}.sha256")
162
+ else
163
+ (cd dist-bin && shasum -a 256 "${archive}" > "${archive}.sha256")
164
+ fi
165
+
166
+ - name: Upload binary archive
167
+ uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
168
+ with:
169
+ name: bin-${{ matrix.target }}
170
+ path: dist-bin/*
171
+ if-no-files-found: error
172
+
173
+ # Fan out all 6 OS x Arch PyPI wheels in parallel via maturin.
174
+ build-wheels:
175
+ name: Build PyPI wheel / ${{ matrix.platform }}
176
+ runs-on: ${{ matrix.os }}
177
+ timeout-minutes: 30
178
+ permissions:
179
+ contents: read
180
+ strategy:
181
+ fail-fast: false
182
+ matrix:
183
+ include:
184
+ - platform: macOS arm64
185
+ os: macos-15
186
+ target: aarch64-apple-darwin
187
+ manylinux: off
188
+ - platform: macOS x64
189
+ os: macos-15-intel
190
+ target: x86_64-apple-darwin
191
+ manylinux: off
192
+ - platform: Linux x64
193
+ os: ubuntu-24.04
194
+ target: x86_64
195
+ manylinux: auto
196
+ - platform: Linux arm64
197
+ os: ubuntu-24.04-arm
198
+ target: aarch64
199
+ manylinux: auto
200
+ - platform: Windows x64
201
+ os: windows-2025
202
+ target: x86_64-pc-windows-msvc
203
+ manylinux: off
204
+ - platform: Windows arm64
205
+ os: windows-11-arm
206
+ target: aarch64-pc-windows-msvc
207
+ manylinux: off
208
+
209
+ steps:
210
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
211
+ with:
212
+ persist-credentials: false
213
+
214
+ - name: Build wheel with maturin
215
+ uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b # v1
216
+ with:
217
+ target: ${{ matrix.target }}
218
+ args: --release --out dist
219
+ manylinux: ${{ matrix.manylinux }}
220
+
221
+ - name: Upload wheel
222
+ uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
223
+ with:
224
+ name: wheels-${{ matrix.target }}
225
+ path: dist/*
226
+ if-no-files-found: error
227
+
228
+ build-sdist:
229
+ name: Build PyPI sdist
230
+ runs-on: ubuntu-24.04-arm
231
+ timeout-minutes: 15
232
+ permissions:
233
+ contents: read
234
+ steps:
235
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
236
+ with:
237
+ persist-credentials: false
238
+
239
+ - name: Build sdist with maturin
240
+ uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b # v1
241
+ with:
242
+ command: sdist
243
+ args: --out dist
244
+
245
+ - name: Upload sdist
246
+ uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
247
+ with:
248
+ name: wheels-sdist
249
+ path: dist/*
250
+ if-no-files-found: error
251
+
252
+ publish-pypi:
253
+ name: Publish wheels to PyPI
254
+ needs: [checks, build-wheels, build-sdist]
255
+ if: github.event_name == 'push'
256
+ # pypa/gh-action-pypi-publish ships a linux/amd64-only container image.
257
+ runs-on: ubuntu-24.04
258
+ timeout-minutes: 15
259
+ environment: release
260
+ permissions:
261
+ contents: read
262
+ id-token: write
263
+ attestations: write
264
+
265
+ steps:
266
+ - name: Download wheels and sdist
267
+ uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
268
+ with:
269
+ pattern: wheels-*
270
+ path: dist
271
+ merge-multiple: true
272
+
273
+ - name: Attest PyPI distributions
274
+ uses: actions/attest-build-provenance@4d101475d8b20a2381f78447822ac1eab6504dd8 # v4.2.2
275
+ with:
276
+ subject-path: "dist/*"
277
+
278
+ - name: Publish to PyPI
279
+ uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # release/v1
280
+
281
+ github-release:
282
+ name: Create GitHub Release
283
+ needs: [verify, checks, build-binaries, publish-pypi]
284
+ if: github.event_name == 'push'
285
+ runs-on: ubuntu-24.04-arm
286
+ timeout-minutes: 15
287
+ permissions:
288
+ contents: write
289
+ id-token: write
290
+ attestations: write
291
+
292
+ steps:
293
+ - name: Download release notes
294
+ uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
295
+ with:
296
+ name: release-notes
297
+ path: .
298
+
299
+ - name: Download binary archives
300
+ uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
301
+ with:
302
+ pattern: bin-*
303
+ path: release-assets
304
+ merge-multiple: true
305
+
306
+ - name: Attest binary archives
307
+ uses: actions/attest-build-provenance@4d101475d8b20a2381f78447822ac1eab6504dd8 # v4.2.2
308
+ with:
309
+ subject-path: |
310
+ release-assets/*.tar.gz
311
+ release-assets/*.zip
312
+
313
+ - name: Create release
314
+ env:
315
+ GH_TOKEN: ${{ github.token }}
316
+ TAG: ${{ github.ref_name }}
317
+ run: gh release create "$TAG" release-assets/* --verify-tag --title "$TAG" --notes-file RELEASE_NOTES.md
318
+
319
+ # Delegates formula rendering and tap push to ci-cd-release-infrastructure.
320
+ # On a workflow_dispatch dry run it uploads dry-run-formula without pushing.
321
+ sync-homebrew:
322
+ name: Update Homebrew formula
323
+ needs: [verify, build-binaries, github-release]
324
+ if: ${{ !failure() && !cancelled() && (github.event_name != 'push' || needs.github-release.result == 'success') }}
325
+ permissions:
326
+ contents: read
327
+ uses: JacksonFergusonDev/ci-cd-release-infrastructure/.github/workflows/update-homebrew-binary.yml@d56f04eb8e21831fb8b0c480abf6a919f93fb9dc # main
328
+ with:
329
+ tag: v${{ needs.verify.outputs.version }}
330
+ formula_path: Formula/dark-matter.rb
331
+ artifact_pattern: bin-*
332
+ archive_template: dark-matter-v{version}-{target}.tar.gz
333
+ targets: aarch64-apple-darwin,x86_64-apple-darwin,aarch64-unknown-linux-gnu,x86_64-unknown-linux-gnu
334
+ desc: Dependency-graph-aware storage profiler for Homebrew
335
+ homepage: https://github.com/JacksonFergusonDev/dark-matter
336
+ license: MIT
337
+ binary_name: dark-matter
338
+ version_pattern: '^dark-matter version \d+\.\d+\.\d+'
339
+ dry_run: ${{ github.event_name != 'push' }}
340
+ secrets:
341
+ TAP_GITHUB_TOKEN: ${{ secrets.TAP_GITHUB_TOKEN }}