Build artifacts #19
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, 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: 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: Creating ./bin directory | |
run: mkdir -p bin | |
- name: Renaming binaries [Windows] | |
if: matrix.os == 'windows-latest' | |
run: mv target/release/uad-ng.exe bin/uad-ng-${{ matrix.build_target }}.exe | |
- name: Renaming binaries [Others] | |
if: matrix.os != 'windows-latest' | |
run: mv target/release/uad-ng bin/uad-ng${{ matrix.update_name }}-${{ matrix.build_target }} | |
- name: Tarball Linux/MacOS binary | |
if: matrix.os != 'windows-latest' | |
run: tar -czf bin/uad-ng${{ matrix.update_name }}-${{ matrix.build_target }}{.tar.gz,} | |
- name: Create checksums for binaries and archives [Windows] | |
if: matrix.os == 'windows-latest' | |
run: sha256sum bin/uad-ng-${{ matrix.build_target }}.exe | tee bin/uad-ng-${{ matrix.build_target }}-checksum.txt | |
- name: Create checksums for binaries and archives [Others] | |
if: matrix.os != 'windows-latest' | |
run: > | |
sha256sum bin/uad-ng${{ matrix.update_name }}-${{ matrix.build_target }} | tee bin/uad-ng${{ matrix.update_name }}-${{ matrix.build_target }}-checksum | |
sha256sum bin/uad-ng${{ matrix.update_name }}-${{ matrix.build_target }}.tar.gz | tee bin/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: bin/uad-ng-* |