Simplify compile options and use comprehensive edition logic (#7365)

* Simplify options

* Use more sensible edition logic

* Use set instead of option for string

* Improve macro for product name

* Add tests launch config

* Restore unregistered state

* Reorganize cases for title and improve function name

* Code coverage on by default

* Fixed copyright

* Improve code coverage and test readability

* Separate build-all and build-coverage

* Back out coverage on by default

* Fixed bad var in cmake

* More verbose logging for coverage

* Restore tasks

* Restore preLaunchTask

* Use default comparitor

* Move temp files to temp dir

* Add tasks for tests

* Support for wstring

* Upgrade sonar-scanner to 6 on Debian 12

* Use modern pip install

* Install python for sonarcloud

* Use Ubuntu and install deps

* Fixed sonar-scanner URL

* Fix exported dir

* Persist build dir

* Don't use venv for pip install gcovr

* Fixed another path

* Update actions/checkout to v4 for SonarCloud analysis workflow

* Add coverage task

* Improve coverage for SerialKeyEdition.cpp

* Enable licensing for builds

* Fixed invalid macro names, missing arguments, etc

* Fixed more copyright

* Fixed incorrect use of "enterprise"

* Fixed incorrect use of "business"

* Experiment with environment

* Make package prefix variable

* Add environment matrix to all OS

* Improve job names

* Make job names easier to read

* Roll back environment matrix (too much noise)

* Fixed: default should override required

* Refactor CI with vars

* Fixed arg for env.get_env
This commit is contained in:
Nick Bolton
2024-07-04 10:14:54 +01:00
committed by GitHub
parent 37bb0f989e
commit 4690b61551
46 changed files with 533 additions and 487 deletions

View File

@ -23,6 +23,9 @@ on:
env:
SYNERGY_VERSION: ${{ github.event.inputs.version || github.event.release.tag_name }}
SYNERGY_PRODUCT_NAME: ${{ vars.SYNERGY_PRODUCT_NAME }}
SYNERGY_PACKAGE_PREFIX: ${{ vars.SYNERGY_PACKAGE_PREFIX }}
SYNERGY_ENABLE_LICENSING: ${{ vars.SYNERGY_ENABLE_LICENSING }}
PACKAGE_BUILD: ${{ !github.event.pull_request.draft }}
PACKAGE_UPLOAD: ${{ !github.event.pull_request.draft && github.event_name != 'schedule' }}
UPLOAD_TO_GITHUB: ${{ github.event_name == 'pull_request' && !github.event.pull_request.draft }}
@ -30,13 +33,20 @@ env:
jobs:
windows:
name: windows-2022
runs-on: windows-2022
name: ${{ matrix.target.name }}
runs-on: ${{ matrix.target.runs-on }}
timeout-minutes: 20
env:
QT_BASE_DIR: ${{ github.workspace }}\deps\Qt
strategy:
matrix:
target:
- name: windows-2022
runs-on: windows-2022
arch: x64
steps:
- name: Checkout
uses: actions/checkout@v4
@ -75,48 +85,48 @@ jobs:
run: ./build/bin/unittests
- name: Package
if: ${{ env.PACKAGE_BUILD == 'true' }}
if: ${{ vars.SYNERGY_ENABLE_PACKAGING && env.PACKAGE_BUILD == 'true' }}
run: python ./scripts/package.py
env:
WINDOWS_PFX_CERTIFICATE: ${{ secrets.WINDOWS_PFX }}
WINDOWS_PFX_PASSWORD: ${{ secrets.WINDOWS_PFX_PASS }}
- name: Upload
if: ${{ env.PACKAGE_UPLOAD == 'true' }}
if: ${{ vars.SYNERGY_ENABLE_PACKAGING && env.PACKAGE_UPLOAD == 'true' }}
uses: ./.github/actions/dist-upload
with:
use_github: ${{ env.UPLOAD_TO_GITHUB }}
use_gdrive: ${{ env.UPLOAD_TO_GDRIVE }}
github-target-filename: "synergy-windows-x64"
gdrive-target-base-dir: "synergy1/personal"
github-target-filename: "${{ env.SYNERGY_PACKAGE_PREFIX }}-windows-${{ matrix.target.name }}"
gdrive-target-base-dir: ${{ vars.GDRIVE_TARGET_BASE_DIR }}
gdrive-secret-key: ${{ secrets.GOOGLE_DRIVE_KEY }}
gdrive-parent-folder-id: ${{ secrets.GOOGLE_DRIVE_TECH_DRIVE }}
package-version: ${{ env.SYNERGY_VERSION }}
macos:
runs-on: ${{ matrix.runtime.os }}
timeout-minutes: ${{ matrix.runtime.timeout }}
name: ${{ matrix.runtime.name }}
name: ${{ matrix.target.name }}
runs-on: ${{ matrix.target.os }}
timeout-minutes: ${{ matrix.target.timeout }}
defaults:
run:
shell: ${{ matrix.runtime.shell }}
shell: ${{ matrix.target.shell }}
strategy:
matrix:
runtime:
target:
- name: "macos-11-arm64"
timeout: 10
os: "macos-14"
arch: arm64
target: "11"
version: "11"
shell: "/usr/bin/arch -arch arm64e /bin/bash --noprofile --norc -eo pipefail {0}"
- name: "macos-10-intel"
timeout: 20
os: "macos-14-large"
arch: x64
target: "10.14"
version: "10.14"
shell: "bash"
steps:
@ -130,7 +140,7 @@ jobs:
- name: Configure
env:
CMAKE_OSX_DEPLOYMENT_TARGET: ${{ matrix.runtime.target }}
CMAKE_OSX_DEPLOYMENT_TARGET: ${{ matrix.target.version }}
run: cmake -B build --preset=macos-release -DCMAKE_PREFIX_PATH=$(brew --prefix qt@5)
- name: Build
@ -140,7 +150,7 @@ jobs:
run: ./build/bin/unittests
- name: Package
if: ${{ env.PACKAGE_BUILD == 'true' }}
if: ${{ vars.SYNERGY_ENABLE_PACKAGING && env.PACKAGE_BUILD == 'true' }}
run: ./scripts/package.py
env:
APPLE_CODESIGN_ID: ${{ secrets.APPLE_CODESIGN_ID }}
@ -151,21 +161,21 @@ jobs:
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
- name: Upload
if: ${{ env.PACKAGE_UPLOAD == 'true' }}
if: ${{ vars.SYNERGY_ENABLE_PACKAGING && env.PACKAGE_UPLOAD == 'true' }}
uses: ./.github/actions/dist-upload
with:
use_github: ${{ env.UPLOAD_TO_GITHUB }}
use_gdrive: ${{ env.UPLOAD_TO_GDRIVE }}
github-target-filename: "synergy-${{ matrix.runtime.name }}"
gdrive-target-base-dir: "synergy1/personal"
github-target-filename: "${{ env.SYNERGY_PACKAGE_PREFIX }}-${{ matrix.target.name }}"
gdrive-target-base-dir: ${{ vars.GDRIVE_TARGET_BASE_DIR }}
gdrive-secret-key: ${{ secrets.GOOGLE_DRIVE_KEY }}
gdrive-parent-folder-id: ${{ secrets.GOOGLE_DRIVE_TECH_DRIVE }}
package-version: ${{ env.SYNERGY_VERSION }}
linux:
name: linux-${{ matrix.distro.name }}
runs-on: ${{ matrix.distro.runs-on }}
timeout-minutes: 10
name: linux-${{ matrix.distro.name }}
container: ${{ matrix.distro.container }}
env:
@ -265,20 +275,20 @@ jobs:
run: ./build/bin/unittests
- name: Package
if: ${{ env.PACKAGE_BUILD == 'true' }}
if: ${{ vars.SYNERGY_ENABLE_PACKAGING && env.PACKAGE_BUILD == 'true' }}
env:
LINUX_EXTRA_PACKAGES: ${{ matrix.distro.extra-packages }}
LINUX_PACKAGE_USER: ${{ matrix.distro.package-user }}
run: ./scripts/package.py
- name: Upload
if: ${{ env.PACKAGE_UPLOAD == 'true' }}
if: ${{ vars.SYNERGY_ENABLE_PACKAGING && env.PACKAGE_UPLOAD == 'true' }}
uses: ./.github/actions/dist-upload
with:
use_github: ${{ env.UPLOAD_TO_GITHUB }}
use_gdrive: ${{ env.UPLOAD_TO_GDRIVE }}
github-target-filename: "synergy-${{ matrix.distro.name }}"
gdrive-target-base-dir: "synergy1/personal"
github-target-filename: "${{ env.SYNERGY_PACKAGE_PREFIX }}-${{ matrix.distro.name }}"
gdrive-target-base-dir: ${{ vars.GDRIVE_TARGET_BASE_DIR }}
gdrive-secret-key: ${{ secrets.GOOGLE_DRIVE_KEY }}
gdrive-parent-folder-id: ${{ secrets.GOOGLE_DRIVE_TECH_DRIVE }}
package-version: ${{ env.SYNERGY_VERSION }}

View File

@ -12,33 +12,35 @@ concurrency:
jobs:
sonarcloud-analysis:
if: ${{ vars.SONAR_SCANNER_ENABLED }}
runs-on: ubuntu-latest
container: symless/synergy-core:debian10
timeout-minutes: 20
env:
SONAR_SCANNER_VERSION: 5.0.1.3006
SONAR_SCANNER_VERSION: 6.1.0.4477
SONAR_SCANNER_OPTS: -server
SONAR_SCANNER_URL_BASE: https://binaries.sonarsource.com/Distribution/sonar-scanner-cli
steps:
- name: Checkout git repo
uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Installing gcovr
run: |
apt-get update
apt-get install -y python python-pip
pip install gcovr
- name: Install dependencies
run: ./scripts/install_deps.py
- name: Installing Sonar Scanner
- name: Install gcovr
run: pip install gcovr
- name: Install SonarScanner
run: |
export SONAR_SCANNER_HOME=$HOME/.sonar/sonar-scanner-$SONAR_SCANNER_VERSION-linux
curl --create-dirs -sSLo $HOME/.sonar/sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-$SONAR_SCANNER_VERSION-linux.zip
export SONAR_SCANNER_HOME=$HOME/.sonar/sonar-scanner-$SONAR_SCANNER_VERSION-linux-x64
curl --create-dirs -sSLo $HOME/.sonar/sonar-scanner.zip \
$SONAR_SCANNER_URL_BASE/sonar-scanner-cli-$SONAR_SCANNER_VERSION-linux-x64.zip
unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/
- name: Installing build-wrapper
- name: Install build-wrapper
run: |
curl --create-dirs -sSLo $HOME/.sonar/build-wrapper-linux-x86.zip https://sonarcloud.io/static/cpp/build-wrapper-linux-x86.zip
unzip -o $HOME/.sonar/build-wrapper-linux-x86.zip -d $HOME/.sonar/
@ -46,19 +48,19 @@ jobs:
- name: Build
run: |
export PATH=$HOME/.sonar/build-wrapper-linux-x86:$PATH
mkdir build
mkdir -p build
cd build
cmake -DCMAKE_BUILD_TYPE=Debug -DENABLE_COVERAGE=ON ..
build-wrapper-linux-x86-64 --out-dir bw-output make -j
- name: Running coverage
- name: Make coverage
run: |
cd build
make coverage
- name: Run Sonar Scanner
- name: Run SonarScanner
run: |
export PATH=$HOME/.sonar/sonar-scanner-${SONAR_SCANNER_VERSION}-linux/bin:$PATH
export PATH=$HOME/.sonar/sonar-scanner-$SONAR_SCANNER_VERSION-linux-x64/bin:$PATH
cd build
sonar-scanner \
-Dsonar.organization=symless \