Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
EdenEast committed Oct 25, 2023
1 parent c6e894b commit 5ae6fff
Show file tree
Hide file tree
Showing 2 changed files with 101 additions and 5 deletions.
69 changes: 69 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
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
targets: ${{matrix.target}}

- 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: |
RESULT="target-${{ matrix.target }}"
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 }}

37 changes: 32 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ jobs:
package-name: tuxmux
draft: true

# ---------------------------------------------------------------------------

github_build:
name: Build release binaries
needs: [ release_please ]
Expand All @@ -39,8 +41,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
Expand All @@ -50,24 +60,39 @@ jobs:
uses: dtolnay/rust-toolchain@v1
with:
toolchain: stable
targets: ${{matrix.target}}

- 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
cp target/${{ matrix.target }}/release/tm result
cp -r target/${{ matrix.target }}/man result
cp -r target/${{ matrix.target }}/completions result
tar czvf ${{ matrix.name }} result
RESULT="target-${{ matrix.target }}"
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 }}

# ---------------------------------------------------------------------------

upload_artifacts:
name: Add build artifacts to release
needs: [ release_please, github_build ]
Expand All @@ -91,6 +116,8 @@ jobs:
files: tuxmux-*/tuxmux-*
tag_name: ${{ needs.release_please.outputs.tag_name }}

# ---------------------------------------------------------------------------

publish_crate:
name: Publish cargo package
needs: [ release_please, github_build ]
Expand Down

0 comments on commit 5ae6fff

Please sign in to comment.