Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
133 changes: 133 additions & 0 deletions .github/workflows/linux-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
name: "Linux Build"

on:
pull_request:
branches: [master]
paths:
- ".github/workflows/linux-build.yml"
- ".github/workflows/release.yml"
- "Cargo.lock"
- "Cargo.toml"
- "crates/**"
- "src-tauri/**"
- "package.json"
- "bun.lock"
- "scripts/release/package-linux-tarball.sh"
workflow_dispatch:
inputs:
runner:
description: "Linux runner to build on"
required: true
default: "ubuntu-22.04"
type: choice
options:
- "ubuntu-22.04"
- "ubuntu-22.04-arm"

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-${{ inputs.runner || 'ubuntu-22.04' }}
cancel-in-progress: true

jobs:
build:
if: github.repository == 'athasdev/athas'
name: Build Linux tarball
runs-on: ${{ inputs.runner || 'ubuntu-22.04' }}
timeout-minutes: 120
env:
CARGO_TERM_COLOR: always
CEF_PATH: ${{ github.workspace }}/.cache/tauri-cef
NO_STRIP: "true"
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0

- name: Free disk space
run: |
echo "Disk usage before cleanup:"
df -h
sudo rm -rf /usr/share/dotnet /opt/ghc /usr/local/lib/android /opt/hostedtoolcache/CodeQL || true
sudo docker system prune -af || true
sudo apt-get clean
echo "Disk usage after cleanup:"
df -h

- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest

- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable

- name: Setup Zig
uses: mlugg/setup-zig@v2
with:
version: 0.16.0

- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true

- name: Cache CEF binaries
uses: actions/cache@v4
with:
path: .cache/tauri-cef
key: ${{ runner.os }}-${{ runner.arch }}-cef-v146.4.1

- name: Cache Bun dependencies
uses: actions/cache@v4
with:
path: ~/.bun/install/cache
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lock') }}
restore-keys: |
${{ runner.os }}-bun-

- name: Install Linux dependencies
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev libappindicator3-dev librsvg2-dev patchelf xdg-utils file

- name: Install Tauri CEF CLI
run: cargo install tauri-cli --git https://github.com/tauri-apps/tauri --branch feat/cef --locked

- name: Install frontend dependencies
run: bun install --ignore-scripts && bun scripts/postinstall.ts

- name: Check Linux feature graph
run: |
set -euo pipefail
cargo tree -p athas --no-default-features --features linux -i tauri-runtime-cef
cargo tree -p athas --no-default-features --features linux -i tauri-runtime-wry >/tmp/tauri-runtime-wry.txt 2>&1 || true
if grep -q '^tauri-runtime-wry ' /tmp/tauri-runtime-wry.txt; then
echo "tauri-runtime-wry must not be present in the Linux build"
cat /tmp/tauri-runtime-wry.txt
exit 1
fi
cargo tree -p athas --no-default-features --features linux -i webkit2gtk >/tmp/webkit2gtk.txt 2>&1 || true
if grep -q '^webkit2gtk ' /tmp/webkit2gtk.txt; then
echo "webkit2gtk must not be present in the Linux build"
cat /tmp/webkit2gtk.txt
exit 1
fi

- name: Build Linux app
run: |
cargo tauri build \
--no-bundle \
--config '{"bundle":{"createUpdaterArtifacts":false}}' \
-- \
--no-default-features \
--features linux

- name: Package Linux tarball
run: bash scripts/release/package-linux-tarball.sh "${{ runner.arch }}" release-dist

