Skip to content

Commit 6530eaf

Browse files
committed
feat: initialize drx CLI tool runner
Add cross-platform pub and GitHub release execution, cache/version utilities, and publish/release workflows so drx can be distributed via pub.dev and precompiled binaries.
0 parents  commit 6530eaf

44 files changed

Lines changed: 4886 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
jobs:
10+
test:
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
os: [ubuntu-latest, macos-latest, windows-latest]
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Set up Dart
21+
uses: dart-lang/setup-dart@v1
22+
23+
- name: Install dependencies
24+
run: dart pub get
25+
26+
- name: Analyze
27+
run: dart analyze
28+
29+
- name: Test
30+
run: dart test
31+
32+
coverage:
33+
runs-on: ubuntu-latest
34+
steps:
35+
- uses: actions/checkout@v4
36+
37+
- name: Set up Dart
38+
uses: dart-lang/setup-dart@v1
39+
40+
- name: Install dependencies
41+
run: dart pub get
42+
43+
- name: Enforce coverage
44+
run: |
45+
dart test --coverage=coverage
46+
dart run coverage:format_coverage --packages=.dart_tool/package_config.json --report-on=lib --in=coverage --out=coverage/lcov.info --lcov --fail-under=80
47+
dart run tool/check_coverage.dart 80 coverage/lcov.info
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
name: Release Binaries
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: write
11+
12+
jobs:
13+
build:
14+
runs-on: ${{ matrix.os }}
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
os: [ubuntu-latest, macos-latest, windows-latest]
19+
20+
steps:
21+
- uses: actions/checkout@v4
22+
23+
- name: Set up Dart
24+
uses: dart-lang/setup-dart@v1
25+
26+
- name: Install dependencies
27+
run: dart pub get
28+
29+
- name: Build binary (Linux/macOS)
30+
if: runner.os != 'Windows'
31+
shell: bash
32+
run: |
33+
set -euo pipefail
34+
os="${RUNNER_OS,,}"
35+
arch_raw="$(uname -m)"
36+
case "$arch_raw" in
37+
x86_64|amd64) arch="x64" ;;
38+
arm64|aarch64) arch="arm64" ;;
39+
*) echo "Unsupported arch: $arch_raw"; exit 1 ;;
40+
esac
41+
asset="drx-${os}-${arch}"
42+
mkdir -p build
43+
dart compile exe bin/drx.dart -o "build/${asset}"
44+
shasum -a 256 "build/${asset}" > "build/${asset}.sha256"
45+
46+
- name: Build binary (Windows)
47+
if: runner.os == 'Windows'
48+
shell: pwsh
49+
run: |
50+
$archRaw = [System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture.ToString().ToLowerInvariant()
51+
switch ($archRaw) {
52+
'x64' { $arch = 'x64' }
53+
'arm64' { $arch = 'arm64' }
54+
default { throw "Unsupported arch: $archRaw" }
55+
}
56+
$asset = "drx-windows-$arch.exe"
57+
New-Item -ItemType Directory -Path build -Force | Out-Null
58+
dart compile exe bin/drx.dart -o "build/$asset"
59+
$hash = (Get-FileHash -Algorithm SHA256 "build/$asset").Hash.ToLower()
60+
"$hash $asset" | Out-File -Encoding ascii "build/$asset.sha256"
61+
62+
- name: Upload platform artifacts
63+
uses: actions/upload-artifact@v4
64+
with:
65+
name: drx-${{ runner.os }}
66+
path: build/*
67+
68+
publish-release:
69+
needs: build
70+
runs-on: ubuntu-latest
71+
steps:
72+
- name: Download artifacts
73+
uses: actions/download-artifact@v4
74+
with:
75+
path: dist
76+
merge-multiple: true
77+
78+
- name: Build SHA256SUMS
79+
shell: bash
80+
run: |
81+
set -euo pipefail
82+
: > dist/SHA256SUMS
83+
for f in dist/*.sha256; do
84+
cat "$f" >> dist/SHA256SUMS
85+
done
86+
87+
- name: Publish GitHub release assets
88+
uses: softprops/action-gh-release@v2
89+
with:
90+
files: dist/*

.gitignore

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# https://dart.dev/guides/libraries/private-files
2+
# Created by `dart pub`
3+
.dart_tool/
4+
5+
# Build and generated outputs
6+
build/
7+
doc/api/
8+
coverage/
9+
10+
# For publishable packages, keep lockfile out of VCS
11+
pubspec.lock
12+
13+
# Editor and OS noise
14+
.idea/
15+
.vscode/
16+
*.iml
17+
.DS_Store

.pubignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
coverage/
2+
.github/
3+
tool/check_coverage.dart
4+
tool/install.sh
5+
tool/install.ps1

CHANGELOG.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
## 0.3.0
2+
3+
- Rename package and CLI naming to `drx`.
4+
- Prepare package for publication with license metadata and docs cleanup.
5+
- Add pub metadata links and executable mapping for publish readiness.
6+
- Simplify CLI surface by removing unused reserved flags.
7+
- Improve runtime logging for `--verbose` and reduce internal duplication.
8+
- Default to pub source for unprefixed package commands.
9+
- Add cross-platform binary release workflow and checksum-verifying installers.
10+
- Add `drx cache list|clean` and `drx versions` utility commands.
11+
- Show help output when `drx` runs without arguments.
12+
- Expand docs with GH binary examples and compatibility guidance.
13+
- Add `drx cache prune` with age/size controls.
14+
- Add `--json` output mode for cache and versions commands.
15+
- Support global utility flags before command verbs (for example `--json versions`).
16+
- Add GH version-list fallback to repository tags when releases are absent.
17+
18+
## 0.1.0
19+
20+
- Add `drx` CLI with `pub` and `gh` source parsing.
21+
- Implement pub execution with `jit`, `aot`, and `auto` fallback behavior.
22+
- Implement GitHub Releases binary execution with checksum enforcement.
23+
- Add cache path management, locking, and full unit test suite.

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2026 drx contributors
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)