deskflow/.github/workflows/ci.yml
Nick Bolton 865063b77c
Re-implement packaging for GitHub workflows (macOS) (#7353)
* Restore Azure macOS dist scripts

* Move steps to workflow for testing

* Always upload to GitHub

* Add codesign ID

* Echo codesign ID

* Add cert import code

* Stub file for Mac

* Self-install pyyaml and choco

* Auto add env var on Windows

* Auto add CMAKE_PREFIX_PATH to .zshrc

* Shorter var names

* Append env var instead of replace

* Only set env var if not CI

* Improve function names and print output

* Simplify Linux package command

* Support continuation sequence

* Add note about Windows

* Remove dead doc file

* Tidy up version file and move to .env format

* Use Python venv for deps

* Only use venv on Mac

* Rename package script for all OS

* Add package and dist steps, and use common upload

* Remove version source

* Fixed vars not available

* Fixed python paths

* Use RuntimeError which is sufficient

* Remove dead code

* Add extras command for Linux

* Always install deps on Linux

* Move Python deps to CI

* More env bootstrapping, ugh

* Forgot to return!

* Simplify code

* Use shell

* Simplify command

* Skip sudo if no sudo

* Update package managers

* Fixed Fedora package name

* Tidy up commands

* Use newer upload artifact

* Strip don't trim!

* Check for version file and reduce log verbosity

* Remove CentOS 7.6

* Print more info about return code and log more to stderr

* Install certificate on macOS

* Better errors for no env var

* Implement Mac signing and notary

* Move dmgbuild load

* Simplify notary

* Rename dist files to same as dest

* Fixed paths for dist

* Move checked-in dist files to res (dist is meant to be a temp dir)

* Fixed Mac path in CMake

* Fixed dmg path

* Format Python

* Ignore import warnings and move function

* Fixed cmake paths

* Add missing env var secrets

* Remove extensions from GH upload

* Make deps.yml general purpose config

* Add cspell config

* Pass codesign ID

* Use new general config file

* Sign bundle on Mac

* Move imports to functions

* Escape chars in docs

* Fixed config key accessor

* Change module import order

* Move file to tmp dir in workflow dir

* Persist temp dir

* Add tmp dir to ignore

* Flush stdio before running process

* Trying quotes around env values

* Add codesigning certificate validation for Mac signing

* Revert "Trying quotes around env values"

This reverts commit 0dd741e8cd.

* Extract codesign verify

* Fixed version number

* Ignore .cache dir

* Fix macro name

* Package name with version number and arch

* Improve package function readability

* Change order of vars

* Testing upload to GDrive

* Add missing return code

* Use positional args and declare error

* Use machine instead of arch and remove build from filename

* Remove redundant build jobs

* Replace massively over-complicated `build_version.py` script

* Move version info to env module

* Use version info script

* Fixed: too many values to unpack

* Chmod version script

* Use shebang

* Don't check return code on Linux

* Fixed function name

* Convert to GitHub specific script

* Env vars must be after configure

* Fixed Windows env var command

* Remove && from deps command so it's not conditional

* Fixed position of set env

* Change order of env script

* Only upload when not draft

* Test

* Tweak config

* Fixed if condition

* Don't package in draft (Windows and Linux)
2024-06-24 09:36:30 +00:00

234 lines
6.2 KiB
YAML

name: CI
on:
workflow_dispatch:
pull_request:
types:
- opened
- reopened
- synchronize
- ready_for_review
push:
branches:
- master*
- release*
env:
GIT_COMMIT: ${{ github.sha }}
jobs:
windows:
name: windows-2022
runs-on: windows-2022
timeout-minutes: 20
env:
QT_BASE_DIR: ${{ github.workspace }}\deps\Qt
QT_VERSION: 5.15.2
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: "recursive"
- name: Cache Qt
id: cache-qt
uses: actions/cache@v1
with:
path: ${{ env.QT_BASE_DIR }}
key: ${{ runner.os }}-Qt_${{ env.QT_VERSION }}
- name: Install Qt
if: steps.cache-qt.outputs.cache-hit != 'true'
run: python ./scripts/install_deps.py --only qt
- name: Install dependencies
run: python ./scripts/install_deps.py
- name: Setup VC++ environment
uses: ilammy/msvc-dev-cmd@v1
- name: Configure
env:
CMAKE_PREFIX_PATH: "${{ env.QT_BASE_DIR }}\\${{ env.QT_VERSION }}\\msvc2019_64\\"
run: cmake -B build --preset=windows-release
- name: Set env vars
run: python ./scripts/github_env.py
- name: Build
run: cmake --build build
- name: Test
run: ./build/bin/unittests
- name: Package
if: ${{ !github.event.pull_request.draft }}
run: python ./scripts/package.py
macos:
runs-on: ${{ matrix.runtime.os }}
timeout-minutes: ${{ matrix.runtime.timeout }}
name: ${{ matrix.runtime.name }}
defaults:
run:
shell: ${{ matrix.runtime.shell }}
strategy:
matrix:
runtime:
- name: "macos-10-intel"
timeout: 20
os: "macos-14-large"
arch: x64
target: "10.14"
shell: "bash"
- name: "macos-11-m1"
timeout: 10
os: "macos-14"
arch: arm64
target: "11"
shell: "/usr/bin/arch -arch arm64e /bin/bash --noprofile --norc -eo pipefail {0}"
steps:
- name: Setup PATH
run: |
case "$ARCH" in
"arm64")
echo "/opt/homebrew/bin" >> $GITHUB_PATH
;;
esac
env:
ARCH: ${{ matrix.runtime.arch }}
- name: Checkout
uses: actions/checkout@v4
with:
submodules: "recursive"
- name: Install dependencies
run: ./scripts/install_deps.py
- name: Configure
env:
CMAKE_OSX_DEPLOYMENT_TARGET: ${{ matrix.runtime.target }}
run: cmake -B build --preset=macos-release -DCMAKE_PREFIX_PATH=$(brew --prefix qt@5)
- name: Set env vars
run: ./scripts/github_env.py
- name: Build
run: cmake --build build
- name: Test
run: ./build/bin/unittests
- name: Package
if: ${{ !github.event.pull_request.draft }}
run: ./scripts/package.py
env:
APPLE_CODESIGN_ID: ${{ secrets.APPLE_CODESIGN_ID }}
APPLE_P12_CERTIFICATE: ${{ secrets.APPLE_P12_CERTIFICATE }}
APPLE_P12_PASSWORD: ${{ secrets.APPLE_P12_PASSWORD }}
APPLE_NOTARY_USER: ${{ secrets.APPLE_NOTARY_USER }}
APPLE_NOTARY_PASSWORD: ${{ secrets.APPLE_NOTARY_PASSWORD }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
- name: Upload to GitHub
if: ${{ github.event_name == 'pull_request' && !github.event.pull_request.draft }}
uses: ./.github/actions/dist-upload
with:
service: "github"
github-target-filename: "synergy-macos-${{ matrix.runtime.target }}"
- name: Upload to Google Drive
if: github.event_name != 'pull_request'
uses: ./.github/actions/dist-upload
with:
service: "gdrive"
gdrive-target-dir: "synergy1/v1-core-standard/${{ env.SYNERGY_VERSION }}"
gdrive-secret-key: ${{ secrets.GOOGLE_DRIVE_KEY }}
gdrive-parent-folder-id: ${{ secrets.GOOGLE_DRIVE_TECH_DRIVE }}
linux:
runs-on: ${{ matrix.distro.runs-on }}
timeout-minutes: 10
name: linux-${{ matrix.distro.name }}
container: ${{ matrix.distro.container }}
strategy:
matrix:
distro:
- name: centos-8
container: symless/synergy-core:centos8
runs-on: ubuntu-latest
legacy-cmake: true
- name: debian-11
container: symless/synergy-core:debian11
runs-on: ubuntu-latest
legacy-cmake: true
- name: debian-12
container: symless/synergy-core:debiansid
runs-on: ubuntu-latest
- name: fedora-37
container: symless/synergy-core:fedora37
runs-on: ubuntu-latest
legacy-cmake: true
- name: fedora-38
container: symless/synergy-core:fedora38
runs-on: ubuntu-latest
legacy-cmake: true
- name: ubuntu-20.04
container: symless/synergy-core:ubuntu20.04
runs-on: ubuntu-latest
legacy-cmake: true
- name: ubuntu-22.04
container: symless/synergy-core:ubuntu22.04
runs-on: ubuntu-latest
- name: ubuntu-24.04
runs-on: ubuntu-24.04
steps:
# Use @v3 since some older Linux distro versions don't support @v4
- name: Checkout
uses: actions/checkout@v3
with:
submodules: "recursive"
- name: Install dependencies
run: |
${{ matrix.distro.python-deps }}
./scripts/install_deps.py
- name: Configure (modern)
if: ${{ !matrix.distro.legacy-cmake }}
run: cmake -B build --preset=linux-release
# Some older Linux distro versions don't support modern CMake presets.
- name: Configure (legacy)
if: ${{ matrix.distro.legacy-cmake }}
run: cmake -B build -DCMAKE_BUILD_TYPE=Release
- name: Set env vars
run: ./scripts/github_env.py
- name: Build
run: cmake --build build
- name: Test
run: ./build/bin/unittests
- name: Package
if: ${{ !github.event.pull_request.draft }}
run: ./scripts/package.py