-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Luis Garcia <[email protected]>
- Loading branch information
Showing
1 changed file
with
59 additions
and
53 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -142,53 +142,66 @@ jobs: | |
with: | ||
name: tanoshi-web | ||
path: crates/tanoshi-web/dist | ||
|
||
build-tauri: | ||
runs-on: ${{ matrix.os }} | ||
runs-on: ${{ matrix.runs_on }} | ||
needs: | ||
- build-web | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- os: [self-hosted, arm64] | ||
arch: aarch64 | ||
type: linux | ||
- os: ubuntu-latest | ||
arch: amd64 | ||
type: linux | ||
runs_on: ubuntu-latest | ||
- os: windows-latest | ||
arch: amd64 | ||
type: windows | ||
runs_on: windows-latest | ||
- os: ubuntu-latest | ||
arch: aarch64 | ||
type: linux | ||
runs_on: [self-hosted, arm64] | ||
include_arm64: ${{ startsWith(github.ref, 'refs/tags/') }} | ||
steps: | ||
- name: Skip arm64 build if not release | ||
if: matrix.arch == 'aarch64' && !matrix.include_arm64 | ||
run: echo "Skipping arm64 build since it's not a release." | ||
- uses: actions/checkout@v4 | ||
if: matrix.arch != 'aarch64' || matrix.include_arm64 | ||
|
||
- name: Download dist | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: tanoshi-web | ||
path: crates/tanoshi-web/dist | ||
if: matrix.arch != 'aarch64' || matrix.include_arm64 | ||
|
||
- uses: actions-rust-lang/setup-rust-toolchain@v1 | ||
if: matrix.arch != 'aarch64' || matrix.include_arm64 | ||
|
||
- uses: Swatinem/rust-cache@v2 | ||
with: | ||
key: "${{ matrix.type }}-${{ matrix.arch }}" | ||
|
||
if: matrix.arch != 'aarch64' || matrix.include_arm64 | ||
|
||
- name: Install deps (ubuntu) | ||
if: ${{ matrix.os != 'macos-latest' && matrix.os != 'windows-latest' }} | ||
if: (matrix.os == 'ubuntu-latest' || matrix.os == 'self-hosted') && (matrix.arch != 'aarch64' || matrix.include_arm64) | ||
run: sudo apt update && sudo apt upgrade -y && sudo apt install -y ${{ env.UBUNTU_DEPS }} | ||
|
||
- name: Install deps (macOS) | ||
if: ${{ matrix.os == 'macos-latest' }} | ||
run: brew install icu4c libarchive bzip2 lz4 zlib expat libiconv | ||
|
||
- uses: ilammy/setup-nasm@v1 | ||
if: matrix.arch != 'aarch64' || matrix.include_arm64 | ||
|
||
- name: Install LLVM and Clang | ||
uses: KyleMayes/[email protected] | ||
with: | ||
version: ${{ env.LLVM_VERSION }} | ||
if: matrix.arch != 'aarch64' || matrix.include_arm64 | ||
|
||
- name: Cache vcpkg | ||
uses: actions/cache@v4 | ||
|
@@ -208,12 +221,13 @@ jobs: | |
- name: Install Binstall | ||
uses: cargo-bins/cargo-binstall@main | ||
if: matrix.arch != 'aarch64' || matrix.include_arm64 | ||
|
||
- name: Install tauri-cli | ||
run: cargo binstall [email protected] --no-confirm --locked | ||
if: matrix.arch != 'aarch64' || matrix.include_arm64 | ||
|
||
- name: Build tauri (ubuntu) | ||
if: ${{ matrix.os != 'macos-latest' && matrix.os != 'windows-latest' }} | ||
- name: Build tauri | ||
shell: bash | ||
env: | ||
RUSTFLAGS: "-Clink-arg=-Wl,--allow-multiple-definition" | ||
|
@@ -224,53 +238,30 @@ jobs: | |
else | ||
cargo tauri build --debug | ||
fi | ||
if: matrix.arch != 'aarch64' || matrix.include_arm64 | ||
|
||
- name: Build tanoshi (macos) | ||
if: ${{ matrix.os == 'macos-latest' }} | ||
shell: bash | ||
env: | ||
PKG_CONFIG_PATH: /usr/local/opt/icu4c/lib/pkgconfig:/usr/local/opt/libarchive/lib/pkgconfig:/usr/local/opt/zlib/lib/pkgconfig:/usr/local/opt/expat/lib/pkgconfig | ||
- name: Move files | ||
run: | | ||
cd crates/tanoshi-tauri | ||
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then | ||
cargo tauri build | ||
mkdir -p builds | ||
if [[ "${{ matrix.os }}" != "windows-latest" ]]; then | ||
find target/ -type f \( -name "*.deb" -o -name "*.AppImage" -o -name "*.dmg" \) -print0 | | ||
while IFS= read -r -d '' file; do | ||
mv "$file" ${{ github.workspace }}/builds/ | ||
done | ||
else | ||
cargo tauri build --debug | ||
mv target/*/bundle/msi/*.msi ${{ github.workspace }}/builds/ | ||
fi | ||
- name: Build tanoshi (windows) | ||
if: ${{ matrix.os == 'windows-latest' }} | ||
run: | | ||
cd crates/tanoshi-tauri | ||
if ($env:GITHUB_REF -match '^refs/tags/') { | ||
cargo tauri build | ||
} else { | ||
cargo tauri build --debug | ||
} | ||
- name: Move files (linux/macOS) | ||
if: ${{ matrix.os != 'windows-latest' }} | ||
run: | | ||
mkdir -p builds | ||
find target/ -type f \( -name "*.deb" -o -name "*.AppImage" -o -name "*.dmg" \) -print0 | | ||
while IFS= read -r -d '' file; do | ||
mv "$file" ${{ github.workspace }}/builds/ | ||
done | ||
- name: Move files (windows) | ||
if: ${{ matrix.os == 'windows-latest' }} | ||
run: | | ||
mkdir -p builds | ||
mv target/*/bundle/msi/*.msi ${{ github.workspace }}/builds/ | ||
if: matrix.arch != 'aarch64' || matrix.include_arm64 | ||
|
||
- name: Upload dist | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: tanoshi-app-${{ matrix.type }}-${{ matrix.arch }} | ||
path: ${{ github.workspace }}/builds/ | ||
if: matrix.arch != 'aarch64' || matrix.include_arm64 | ||
|
||
- name: Upload binaries to GitHub Releases | ||
if: startsWith(github.ref, 'refs/tags/') | ||
if: startsWith(github.ref, 'refs/tags/') && (matrix.arch != 'aarch64' || matrix.include_arm64) | ||
uses: svenstaro/upload-release-action@v2 | ||
with: | ||
repo_token: ${{ secrets.GITHUB_TOKEN }} | ||
|
@@ -280,45 +271,56 @@ jobs: | |
overwrite: true | ||
|
||
build-tanoshi: | ||
runs-on: ${{ matrix.os }} | ||
runs-on: ${{ matrix.runs_on }} | ||
needs: | ||
- build-web | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- os: [self-hosted, arm64] | ||
arch: aarch64 | ||
type: linux | ||
- os: ubuntu-latest | ||
arch: amd64 | ||
type: linux | ||
runs_on: ubuntu-latest | ||
- os: ubuntu-latest | ||
arch: aarch64 | ||
type: linux | ||
runs_on: [self-hosted, arm64] | ||
include_arm64: ${{ startsWith(github.ref, 'refs/tags/') }} | ||
steps: | ||
- name: Skip arm64 build if not release | ||
if: matrix.arch == 'aarch64' && !matrix.include_arm64 | ||
run: echo "Skipping arm64 build since it's not a release." | ||
- uses: actions/checkout@v4 | ||
if: matrix.arch != 'aarch64' || matrix.include_arm64 | ||
|
||
- name: Download dist | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: tanoshi-web | ||
path: crates/tanoshi-web/dist | ||
if: matrix.arch != 'aarch64' || matrix.include_arm64 | ||
|
||
- uses: actions-rust-lang/setup-rust-toolchain@v1 | ||
if: matrix.arch != 'aarch64' || matrix.include_arm64 | ||
|
||
- uses: Swatinem/rust-cache@v2 | ||
with: | ||
key: "${{ matrix.type }}-${{ matrix.arch }}" | ||
|
||
if: matrix.arch != 'aarch64' || matrix.include_arm64 | ||
|
||
- name: Install deps | ||
if: ${{ matrix.os != 'macos-latest' && matrix.os != 'windows-latest' }} | ||
run: sudo apt update && sudo apt upgrade -y && sudo apt install -y ${{ env.UBUNTU_DEPS }} | ||
|
||
if: matrix.arch != 'aarch64' || matrix.include_arm64 | ||
|
||
- uses: ilammy/setup-nasm@v1 | ||
if: matrix.arch != 'aarch64' || matrix.include_arm64 | ||
|
||
- name: Install LLVM and Clang | ||
uses: KyleMayes/[email protected] | ||
with: | ||
version: ${{ env.LLVM_VERSION }} | ||
if: matrix.arch != 'aarch64' || matrix.include_arm64 | ||
|
||
- name: Build tanoshi | ||
shell: bash | ||
|
@@ -332,19 +334,22 @@ jobs: | |
cargo build -p tanoshi | ||
echo "build_dir=debug" >> $GITHUB_ENV | ||
fi | ||
if: matrix.arch != 'aarch64' || matrix.include_arm64 | ||
|
||
- name: Upload dist | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: tanoshi-${{ matrix.arch }} | ||
path: ${{ github.workspace }}/target/${{ env.build_dir }}/tanoshi | ||
if: matrix.arch != 'aarch64' || matrix.include_arm64 | ||
|
||
docker: | ||
runs-on: ubuntu-latest | ||
needs: | ||
- build-tanoshi | ||
env: | ||
DEFAULT_VARIANT: slim | ||
BUILD_PLATFORMS: ${{ startsWith(github.ref, 'refs/tags/') && 'linux/amd64,linux/arm64' || 'linux/amd64' }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
|
@@ -362,6 +367,7 @@ jobs: | |
path: linux/amd64 | ||
|
||
- name: Download dist (AARCH64) | ||
if: startsWith(github.ref, 'refs/tags/') | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: tanoshi-aarch64 | ||
|
@@ -425,7 +431,7 @@ jobs: | |
with: | ||
context: . | ||
file: ${{ matrix.dockerfile }} | ||
platforms: linux/amd64,linux/arm64 | ||
platforms: ${{ env.BUILD_PLATFORMS }} | ||
push: false | ||
tags: tanoshi:action | ||
|
||
|
@@ -436,7 +442,7 @@ jobs: | |
with: | ||
context: . | ||
file: ${{ matrix.dockerfile }} | ||
platforms: linux/amd64,linux/arm64 | ||
platforms: ${{ env.BUILD_PLATFORMS }} | ||
push: true | ||
tags: ${{ steps.docker_meta.outputs.tags }} | ||
labels: ${{ steps.docker_meta.outputs.labels }} | ||
|