Skip to content

Commit

Permalink
CI: Use arm64 builder
Browse files Browse the repository at this point in the history
  • Loading branch information
luigi311 committed Feb 7, 2025
1 parent e2939d1 commit e92ad2b
Showing 1 changed file with 17 additions and 65 deletions.
82 changes: 17 additions & 65 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,33 +136,25 @@ jobs:
path: crates/tanoshi-web/dist

build-tauri:
runs-on: ${{ matrix.runs_on }}
runs-on: ${{ matrix.os }}
needs:
- build-web
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
- os: ubuntu-24.04
arch: amd64
type: linux
runs_on: ubuntu-latest
- os: windows-latest
arch: amd64
type: windows
runs_on: windows-latest
- os: ubuntu-latest
- os: ubuntu-24.04-arm
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."

steps:
- uses: actions/checkout@v4
if: matrix.arch != 'aarch64' || matrix.include_arm64
with:
persist-credentials: false

Expand All @@ -171,56 +163,49 @@ jobs:
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 == 'ubuntu-latest' || matrix.os == 'self-hosted') && (matrix.arch != 'aarch64' || matrix.include_arm64)
if: ${{ matrix.type == 'linux' }}
run: sudo apt update && sudo apt upgrade -y && sudo apt install -y $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
if: ${{ matrix.os == 'windows-latest' }}
if: ${{ matrix.type == 'windows' }}
with:
path: "C:/vcpkg/installed"
key: vcpkg-${{ matrix.os }}-
restore-keys: |
vcpkg-${{ matrix.os }}-
- name: Install deps (windows)
if: ${{ matrix.os == 'windows-latest' }}
if: ${{ matrix.type == 'windows' }}
run: |
vcpkg integrate install
vcpkg install --only-downloads libarchive:x64-windows-static-md
vcpkg install libarchive:x64-windows-static-md
- 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
shell: bash
Expand All @@ -229,10 +214,9 @@ jobs:
run: |
cd crates/tanoshi-tauri
cargo tauri build
if: matrix.arch != 'aarch64' || matrix.include_arm64
- name: Move files (linux/macOS)
if: ${{ (matrix.os != 'windows-latest') && (matrix.arch != 'aarch64' || matrix.include_arm64) }}
if: ${{ matrix.type == 'linux' || matrix.type == 'macos' }}
run: |
mkdir -p builds
find target/ -type f \( -name "*.deb" -o -name "*.AppImage" -o -name "*.dmg" \) -print0 |
Expand All @@ -242,7 +226,7 @@ jobs:
mv target/*/tanoshi-app ${{ github.workspace }}/builds/
- name: Move files (windows)
if: ${{ matrix.os == 'windows-latest' }}
if: ${{ matrix.type == 'windows' }}
run: |
mkdir -p builds
mv target/*/bundle/msi/*.msi ${{ github.workspace }}/builds/
Expand All @@ -253,10 +237,9 @@ jobs:
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/') && (matrix.arch != 'aarch64' || matrix.include_arm64)
if: startsWith(github.ref, 'refs/tags/')
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -266,7 +249,7 @@ jobs:
overwrite: true

build-flatpak:
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
needs: build-tauri
container:
image: bilelmoussaoui/flatpak-github-actions:gnome-47
Expand All @@ -276,31 +259,18 @@ jobs:
include:
- arch: x86_64
name: amd64
os: ubuntu-24.04
- arch: aarch64
name: aarch64
include_arm64: ${{ startsWith(github.ref, 'refs/tags/') }}
os: ubuntu-24.04-arm
# Don't fail the whole workflow if one architecture fails
fail-fast: false
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false

# Docker is required by the docker/setup-qemu-action which enables emulation
- name: Install deps
if: ${{ matrix.arch != 'x86_64' }}
run: |
dnf -y install docker
- name: Set up QEMU
if: ${{ matrix.arch != 'x86_64' }}
id: qemu
uses: docker/setup-qemu-action@v2
with:
platforms: arm64

- name: Download files
if: matrix.arch != 'aarch64' || matrix.include_arm64
uses: actions/download-artifact@v4
with:
name: tanoshi-app-linux-${{ matrix.name }}
Expand All @@ -309,7 +279,6 @@ jobs:
# Only master contains the upload-artifact option. Waiting on
# https://github.com/flatpak/flatpak-github-actions/issues/203
- uses: flatpak/flatpak-github-actions/flatpak-builder@master
if: matrix.arch != 'aarch64' || matrix.include_arm64
with:
bundle: tanoshi.${{ matrix.arch }}.flatpak
manifest-path: org.luigi311.tanoshi.yml
Expand All @@ -318,7 +287,6 @@ jobs:
upload-artifact: false

- name: Upload dist
if: matrix.arch != 'aarch64' || matrix.include_arm64
uses: actions/upload-artifact@v4
with:
name: tanoshi.${{ matrix.arch }}.flatpak
Expand All @@ -335,29 +303,21 @@ jobs:
overwrite: true

build-tanoshi:
runs-on: ${{ matrix.runs_on }}
runs-on: ${{ matrix.os }}
needs:
- build-web
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
- os: ubuntu-24.04
arch: amd64
type: linux
runs_on: ubuntu-latest
- os: ubuntu-latest
- os: ubuntu-24.04-arm
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."

steps:
- uses: actions/checkout@v4
if: matrix.arch != 'aarch64' || matrix.include_arm64
with:
persist-credentials: false

Expand All @@ -366,42 +326,34 @@ jobs:
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
run: sudo apt update && sudo apt upgrade -y && sudo apt install -y $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
env:
RUSTFLAGS: "-Clink-arg=-Wl,--allow-multiple-definition"
run: cargo build -p tanoshi --release
if: matrix.arch != 'aarch64' || matrix.include_arm64

- name: Upload dist
uses: actions/upload-artifact@v4
with:
name: tanoshi-${{ matrix.arch }}
path: ${{ github.workspace }}/target/release/tanoshi
if: matrix.arch != 'aarch64' || matrix.include_arm64

docker:
runs-on: ubuntu-latest
Expand Down

0 comments on commit e92ad2b

Please sign in to comment.