From e3eb88d207df2e92147ef28001dd18d718390df7 Mon Sep 17 00:00:00 2001 From: EdenEast Date: Tue, 24 Oct 2023 18:55:08 -0400 Subject: [PATCH] wip --- .github/workflows/build.yml | 67 +++++++++++++++++++++++++++++++++++ .github/workflows/release.yml | 19 ++++++++++ 2 files changed, 86 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..d48a0ab --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,67 @@ +name: build +on: + push: + branches: + - main + - ci/* + pull_request: +concurrency: # Spend CI time only on latest ref: https://docs.github.com/en/actions/using-jobs/using-concurrency + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + build: + name: Build binaries + strategy: + matrix: + include: + - target: x86_64-unknown-linux-gnu + os: ubuntu-latest + name: tuxmux-x86_64-unknown-linux-gnu.tar.gz + - target: aarch64-unknown-linux-gnu + os: ubuntu-latest + name: tuxmux-aarch64-unknown-linux-gnu.tar.gz + - target: x86_64-apple-darwin + os: macos-latest + name: tuxmux-x86_64-apple-darwin.tar.gz + - target: aarch64-apple-darwin + os: macos-latest + name: tuxmux-aarch64-apple-darwin.tar.gz + runs-on: ${{ matrix.os }} + steps: + - name: Setup | Checkout + uses: actions/checkout@v4 + + - name: Setup | Rust + uses: dtolnay/rust-toolchain@v1 + with: + toolchain: stable + + - name: Setup | Install cross [Linux] + if: matrix.os == 'ubuntu-latest' + uses: taiki-e/install-action@v2 + with: + tool: cross + + - name: Build | Build [Cargo] + if: matrix.os != 'ubuntu-latest' + run: cargo build --locked --target ${{ matrix.target }} + + - name: Build | Build [Cross] + if: matrix.os == 'ubuntu-latest' + run: cross build --locked --target ${{ matrix.target }} + + - name: Post | Prepare artifacts + run: | + mkdir result + cp target/${{ matrix.target }}/debug/tm result + cp -r target/${{ matrix.target }}/man result + cp -r target/${{ matrix.target }}/completions result + tar czvf ${{ matrix.name }} result + + - name: Release | Upload artifacts + uses: actions/upload-artifact @v3 + with: + name: ${{ matrix.name }} + path: ${{ matrix.name }} + diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 31a8180..292ed02 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -39,8 +39,16 @@ jobs: include: - target: x86_64-unknown-linux-gnu os: ubuntu-latest + name: tuxmux-x86_64-unknown-linux-gnu.tar.gz + - target: aarch64-unknown-linux-gnu + os: ubuntu-latest + name: tuxmux-aarch64-unknown-linux-gnu.tar.gz - target: x86_64-apple-darwin os: macos-latest + name: tuxmux-x86_64-apple-darwin.tar.gz + - target: aarch64-apple-darwin + os: macos-latest + name: tuxmux-aarch64-apple-darwin.tar.gz runs-on: ${{ matrix.os }} steps: - name: Setup | Checkout @@ -51,9 +59,20 @@ jobs: with: toolchain: stable + - name: Setup | Install cross [Linux] + if: matrix.os == 'ubuntu-latest' + uses: taiki-e/install-action@v2 + with: + tool: cross + - name: Build | Build [Cargo] + if: matrix.os != 'ubuntu-latest' run: cargo build --release --locked --target ${{ matrix.target }} + - name: Build | Build [Cross] + if: matrix.os == 'ubuntu-latest' + run: cross build --release --locked --target ${{ matrix.target }} + - name: Post | Prepare artifacts run: | mkdir result