- name: Upload Linux tarball
uses: actions/upload-artifact@v4
with:
name: linux-${{ runner.arch }}
path: release-dist/*.tar.gz
if-no-files-found: error
2 changes: 1 addition & 1 deletion .github/workflows/release-preflight.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
bun -e '
const config = JSON.parse(await Bun.file("src-tauri/tauri.conf.json").text());
const targets = config.bundle?.targets ?? [];
const expected = ["app", "appimage", "deb", "dmg", "nsis", "rpm"];
const expected = ["app", "dmg", "nsis"];
if (JSON.stringify(targets) !== JSON.stringify(expected)) {
throw new Error(`Unexpected bundle targets: ${JSON.stringify(targets)}`);
}
Expand Down
87 changes: 45 additions & 42 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ jobs:
artifact: "macos-aarch64"
os: "macos"
args: "--target aarch64-apple-darwin"
cargo_features: ""
target: "aarch64-apple-darwin"
bundle_path: "target/aarch64-apple-darwin/release/bundle"
timeout_minutes: 60
Expand All @@ -95,6 +96,7 @@ jobs:
artifact: "macos-x86_64"
os: "macos"
args: "--target x86_64-apple-darwin"
cargo_features: ""
target: "x86_64-apple-darwin"
bundle_path: "target/x86_64-apple-darwin/release/bundle"
timeout_minutes: 60
Expand All @@ -103,22 +105,25 @@ jobs:
artifact: "linux-x86_64"
os: "linux"
args: ""
cargo_features: "--no-default-features --features linux"
target: ""
bundle_path: "target/release/bundle"
timeout_minutes: 60
timeout_minutes: 120
rustflags: ""
- platform: "ubuntu-22.04-arm"
artifact: "linux-aarch64"
os: "linux"
args: ""
cargo_features: "--no-default-features --features linux"
target: ""
bundle_path: "target/release/bundle"
timeout_minutes: 60
timeout_minutes: 120
rustflags: ""
- platform: "windows-latest"
artifact: "windows-x86_64"
os: "windows"
args: "--bundles nsis"
cargo_features: ""
target: ""
bundle_path: "target/release/bundle"
timeout_minutes: 90
Expand All @@ -127,6 +132,7 @@ jobs:
artifact: "windows-aarch64"
os: "windows"
args: "--target aarch64-pc-windows-msvc --bundles nsis"
cargo_features: ""
target: "aarch64-pc-windows-msvc"
bundle_path: "target/aarch64-pc-windows-msvc/release/bundle"
timeout_minutes: 90
Expand Down Expand Up @@ -174,6 +180,13 @@ jobs:
with:
cache-on-failure: true

- name: Cache CEF binaries (Linux only)
if: matrix.os == 'linux'
uses: actions/cache@v4
with:
path: .cache/tauri-cef
key: ${{ runner.os }}-${{ runner.arch }}-cef-v146.4.1

- name: Cache Bun dependencies
uses: actions/cache@v4
with:
Expand All @@ -186,7 +199,11 @@ jobs:
if: matrix.os == 'linux'
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.0-dev libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf xdg-utils file
sudo apt-get install -y libgtk-3-dev libappindicator3-dev librsvg2-dev patchelf xdg-utils file

- name: Install Tauri CEF CLI (Linux only)
if: matrix.os == 'linux'
run: cargo install tauri-cli --git https://github.com/tauri-apps/tauri --branch feat/cef --locked

- name: Install frontend dependencies
run: bun install --ignore-scripts && bun scripts/postinstall.ts
Expand Down Expand Up @@ -311,10 +328,34 @@ jobs:
APPLE_ID: ${{ matrix.os == 'macos' && secrets.APPLE_ID || '' }}
APPLE_PASSWORD: ${{ matrix.os == 'macos' && secrets.APPLE_PASSWORD || '' }}
APPLE_TEAM_ID: ${{ matrix.os == 'macos' && secrets.APPLE_TEAM_ID || '' }}
CEF_PATH: ${{ matrix.os == 'linux' && format('{0}/.cache/tauri-cef', github.workspace) || '' }}
NO_STRIP: ${{ matrix.os == 'linux' && 'true' || '' }}
RUSTFLAGS: ${{ matrix.rustflags }}
run: |
bun tauri build ${{ matrix.args }} ${{ needs.release-metadata.outputs.is_prerelease == 'true' && '--config src-tauri/tauri.preview.conf.json' || '' }}
if [[ "${{ matrix.os }}" == "linux" ]]; then
cargo tauri build --no-bundle ${{ needs.release-metadata.outputs.is_prerelease == 'true' && '--config src-tauri/tauri.preview.conf.json' || '' }} -- ${{ matrix.cargo_features }}
else
bun tauri build ${{ matrix.args }} ${{ needs.release-metadata.outputs.is_prerelease == 'true' && '--config src-tauri/tauri.preview.conf.json' || '' }}
fi

- name: Package Linux tarball (Linux only)
if: matrix.os == 'linux'
env:
ATHAS_RELEASE_CHANNEL: ${{ needs.release-metadata.outputs.is_prerelease == 'true' && 'preview' || 'stable' }}
CEF_PATH: ${{ github.workspace }}/.cache/tauri-cef
run: bash scripts/release/package-linux-tarball.sh "${{ runner.arch }}" release-dist

- name: Sign Linux tarball (Linux only)
if: matrix.os == 'linux'
env:
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
run: |
set -euo pipefail
for archive in release-dist/*.tar.gz; do
bun tauri signer sign "$archive"
test -s "${archive}.sig"
done

- name: Collect Windows user installer (Windows only)
if: matrix.os == 'windows'
Expand All @@ -334,51 +375,13 @@ jobs:
throw "Could not find updater signature for $($setup.Name)."
}

- name: Build Windows machine installer (Windows only)
if: matrix.os == 'windows'
shell: pwsh
env:
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
run: |
$configArgs = @()
if ("${{ needs.release-metadata.outputs.is_prerelease }}" -eq "true") {
$configArgs += @("--config", "src-tauri/tauri.preview.conf.json")
}
$configArgs += @(
"--config",
'{"bundle":{"createUpdaterArtifacts":true,"windows":{"nsis":{"installMode":"perMachine"}}}}'
)

bun tauri bundle ${{ matrix.args }} --bundles nsis @configArgs

$setup = Get-ChildItem -Recurse -Path "${{ matrix.bundle_path }}" -File -Filter "*-setup.exe" |
Sort-Object LastWriteTime -Descending |
Select-Object -First 1
if (-not $setup) {
throw "Could not find machine installer."
}

$dest = Join-Path "release-dist" ($setup.Name -replace '-setup\.exe$', '-setup-machine.exe')
$destSig = "$dest.sig"
Copy-Item $setup.FullName $dest
if (Test-Path "$($setup.FullName).sig") {
Copy-Item "$($setup.FullName).sig" $destSig
Remove-Item "$($setup.FullName).sig" -Force
} else {
throw "Could not find updater signature for $($setup.Name)."
}

- name: Upload platform artifacts
uses: actions/upload-artifact@v4
with:
name: release-${{ matrix.artifact }}
path: |
${{ matrix.bundle_path }}/**/*.dmg
${{ matrix.bundle_path }}/**/*.app.tar.gz
${{ matrix.bundle_path }}/**/*.AppImage
${{ matrix.bundle_path }}/**/*.deb
${{ matrix.bundle_path }}/**/*.rpm
${{ matrix.bundle_path }}/**/*.sig
release-dist/*
if-no-files-found: error
Expand Down
Loading
Loading