slint/.github/workflows/slint_tool_binary.yaml

182 lines
7.4 KiB
YAML

# Copyright © SixtyFPS GmbH <info@slint-ui.com>
# SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial
name: Build slint-viewer or -lsp binary
on:
workflow_dispatch:
inputs:
program:
type: choice
description: binary to build
options:
- slint-viewer
- slint-lsp
workflow_call:
inputs:
program:
type: string
description: binary to build
jobs:
build_windows:
runs-on: windows-2019
steps:
- uses: actions/checkout@v2
- name: Install latest stable Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: x86_64-pc-windows-msvc
- name: Install Qt
uses: jurplel/install-qt-action@v2
with:
version: 6.2.1
- uses: Swatinem/rust-cache@v1
with:
key: x
- uses: actions-rs/install@v0.1
with:
crate: cargo-about
- name: Build
uses: actions-rs/cargo@v1
with:
command: build
args: --verbose --no-default-features --features backend-qt --release -p ${{ github.event.inputs.program || inputs.program }}
- name: Create artifact directory
run: |
mkdir pkg
cd pkg
mkdir ${{ github.event.inputs.program || inputs.program }}
cd ${{ github.event.inputs.program || inputs.program }}
cp ..\..\target/release/${{ github.event.inputs.program || inputs.program }}.exe ./
cp ..\..\..\Qt\6.2.1\msvc2019_64\bin/Qt6Core.dll ./
cp ..\..\..\Qt\6.2.1\msvc2019_64\bin/Qt6Gui.dll ./
cp ..\..\..\Qt\6.2.1\msvc2019_64\bin/Qt6Widgets.dll ./
cp ..\..\..\Qt\6.2.1\msvc2019_64\bin/Qt6Svg.dll ./
mkdir .\plugins\platforms
cp ..\..\..\Qt\6.2.1\msvc2019_64\plugins\platforms\qwindows.dll ./plugins/platforms
mkdir .\plugins\styles
cp ..\..\..\Qt\6.2.1\msvc2019_64\plugins\styles\qwindowsvistastyle.dll ./plugins/styles
mkdir .\plugins\imageformats
cp ..\..\..\Qt\6.2.1\msvc2019_64\plugins\imageformats\qsvg.dll ./plugins/imageformats
cd ..
cd ..
bash -x ./scripts/prepare_binary_package.sh pkg\${{ github.event.inputs.program || inputs.program }} --with-qt
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: ${{ github.event.inputs.program || inputs.program }}-windows
path: |
pkg
build_linux:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Install latest stable Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: x86_64-unknown-linux-gnu
- name: Cache Qt
id: cache-qt
uses: actions/cache@v2
with:
path: ~/work/slint/Qt
key: ${{ runner.os }}-${{ github.job }}-qt
- name: Install Qt
uses: jurplel/install-qt-action@v2
with:
version: 5.15.2
cached: ${{ steps.cache-qt.outputs.cache-hit }}
- uses: Swatinem/rust-cache@v1
with:
key: x
- uses: actions-rs/install@v0.1
with:
crate: cargo-about
- name: Build
uses: actions-rs/cargo@v1
with:
command: build
args: --verbose --no-default-features --features backend-qt --release -p ${{ github.event.inputs.program || inputs.program }}
- name: Create artifact directory
run: |
mkdir -p ${{ github.event.inputs.program || inputs.program }}
cp target/release/${{ github.event.inputs.program || inputs.program }} ${{ github.event.inputs.program || inputs.program }}/
./scripts/prepare_binary_package.sh ${{ github.event.inputs.program || inputs.program }}
- name: Tar artifacts to preserve permissions
run: tar czvf ${{ github.event.inputs.program || inputs.program }}-linux.tar.gz ${{ github.event.inputs.program || inputs.program }}
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: ${{ github.event.inputs.program || inputs.program }}-linux
path: ${{ github.event.inputs.program || inputs.program }}-linux.tar.gz
build_macos:
runs-on: macOS-11
steps:
- uses: actions/checkout@v2
- name: Install latest stable Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: x86_64-apple-darwin
- name: Install latest stable Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: aarch64-apple-darwin
- name: Cache Qt
id: cache-qt
uses: actions/cache@v2
with:
path: ~/work/slint/Qt
key: ${{ runner.os }}-${{ github.job }}-Qt
- name: Install Qt
uses: jurplel/install-qt-action@v2
with:
version: 6.2.1 # for Apple Silicon support
cached: ${{ steps.cache-qt.outputs.cache-hit }}
setup-python: false
- uses: Swatinem/rust-cache@v1
with:
key: x
- uses: actions-rs/install@v0.1
with:
crate: cargo-about
- name: Build x86_64
uses: actions-rs/cargo@v1
with:
command: build
args: --verbose --target x86_64-apple-darwin --no-default-features --features backend-qt --release -p ${{ github.event.inputs.program || inputs.program }}
- name: Build aarch64
uses: actions-rs/cargo@v1
with:
command: build
args: --verbose --target aarch64-apple-darwin --no-default-features --features backend-qt --release -p ${{ github.event.inputs.program || inputs.program }}
- name: Create artifact directory
run: |
mkdir -p ${{ github.event.inputs.program || inputs.program }}
cd ${{ github.event.inputs.program || inputs.program }}
lipo -create -output ./${{ github.event.inputs.program || inputs.program }} ../target/x86_64-apple-darwin/release/${{ github.event.inputs.program || inputs.program }} ../target/aarch64-apple-darwin/release/${{ github.event.inputs.program || inputs.program }}
install_name_tool -add_rpath @executable_path/. ./${{ github.event.inputs.program || inputs.program }}
cp -a ~/work/slint/Qt/6.2.1/macos/lib/QtCore.framework ./
cp -a ~/work/slint/Qt/6.2.1/macos/lib/QtGui.framework ./
cp -a ~/work/slint/Qt/6.2.1/macos/lib/QtWidgets.framework ./
cp -a ~/work/slint/Qt/6.2.1/macos/lib/QtDBus.framework ./
cp -a ~/work/slint/Qt/6.2.1/macos/lib/QtSvg.framework ./
mkdir -p ./plugins/platforms ./plugins/imageformats
cp -a ~/work/slint/Qt/6.2.1/macos/plugins/platforms/libqcocoa.dylib ./plugins/platforms
cp -a ~/work/slint/Qt/6.2.1/macos/plugins/imageformats/libqsvg.dylib ./plugins/imageformats
cd ..
./scripts/prepare_binary_package.sh ${{ github.event.inputs.program || inputs.program }} --with-qt
- name: Tar artifacts to preserve permissions
run: tar czvf ${{ github.event.inputs.program || inputs.program }}-macos.tar.gz ${{ github.event.inputs.program || inputs.program }}
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: ${{ github.event.inputs.program || inputs.program }}-macos
path: ${{ github.event.inputs.program || inputs.program }}-macos.tar.gz