Build artifacts #26
This file contains 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 artifacts | |
on: | |
workflow_dispatch: | |
workflow_call: | |
jobs: | |
build: | |
name: Building ${{ matrix.build_target }} [${{ matrix.update_feature }}] | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
build_target: [linux, macos, macos-intel, windows] | |
update_feature: [self-update, no-self-update] | |
exclude: | |
- build_target: windows | |
update_feature: no-self-update | |
include: | |
- build_target: linux | |
os: ubuntu-latest | |
- build_target: macos | |
os: macos-latest | |
- build_target: macos-intel | |
os: macos-13 | |
- build_target: windows | |
os: windows-latest | |
- update_feature: self-update | |
update_name: "" # we don't want this in the binary filename | |
- update_feature: no-self-update | |
update_name: "-noselfupdate" | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
- uses: rui314/setup-mold@v1 # faster linker | |
- uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target | |
key: ${{ runner.os }}-release-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: ${{ runner.OS }}-release- | |
if: matrix.os == 'ubuntu-latest' | |
- name: Building | |
run: cargo build --release --no-default-features --features wgpu,${{ matrix.update_feature }} | |
- name: Renaming binaries [Windows] | |
if: matrix.os == 'windows-latest' | |
run: mv target/release/uad-ng.exe uad-ng-${{ matrix.build_target }}.exe | |
- name: Renaming binaries [Others] | |
if: matrix.os != 'windows-latest' | |
run: mv target/release/uad-ng uad-ng${{ matrix.update_name }}-${{ matrix.build_target }} | |
- name: Tarball Linux/MacOS binary | |
if: matrix.os != 'windows-latest' | |
run: tar -czf uad-ng${{ matrix.update_name }}-${{ matrix.build_target }}{.tar.gz,} | |
- name: Install coreutils for macOS | |
if: startsWith(matrix.os, 'macos') | |
run: brew install coreutils | |
- name: Create checksums for binaries and archives [Windows] | |
if: matrix.os == 'windows-latest' | |
run: sha256sum uad-ng-${{ matrix.build_target }}.exe | tee uad-ng-${{ matrix.build_target }}.exe-checksum.txt | |
- name: Create checksums for binaries and archives [Others] | |
if: matrix.os != 'windows-latest' | |
run: | | |
sha256sum uad-ng${{ matrix.update_name }}-${{ matrix.build_target }} | tee uad-ng${{ matrix.update_name }}-${{ matrix.build_target }}-checksum | |
sha256sum uad-ng${{ matrix.update_name }}-${{ matrix.build_target }}.tar.gz | tee uad-ng${{ matrix.update_name }}-${{ matrix.build_target }}.tar.gz-checksum | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: uad-ng${{ matrix.update_name }}-${{ matrix.build_target }} | |
path: uad-ng-* |