|
| 1 | +name: TUI Binaries |
| 2 | + |
| 3 | +# Builds the Rust TUI for every published platform and uploads one artifact per |
| 4 | +# platform package, named after it (`tui-<os>-<arch>`). Publishing workflows call |
| 5 | +# this and stage the artifacts under packages/tui/dist/bin before `publish.mjs`. |
| 6 | +on: |
| 7 | + workflow_call: |
| 8 | + workflow_dispatch: |
| 9 | + |
| 10 | +permissions: |
| 11 | + contents: read |
| 12 | + |
| 13 | +jobs: |
| 14 | + build: |
| 15 | + name: build (${{ matrix.package }}) |
| 16 | + runs-on: ${{ matrix.runner }} |
| 17 | + strategy: |
| 18 | + fail-fast: true |
| 19 | + matrix: |
| 20 | + include: |
| 21 | + - package: tui-darwin-arm64 |
| 22 | + runner: macos-14 |
| 23 | + target: aarch64-apple-darwin |
| 24 | + - package: tui-darwin-x64 |
| 25 | + runner: macos-14 |
| 26 | + target: x86_64-apple-darwin |
| 27 | + # Linux binaries link musl statically, so one build runs on any distro. |
| 28 | + - package: tui-linux-arm64 |
| 29 | + runner: ubuntu-24.04-arm |
| 30 | + target: aarch64-unknown-linux-musl |
| 31 | + - package: tui-linux-x64 |
| 32 | + runner: ubuntu-24.04 |
| 33 | + target: x86_64-unknown-linux-musl |
| 34 | + defaults: |
| 35 | + run: |
| 36 | + working-directory: packages/tui |
| 37 | + steps: |
| 38 | + - uses: actions/checkout@v6 |
| 39 | + - if: runner.os == 'Linux' |
| 40 | + run: sudo apt-get update && sudo apt-get install -y musl-tools |
| 41 | + - uses: dtolnay/rust-toolchain@stable |
| 42 | + with: |
| 43 | + targets: ${{ matrix.target }} |
| 44 | + - uses: Swatinem/rust-cache@v2 |
| 45 | + with: |
| 46 | + workspaces: packages/tui |
| 47 | + key: ${{ matrix.target }} |
| 48 | + - run: cargo build --release --locked --target ${{ matrix.target }} |
| 49 | + - name: Inspect binary |
| 50 | + run: file target/${{ matrix.target }}/release/codework-tui |
| 51 | + - if: runner.os == 'Linux' |
| 52 | + name: Require a static binary |
| 53 | + run: file target/${{ matrix.target }}/release/codework-tui | grep -E "static(-pie)? linked|statically linked" |
| 54 | + - uses: actions/upload-artifact@v4 |
| 55 | + with: |
| 56 | + name: ${{ matrix.package }} |
| 57 | + path: packages/tui/target/${{ matrix.target }}/release/codework-tui |
| 58 | + if-no-files-found: error |
| 59 | + retention-days: 7 |
0 commit comments