-
Notifications
You must be signed in to change notification settings - Fork 0
CLI Build and Deployment Setup #17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
82b7805
Add prep release script
dannysmith 6fdfbc2
add build scripts for standalone binary compilation
dannysmith b44bca8
add CI workflow for lint, test, and binary builds
dannysmith dbf2520
ci(cli): add release workflow and install script
dannysmith a4af50e
Release process
dannysmith aa32564
add release process documentation
dannysmith a609402
Fix Builds
dannysmith 7fddb64
fix(ci): address CodeRabbit review feedback
dannysmith 52c5a08
Fixes
dannysmith 0576d22
Fixes
dannysmith 0c8d93f
Fix test issues
dannysmith a715acd
Tweaks
dannysmith 548c31f
Fix failing tests on Windows and Linux.
dannysmith 85000c8
Fix Windows CI: use Path::join() for cross-platform path construction
dannysmith File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,111 @@ | ||
| name: CI - CLI | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main] | ||
| paths: | ||
| - 'tdn-cli/**' | ||
| - '.github/workflows/ci-cli.yml' | ||
| pull_request: | ||
| branches: [main] | ||
| paths: | ||
| - 'tdn-cli/**' | ||
| - '.github/workflows/ci-cli.yml' | ||
|
|
||
| defaults: | ||
| run: | ||
| working-directory: tdn-cli | ||
|
|
||
| env: | ||
| CARGO_TERM_COLOR: always | ||
|
|
||
| jobs: | ||
| lint: | ||
| name: Lint & Typecheck | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: oven-sh/setup-bun@v2 | ||
| - uses: dtolnay/rust-toolchain@stable | ||
| - uses: swatinem/rust-cache@v2 | ||
| with: | ||
| workspaces: './tdn-cli/crates/core -> target' | ||
| - run: bun install | ||
| - run: bun run build # Build NAPI bindings | ||
| - run: bun run check | ||
|
|
||
| test: | ||
| name: Test - ${{ matrix.os }} | ||
| runs-on: ${{ matrix.os }} | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| os: [ubuntu-latest, macos-latest, windows-latest] | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: oven-sh/setup-bun@v2 | ||
| - uses: dtolnay/rust-toolchain@stable | ||
| - uses: swatinem/rust-cache@v2 | ||
| with: | ||
| workspaces: './tdn-cli/crates/core -> target' | ||
| - run: bun install | ||
| - run: bun run build | ||
| - run: bun run test | ||
|
|
||
| build: | ||
| name: Build Binary - ${{ matrix.target }} | ||
| runs-on: ${{ matrix.runner }} | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| include: | ||
| - target: darwin-arm64 | ||
| runner: macos-latest | ||
| - target: darwin-x64 | ||
| runner: macos-15-intel | ||
| - target: linux-x64 | ||
| runner: ubuntu-latest | ||
| - target: linux-arm64 | ||
| runner: ubuntu-24.04-arm | ||
| - target: windows-x64 | ||
| runner: windows-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: oven-sh/setup-bun@v2 | ||
| - uses: dtolnay/rust-toolchain@stable | ||
| - uses: swatinem/rust-cache@v2 | ||
| with: | ||
| workspaces: './tdn-cli/crates/core -> target' | ||
|
|
||
| - name: Install dependencies | ||
| run: bun install | ||
|
|
||
| - name: Build NAPI bindings | ||
| run: bun run build | ||
|
|
||
| - name: Build standalone binary (Unix) | ||
| if: matrix.target != 'windows-x64' | ||
| run: bun build --compile --minify src/index.ts --outfile dist/tdn-${{ matrix.target }} | ||
|
|
||
| - name: Build standalone binary (Windows) | ||
| if: matrix.target == 'windows-x64' | ||
| run: bun build --compile --minify src/index.ts --outfile dist/tdn-${{ matrix.target }}.exe | ||
|
|
||
| - name: Smoke test binary (Unix) | ||
| if: matrix.target != 'windows-x64' | ||
| run: | | ||
| ./dist/tdn-${{ matrix.target }} --version | ||
| ./dist/tdn-${{ matrix.target }} --help | ||
|
|
||
| - name: Smoke test binary (Windows) | ||
| if: matrix.target == 'windows-x64' | ||
| run: | | ||
| .\dist\tdn-${{ matrix.target }}.exe --version | ||
| .\dist\tdn-${{ matrix.target }}.exe --help | ||
|
|
||
| - name: Upload artifact | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: tdn-${{ matrix.target }} | ||
| path: tdn-cli/dist/tdn-${{ matrix.target }}* | ||
| if-no-files-found: error |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,138 @@ | ||
| name: Release - CLI | ||
|
|
||
| on: | ||
| push: | ||
| tags: | ||
| - 'tdn-cli-v*' | ||
|
|
||
| defaults: | ||
| run: | ||
| working-directory: tdn-cli | ||
|
|
||
| permissions: | ||
| contents: write | ||
|
|
||
| env: | ||
| CARGO_TERM_COLOR: always | ||
|
|
||
| jobs: | ||
| build: | ||
| name: Build - ${{ matrix.target }} | ||
| runs-on: ${{ matrix.runner }} | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| include: | ||
| - target: darwin-arm64 | ||
| runner: macos-latest | ||
| - target: darwin-x64 | ||
| runner: macos-15-intel | ||
| - target: linux-x64 | ||
| runner: ubuntu-latest | ||
| - target: linux-arm64 | ||
| runner: ubuntu-24.04-arm | ||
| - target: windows-x64 | ||
| runner: windows-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: oven-sh/setup-bun@v2 | ||
| - uses: dtolnay/rust-toolchain@stable | ||
|
|
||
| - name: Install dependencies | ||
| run: bun install | ||
|
|
||
| - name: Build NAPI bindings | ||
| run: bun run build | ||
|
|
||
| - name: Build standalone binary (Unix) | ||
| if: matrix.target != 'windows-x64' | ||
| run: bun build --compile --minify src/index.ts --outfile dist/tdn | ||
|
|
||
| - name: Build standalone binary (Windows) | ||
| if: matrix.target == 'windows-x64' | ||
| run: bun build --compile --minify src/index.ts --outfile dist/tdn.exe | ||
|
|
||
| - name: Create archive (Unix) | ||
| if: matrix.target != 'windows-x64' | ||
| run: | | ||
| cd dist | ||
| tar -czvf tdn-${{ matrix.target }}.tar.gz tdn | ||
| # macOS uses shasum, Linux uses sha256sum | ||
| if command -v sha256sum &> /dev/null; then | ||
| sha256sum tdn-${{ matrix.target }}.tar.gz > tdn-${{ matrix.target }}.tar.gz.sha256 | ||
| else | ||
| shasum -a 256 tdn-${{ matrix.target }}.tar.gz > tdn-${{ matrix.target }}.tar.gz.sha256 | ||
| fi | ||
| rm tdn | ||
|
|
||
| - name: Create archive (Windows) | ||
| if: matrix.target == 'windows-x64' | ||
| shell: bash | ||
| run: | | ||
| cd dist | ||
| 7z a -tzip tdn-${{ matrix.target }}.zip tdn.exe | ||
| sha256sum tdn-${{ matrix.target }}.zip > tdn-${{ matrix.target }}.zip.sha256 | ||
| rm tdn.exe | ||
|
|
||
| - name: Upload artifact (Unix) | ||
| if: matrix.target != 'windows-x64' | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: tdn-${{ matrix.target }} | ||
| path: | | ||
| tdn-cli/dist/tdn-${{ matrix.target }}.tar.gz | ||
| tdn-cli/dist/tdn-${{ matrix.target }}.tar.gz.sha256 | ||
| if-no-files-found: error | ||
|
|
||
| - name: Upload artifact (Windows) | ||
| if: matrix.target == 'windows-x64' | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: tdn-${{ matrix.target }} | ||
| path: | | ||
| tdn-cli/dist/tdn-${{ matrix.target }}.zip | ||
| tdn-cli/dist/tdn-${{ matrix.target }}.zip.sha256 | ||
| if-no-files-found: error | ||
|
|
||
| release: | ||
| name: Create GitHub Release | ||
| needs: build | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Download all artifacts | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| path: artifacts | ||
| merge-multiple: true | ||
|
|
||
| - name: Copy install script | ||
| working-directory: . | ||
| run: cp tdn-cli/scripts/install.sh artifacts/install.sh | ||
|
|
||
| - name: List artifacts | ||
| working-directory: . | ||
| run: ls -la artifacts/ | ||
|
|
||
| - name: Extract version | ||
| id: version | ||
| run: echo "version=${GITHUB_REF#refs/tags/tdn-cli-v}" >> "$GITHUB_OUTPUT" | ||
|
|
||
| - name: Create Release | ||
| uses: softprops/action-gh-release@v2 | ||
| with: | ||
| name: tdn-cli v${{ steps.version.outputs.version }} | ||
| generate_release_notes: true | ||
| files: artifacts/* | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| - name: Trigger Homebrew update | ||
| if: ${{ !contains(github.ref, '-') }} # Skip for pre-releases (e.g., v1.0.0-beta) | ||
| uses: peter-evans/repository-dispatch@v3 | ||
| with: | ||
| token: ${{ secrets.HOMEBREW_TAP_TOKEN }} | ||
| repository: dannysmith/homebrew-taproom | ||
| event-type: update-tdn-formula | ||
| client-payload: '{"version": "${{ steps.version.outputs.version }}"}' | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.