Repository navigation
bui: the command-line tool (new, init, dev, build, doctor, update) #46
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
Open
ppmpreetham
wants to merge
10
commits into
main
Choose a base branch
from
cli
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
68a7bac
bui command
ppmpreetham cc3870a
bui polish
ppmpreetham d26e2b2
bui fix
ppmpreetham 8cd591c
bui test
ppmpreetham 31e7485
bui workflow
ppmpreetham 127fba7
bui installers
ppmpreetham a2f566e
bui locks
ppmpreetham 023a34e
bui review
ppmpreetham e65d963
bui review2
ppmpreetham cf932f6
bui review3
ppmpreetham 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
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,2 @@ | ||
| # shell scripts must keep LF line endings, whatever the checkout: a CRLF install.sh breaks `sh` | ||
| *.sh text eol=lf |
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,157 @@ | ||
| # The `bui` command (tools/bui): tested on the three systems for every change to it, and built for | ||
| # six targets and attached to the GitHub Release when a release tag is pushed. The installers | ||
| # (website/public/install.sh and install.ps1) and `bui update` download these archives. | ||
| # | ||
| # bui-<target>.tar.gz (Linux, macOS; holds `bui`) | ||
| # bui-<target>.zip (Windows; holds `bui.exe`) | ||
| # <archive>.sha256 | ||
| # | ||
| # A release is made by tools/release.py (it tags vX.Y.Z); this runs beside release.yml and adds the | ||
| # files to the release that one creates (whichever workflow gets there first creates it). | ||
|
|
||
| name: bui command | ||
|
|
||
| on: | ||
| push: | ||
| tags: ["v*"] | ||
| pull_request: | ||
| paths: ["tools/bui/**", "website/public/install.*", ".github/workflows/cli.yml"] | ||
| workflow_dispatch: | ||
| inputs: | ||
| tag: | ||
| description: "Release tag to attach the archives to (e.g. v0.5.1)" | ||
| required: true | ||
| publish: | ||
| description: "Really upload (otherwise only build)" | ||
| type: boolean | ||
| default: false | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| env: | ||
| CARGO_TERM_COLOR: always | ||
|
|
||
| jobs: | ||
| test: | ||
| name: test (${{ matrix.os }}) | ||
| runs-on: ${{ matrix.os }} | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| os: [ubuntu-latest, windows-latest, macos-15] | ||
| defaults: | ||
| run: | ||
| working-directory: tools/bui | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| # a manual run builds the tag it was given, not the branch it was started from | ||
| ref: ${{ github.event.inputs.tag || github.ref }} | ||
| persist-credentials: false | ||
| - uses: dtolnay/rust-toolchain@stable | ||
| with: | ||
| components: clippy | ||
| - uses: Swatinem/rust-cache@v2 | ||
| with: | ||
| workspaces: tools/bui | ||
| - run: cargo clippy --locked --all-targets -- -D warnings | ||
| - run: cargo test --locked | ||
|
|
||
| installers: | ||
| name: installers (syntax) | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| persist-credentials: false | ||
| - name: install.sh is POSIX sh and passes shellcheck | ||
| run: | | ||
| sudo apt-get install -y shellcheck dash | ||
| dash -n website/public/install.sh | ||
| shellcheck -s sh -S warning website/public/install.sh | ||
| - name: install.ps1 is plain ASCII (Windows PowerShell 5.1 decodes a download as it likes) and parses | ||
| shell: pwsh | ||
| run: | | ||
| $bytes = [IO.File]::ReadAllBytes('website/public/install.ps1') | ||
| if ($bytes | Where-Object { $_ -gt 127 }) { throw 'install.ps1 has non-ASCII characters' } | ||
| $errors = $null | ||
| [void][System.Management.Automation.Language.Parser]::ParseFile((Resolve-Path 'website/public/install.ps1'), [ref]$null, [ref]$errors) | ||
| if ($errors) { $errors | ForEach-Object { Write-Error $_.Message }; exit 1 } | ||
|
|
||
| build: | ||
| name: build (${{ matrix.target }}) | ||
| needs: [test, installers] | ||
| runs-on: ${{ matrix.os }} | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| include: | ||
| - { target: x86_64-unknown-linux-gnu, os: ubuntu-22.04 } | ||
| - { target: aarch64-unknown-linux-gnu, os: ubuntu-22.04-arm } | ||
| - { target: x86_64-apple-darwin, os: macos-15-intel } | ||
| - { target: aarch64-apple-darwin, os: macos-15 } | ||
| - { target: x86_64-pc-windows-msvc, os: windows-latest } | ||
| - { target: aarch64-pc-windows-msvc, os: windows-11-arm } | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| # a manual run builds the tag it was given, not the branch it was started from | ||
| ref: ${{ github.event.inputs.tag || github.ref }} | ||
| persist-credentials: false | ||
| - uses: dtolnay/rust-toolchain@stable | ||
| with: | ||
| targets: ${{ matrix.target }} | ||
| - uses: Swatinem/rust-cache@v2 | ||
| with: | ||
| workspaces: tools/bui | ||
| key: ${{ matrix.target }} | ||
| - name: Build | ||
| working-directory: tools/bui | ||
| run: cargo build --release --locked --target ${{ matrix.target }} | ||
| - name: Package (Unix) | ||
| if: runner.os != 'Windows' | ||
| shell: bash | ||
| run: | | ||
| set -eu | ||
| mkdir -p dist | ||
| name="bui-${{ matrix.target }}.tar.gz" | ||
| tar -czf "dist/$name" -C "tools/bui/target/${{ matrix.target }}/release" bui | ||
| (cd dist && { sha256sum "$name" 2>/dev/null || shasum -a 256 "$name"; } > "$name.sha256") | ||
| - name: Package (Windows) | ||
| if: runner.os == 'Windows' | ||
| shell: pwsh | ||
| run: | | ||
| New-Item -ItemType Directory dist | Out-Null | ||
| $name = "bui-${{ matrix.target }}.zip" | ||
| Compress-Archive -Path "tools/bui/target/${{ matrix.target }}/release/bui.exe" -DestinationPath "dist/$name" | ||
| $hash = (Get-FileHash "dist/$name" -Algorithm SHA256).Hash.ToLower() | ||
| "$hash $name" | Set-Content "dist/$name.sha256" -NoNewline | ||
| - uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: bui-${{ matrix.target }} | ||
| path: dist/* | ||
|
|
||
| upload: | ||
| name: attach to the GitHub Release | ||
| needs: build | ||
| if: github.event_name == 'push' || github.event.inputs.publish == 'true' | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write | ||
| env: | ||
| TAG: ${{ github.event.inputs.tag || github.ref_name }} | ||
| GH_TOKEN: ${{ github.token }} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| persist-credentials: false | ||
| - uses: actions/download-artifact@v4 | ||
| with: | ||
| path: dist | ||
| merge-multiple: true | ||
| - name: Create the release if release.yml has not yet, then attach the files | ||
| run: | | ||
| ls -l dist | ||
| gh release view "$TAG" >/dev/null 2>&1 || gh release create "$TAG" --title "BUI ${TAG#v}" --generate-notes --verify-tag || gh release view "$TAG" >/dev/null | ||
| gh release upload "$TAG" dist/* --clobber | ||
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
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
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
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
Oops, something went wrong.
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.