update .justfile #152
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
| name: Build diagnostic-tui | |
| on: | |
| push: | |
| branches: [main] | |
| tags: ["v*"] | |
| pull_request: | |
| branches: [main] | |
| workflow_dispatch: | |
| env: | |
| CARGO_TERM_COLOR: always | |
| BINARY_NAME: diagnostic-tui | |
| jobs: | |
| test: | |
| name: Test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| - uses: Swatinem/rust-cache@v2 | |
| - name: Run tests | |
| run: cargo test --workspace | |
| - name: Check formatting | |
| run: cargo fmt --all -- --check | |
| - name: Clippy | |
| run: cargo clippy --workspace -- -D warnings | |
| build: | |
| name: Build / ${{ matrix.name }} | |
| needs: test | |
| runs-on: ${{ matrix.runner }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - name: linux-x86_64 | |
| runner: ubuntu-latest | |
| target: x86_64-unknown-linux-gnu | |
| asset_name: diagnostic-tui-linux-x86_64 | |
| - name: linux-aarch64 | |
| runner: ubuntu-latest | |
| target: aarch64-unknown-linux-gnu | |
| asset_name: diagnostic-tui-linux-aarch64 | |
| - name: macos-x86_64 | |
| runner: macos-latest | |
| target: x86_64-apple-darwin | |
| asset_name: diagnostic-tui-macos-x86_64 | |
| - name: macos-aarch64 | |
| runner: macos-latest | |
| target: aarch64-apple-darwin | |
| asset_name: diagnostic-tui-macos-aarch64 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.target }} | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| key: ${{ matrix.target }} | |
| - name: Install cross-compilation tools (Linux aarch64) | |
| if: matrix.target == 'aarch64-unknown-linux-gnu' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu | |
| echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> "$GITHUB_ENV" | |
| - name: Build release binary | |
| run: cargo build --release --package diagnostic-tui --target ${{ matrix.target }} | |
| - name: Prepare artifact | |
| run: | | |
| mkdir -p staging | |
| cp target/${{ matrix.target }}/release/${{ env.BINARY_NAME }} staging/${{ matrix.asset_name }} | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.asset_name }} | |
| path: staging/${{ matrix.asset_name }} | |
| retention-days: 14 | |
| release: | |
| name: Release | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| needs: build | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| merge-multiple: true | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| generate_release_notes: true | |
| files: artifacts/* |