Skip to content

fix: arg helpers, fix safemode #933

fix: arg helpers, fix safemode

fix: arg helpers, fix safemode #933

Workflow file for this run

name: Build
on:
workflow_dispatch:
push:
paths:
- '.github/workflows/build.yml'
- 'package.json'
- 'src-tauri/**/*'
- 'src/**/*'
- 'updater/**/*'
branches:
- main
pull_request:
paths:
- '.github/workflows/build.yml'
- 'package.json'
- 'src-tauri/**/*'
- 'src/**/*'
- 'updater/**/*'
concurrency:
group: ${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true
env:
CARGO_INCREMENTAL: 0
GIT_HASH: ${{ github.sha }}
jobs:
build:
runs-on: ${{ matrix.config.platform }}
strategy:
fail-fast: false
matrix:
config:
- platform: ubuntu-22.04
target: 'x86_64-unknown-linux-gnu'
- platform: ubuntu-22.04
target: 'aarch64-unknown-linux-gnu'
- platform: ubuntu-22.04
target: 'armv7-unknown-linux-gnueabihf'
- platform: macos-latest
target: 'x86_64-apple-darwin'
- platform: macos-latest
target: 'aarch64-apple-darwin'
- platform: windows-latest
target: 'x86_64-pc-windows-msvc'
- platform: windows-latest
target: 'aarch64-pc-windows-msvc'
steps:
- uses: actions-rust-lang/[email protected]
- uses: pnpm/action-setup@v3
with:
version: latest
- name: Checkout
uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: latest
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
src-tauri/target/${{ matrix.config.target }}/release/incremental
src-tauri/target/${{ matrix.config.target }}/release/deps
src-tauri/target/${{ matrix.config.target }}/release/build
src-tauri/target/${{ matrix.config.target }}/release/.fingerprint
updater/target/
key: ${{ runner.os }}-${{ matrix.config.target }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: (Linux) ARM sources.list
if: matrix.config.target == 'aarch64-unknown-linux-gnu' || matrix.config.target == 'armv7-unknown-linux-gnueabihf'
run: |
# Add [arch=amd64] to the initial entries of the sources.list
sudo sed -i 's/^deb /deb [arch=amd64] /' /etc/apt/sources.list
echo "deb [arch=armhf,arm64] http://ports.ubuntu.com/ubuntu-ports/ $(lsb_release -cs) main restricted" | sudo tee -a /etc/apt/sources.list
echo "deb [arch=armhf,arm64] http://ports.ubuntu.com/ubuntu-ports/ $(lsb_release -cs)-updates main restricted" | sudo tee -a /etc/apt/sources.list
echo "deb [arch=armhf,arm64] http://ports.ubuntu.com/ubuntu-ports/ $(lsb_release -cs) universe" | sudo tee -a /etc/apt/sources.list
echo "deb [arch=armhf,arm64] http://ports.ubuntu.com/ubuntu-ports/ $(lsb_release -cs)-updates universe" | sudo tee -a /etc/apt/sources.list
echo "deb [arch=armhf,arm64] http://ports.ubuntu.com/ubuntu-ports/ $(lsb_release -cs) multiverse" | sudo tee -a /etc/apt/sources.list
echo "deb [arch=armhf,arm64] http://ports.ubuntu.com/ubuntu-ports/ $(lsb_release -cs)-updates multiverse" | sudo tee -a /etc/apt/sources.list
echo "deb [arch=armhf,arm64] http://ports.ubuntu.com/ubuntu-ports/ $(lsb_release -cs)-backports main restricted universe multiverse" | sudo tee -a /etc/apt/sources.list
echo "deb [arch=armhf,arm64] http://ports.ubuntu.com/ubuntu-ports/ $(lsb_release -cs)-security main restricted" | sudo tee -a /etc/apt/sources.list
echo "deb [arch=armhf,arm64] http://ports.ubuntu.com/ubuntu-ports/ $(lsb_release -cs)-security universe" | sudo tee -a /etc/apt/sources.list
echo "deb [arch=armhf,arm64] http://ports.ubuntu.com/ubuntu-ports/ $(lsb_release -cs)-security multiverse" | sudo tee -a /etc/apt/sources.list
# ARM-linux related sources and dpkg config and such
- name: (Linux) ARM setup
if: matrix.config.target == 'aarch64-unknown-linux-gnu' || matrix.config.target == 'armv7-unknown-linux-gnueabihf'
run: |
sudo dpkg --add-architecture arm64
sudo dpkg --add-architecture armhf
sudo apt-get update
- name: (Linux) Install dependencies
if: matrix.config.platform == 'ubuntu-22.04'
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev \
build-essential \
curl \
wget \
libssl-dev \
libgtk-3-dev \
libayatana-appindicator3-dev \
librsvg2-dev
- name: (Linux) (ARMv7) Install dependencies
if: matrix.config.target == 'armv7-unknown-linux-gnueabihf'
run: |
sudo apt-get install -y \
libc6:armhf \
libc6-dev:armhf \
libapparmor1:armhf \
libwebkit2gtk-4.1-dev:armhf \
libssl-dev:armhf \
gcc-arm-linux-gnueabihf \
g++-arm-linux-gnueabihf
- name: (Linux) (ARM64) Install dependencies
if: matrix.config.target == 'aarch64-unknown-linux-gnu'
run: |
sudo apt-get install -y \
libc6:arm64 \
libc6-dev:arm64 \
libapparmor1:arm64 \
libwebkit2gtk-4.1-dev:arm64 \
libssl-dev:arm64 \
gcc-aarch64-linux-gnu \
g++-aarch64-linux-gnu
- name: Add target
run: rustup target add ${{ matrix.config.target }}
- name: (Non-Linux) Build updater
if: matrix.config.platform != 'ubuntu-22.04'
run: pnpm build:updater
env:
RUSTFLAGS: -Awarnings
- name: (Linux x86_64) Build Webkit extension
if: matrix.config.target == 'x86_64-unknown-linux-gnu'
run: cd src-tauri/extension_webkit && cmake . && cmake --build .
- name: (Linux ARMv7) Build Webkit extension
if: matrix.config.target == 'armv7-unknown-linux-gnueabihf'
run: cd src-tauri/extension_webkit && cmake -DCMAKE_TOOLCHAIN_FILE=toolchain-armv7.cmake . && cmake --build .
env:
CC: arm-linux-gnueabihf-gcc
CXX: arm-linux-gnueabihf-g++
PKG_CONFIG_PATH: /usr/lib/arm-linux-gnueabihf/pkgconfig
- name: (Linux ARM64) Build Webkit extension
if: matrix.config.target == 'aarch64-unknown-linux-gnu'
run: cd src-tauri/extension_webkit && cmake -DCMAKE_TOOLCHAIN_FILE=toolchain-arm64.cmake . && cmake --build .
env:
CC: aarch64-linux-gnu-gcc
CXX: aarch64-linux-gnu-g++
PKG_CONFIG_PATH: /usr/lib/aarch64-linux-gnu/pkgconfig
- name: Install dependencies
run: pnpm install && pnpm shupdate
- name: Install patch-crate
run: cargo install patch-crate
continue-on-error: true
- name: Apply patches
run: cd src-tauri && cargo patch-crate
- name: Build
if: matrix.config.platform != 'ubuntu-22.04'
# If we are compiling for Windows ARM, we can only support NSIS
# However, I cannot phase out the MSI or a buncha package managers will explode
run: pnpm tauri build --target ${{ matrix.config.target }} ${{ matrix.config.target == 'aarch64-pc-windows-msvc' && '--bundles nsis' || '' }}
env:
RUSTFLAGS: -Awarnings
- name: (Linux) (x86_64) Build
if: matrix.config.target == 'x86_64-unknown-linux-gnu'
run: pnpm tauri build -c src-tauri/tauri.linux.conf.json --target ${{ matrix.config.target }} --bundles deb -- --config target.x86_64-unknown-linux-gnu.linker=\'x86_64-linux-gnu-gcc\'
env:
RUSTFLAGS: -Awarnings
- name: (Linux) (ARMv7) Build
if: matrix.config.target == 'armv7-unknown-linux-gnueabihf'
run: pnpm tauri build -c src-tauri/tauri.linux.conf.json --target ${{ matrix.config.target }} --bundles deb -- --config target.armv7-unknown-linux-gnueabihf.linker=\'arm-linux-gnueabihf-gcc\'
env:
RUSTFLAGS: -Awarnings -L/usr/lib/arm-linux-gnueabihf
CC: arm-linux-gnueabihf-gcc
PKG_CONFIG_SYSROOT_DIR: /usr/lib/arm-linux-gnueabihf
PKG_CONFIG_PATH: /usr/lib/arm-linux-gnueabihf/pkgconfig
- name: (Linux) (ARM64) Build
if: matrix.config.target == 'aarch64-unknown-linux-gnu'
run: pnpm tauri build -c src-tauri/tauri.linux.conf.json --target ${{ matrix.config.target }} --bundles deb -- --config target.aarch64-unknown-linux-gnu.linker=\'aarch64-linux-gnu-gcc\'
env:
RUSTFLAGS: -Awarnings -L/usr/lib/aarch64-linux-gnu
CC: aarch64-linux-gnu-gcc
PKG_CONFIG_SYSROOT_DIR: /usr/lib/aarch64-linux-gnu
PKG_CONFIG_PATH: /usr/lib/aarch64-linux-gnu/pkgconfig
# Make empty folders for plugins and themes
- name: (Windows) Create empty folders for plugins
if: matrix.config.platform == 'windows-latest'
continue-on-error: true
run: mkdir src-tauri/target/${{ matrix.config.target }}/release/themes && mkdir src-tauri/target/${{ matrix.config.target }}/release/plugins
# Empty folders, unix edition
- name: (Unix) Create empty folders for plugins and themes
if: matrix.config.platform != 'windows-latest'
run: mkdir -p src-tauri/target/${{ matrix.config.target }}/release/plugins && mkdir -p src-tauri/target/${{ matrix.config.target }}/release/themes
- name: Create .portable file for portable builds
run: cd src-tauri/target/${{ matrix.config.target }}/release && touch .portable
# paths:
# Windows:
# - src-tauri/target/${{ matrix.config.target }}/release/Dorion.exe|plugins|themes|injection|icons
# Ubuntu:
# - src-tauri/target/${{ matrix.config.target }}/release/dorion|plugins|themes|injection|icons
# MacOS:
# - src-tauri/target/${{ matrix.config.target }}/release/bundle/macos/Dorion.app
- name: (Windows) Compress build
if: matrix.config.platform == 'windows-latest'
run: cd src-tauri/target/${{ matrix.config.target }}/release && 7z a -tzip -mx9 Dorion.zip
Dorion.exe
updater.exe
.portable
plugins/
themes/
icons/
injection/
extension/
- name: (Linux) Compress build
if: matrix.config.platform == 'ubuntu-22.04'
run: cd src-tauri/target/${{ matrix.config.target }}/release && tar -czvf dorion.tar.gz Dorion .portable ./plugins ./themes ./injection ./icons ./extension_webkit
# Windows portable
- name: (Windows) Upload portable
if: matrix.config.platform == 'windows-latest'
uses: actions/upload-artifact@v4
with:
name: dorion-${{ matrix.config.target }}-portable
path: src-tauri/target/${{ matrix.config.target }}/release/Dorion.zip
# Windows MSI
- name: (Windows) Upload .msi
if: matrix.config.platform == 'windows-latest'
uses: actions/upload-artifact@v4
with:
name: dorion-${{ matrix.config.target }}-msi
path: src-tauri/target/${{ matrix.config.target }}/release/bundle/msi/*.msi
# Windows ARM only supports NSIS right now, but we should upload that too
- name: (Windows) Upload NSIS
if: matrix.config.platform == 'windows-latest'
uses: actions/upload-artifact@v4
with:
name: dorion-${{ matrix.config.target }}-nsis
path: src-tauri/target/${{ matrix.config.target }}/release/bundle/nsis/*.exe
# Ubuntu portable
- name: (Linux) Upload portable
if: matrix.config.platform == 'ubuntu-22.04'
uses: actions/upload-artifact@v4
with:
name: dorion-${{ matrix.config.target }}-portable
path: src-tauri/target/${{ matrix.config.target }}/release/dorion.tar.gz
# Ubuntu deb
- name: (Linux) Upload .deb
if: matrix.config.platform == 'ubuntu-22.04'
uses: actions/upload-artifact@v4
with:
name: dorion-${{ matrix.config.target }}-deb
path: src-tauri/target/${{ matrix.config.target }}/release/bundle/deb/*.deb
- name: (Linux) Upload .appimage
if: matrix.config.platform == 'ubuntu-22.04'
uses: actions/upload-artifact@v4
with:
name: dorion-${{ matrix.config.target }}-appimage
path: src-tauri/target/${{ matrix.config.target }}/release/bundle/appimage/*.AppImage
- name: (MacOS) Upload .dmg
if: matrix.config.platform == 'macos-latest'
uses: actions/upload-artifact@v4
with:
name: dorion-${{ matrix.config.target }}-dmg
path: src-tauri/target/${{ matrix.config.target }}/release/bundle/dmg/*.dmg