Combine GitHub workflows to reduce config duplication (#7352)
* First attempt merging CI test * Remove older versions of Linux * Blend Docker containers and GitHub runners * Test older configure/build method for Windows * Re-add old Windows workflow * Use legacy CMake method for more distros * Rename image to container * Reduce config dupe * Fixed logic for configure * Use newer build command for Windows * Move full container name back to matrix (yuk) * Move GIT_COMMIT to common env * Use more specific Windows runner name * Fine-grained timeouts for Mac * Fixed unit test path for Windows * Rename CI workflow * Beginning of macOS dist action * Update ChangeLog * More triggers for CI workflow * Attempt to fix test path on Windows * Move dist-macos action * Add dir command for testing * Remove `test-` job prefix * Bump msbuild action and try modern cmake again * Composite actions don't support defaults... grr * Remove dir diag command * Trying to use Choco again for VS dep * Don't skip ninja * Flush stdout * Add cl to PATH * Trying out ilammy/msvc-dev-cmd@v1 * Use @v3 checkout for older Linux * Fixed comment typo * Remove dead scripts * Improve env var names * Run strip from build dir * Split out deps script to lib files * Remove stub action * Remove dist step for now
This commit is contained in:
parent
d0a4c3d7a0
commit
8f13ce8e7a
19 changed files with 359 additions and 635 deletions
195
.github/workflows/ci.yml
vendored
Normal file
195
.github/workflows/ci.yml
vendored
Normal file
|
|
@ -0,0 +1,195 @@
|
||||||
|
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-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: |
|
||||||
|
pip install pyyaml
|
||||||
|
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: Build
|
||||||
|
run: cmake --build build
|
||||||
|
|
||||||
|
- name: Test
|
||||||
|
run: ./build/bin/unittests
|
||||||
|
|
||||||
|
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: |
|
||||||
|
pip install pyyaml
|
||||||
|
python ./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: Build
|
||||||
|
run: cmake --build build
|
||||||
|
|
||||||
|
- name: Test
|
||||||
|
run: ./build/bin/unittests
|
||||||
|
|
||||||
|
linux:
|
||||||
|
runs-on: ${{ matrix.distro.runs-on }}
|
||||||
|
timeout-minutes: 10
|
||||||
|
name: linux-${{ matrix.distro.name }}
|
||||||
|
container: ${{ matrix.distro.container }}
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
distro:
|
||||||
|
- name: centos-7.6
|
||||||
|
container: symless/synergy-core:centos7.6
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
legacy-cmake: true
|
||||||
|
|
||||||
|
- 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
|
||||||
|
install-deps: true
|
||||||
|
|
||||||
|
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
|
||||||
|
if: ${{ matrix.distro.install-deps }}
|
||||||
|
run: python ./scripts/install_deps.py
|
||||||
|
|
||||||
|
- name: Configure
|
||||||
|
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: Build
|
||||||
|
run: cmake --build build
|
||||||
|
|
||||||
|
- name: Test
|
||||||
|
run: ./build/bin/unittests
|
||||||
44
.github/workflows/job-test-linux-centos.yml
vendored
44
.github/workflows/job-test-linux-centos.yml
vendored
|
|
@ -1,44 +0,0 @@
|
||||||
name: Test CentOS
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [master]
|
|
||||||
pull_request:
|
|
||||||
branches: [master]
|
|
||||||
|
|
||||||
concurrency:
|
|
||||||
group: "${{ github.workflow }}-${{ github.ref || github.run_id }}"
|
|
||||||
cancel-in-progress: true
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
test-linux-centos:
|
|
||||||
name: ${{ matrix.distro }}
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
container: symless/synergy-core:${{ matrix.distro }}
|
|
||||||
timeout-minutes: 10
|
|
||||||
|
|
||||||
env:
|
|
||||||
GIT_COMMIT: ${{ github.sha }}
|
|
||||||
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
distro:
|
|
||||||
- centos7.6
|
|
||||||
- centos8
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout git repo
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
with:
|
|
||||||
submodules: "recursive"
|
|
||||||
|
|
||||||
- name: Build
|
|
||||||
run: |
|
|
||||||
mkdir build
|
|
||||||
cd build
|
|
||||||
cmake3 -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=$(pwd)/rpm/BUILDROOT/usr ..
|
|
||||||
. ./version
|
|
||||||
make -j
|
|
||||||
|
|
||||||
- name: Run unit test
|
|
||||||
run: ./build/bin/unittests
|
|
||||||
45
.github/workflows/job-test-linux-debian.yml
vendored
45
.github/workflows/job-test-linux-debian.yml
vendored
|
|
@ -1,45 +0,0 @@
|
||||||
name: Test Debian
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [master]
|
|
||||||
pull_request:
|
|
||||||
branches: [master]
|
|
||||||
|
|
||||||
concurrency:
|
|
||||||
group: "${{ github.workflow }}-${{ github.ref || github.run_id }}"
|
|
||||||
cancel-in-progress: true
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
test-linux-debian:
|
|
||||||
name: ${{ matrix.distro }}
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
container: symless/synergy-core:${{ matrix.distro }}
|
|
||||||
timeout-minutes: 10
|
|
||||||
|
|
||||||
env:
|
|
||||||
GIT_COMMIT: ${{ github.sha }}
|
|
||||||
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
distro:
|
|
||||||
- debian9
|
|
||||||
- debian10
|
|
||||||
- debian11
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout git repo
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
with:
|
|
||||||
submodules: "recursive"
|
|
||||||
|
|
||||||
- name: Build
|
|
||||||
run: |
|
|
||||||
mkdir build
|
|
||||||
cd build
|
|
||||||
cmake -DCMAKE_BUILD_TYPE=Release ..
|
|
||||||
. ./version
|
|
||||||
make -j
|
|
||||||
|
|
||||||
- name: Run unit test
|
|
||||||
run: ./build/bin/unittests
|
|
||||||
52
.github/workflows/job-test-linux-fedora.yml
vendored
52
.github/workflows/job-test-linux-fedora.yml
vendored
|
|
@ -1,52 +0,0 @@
|
||||||
name: Test Fedora
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [master]
|
|
||||||
pull_request:
|
|
||||||
branches: [master]
|
|
||||||
|
|
||||||
concurrency:
|
|
||||||
group: "${{ github.workflow }}-${{ github.ref || github.run_id }}"
|
|
||||||
cancel-in-progress: true
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
test-linux-fedora:
|
|
||||||
name: ${{ matrix.distro }}
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
container: symless/synergy-core:${{ matrix.distro }}
|
|
||||||
timeout-minutes: 10
|
|
||||||
|
|
||||||
env:
|
|
||||||
GIT_COMMIT: ${{ github.sha }}
|
|
||||||
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
distro:
|
|
||||||
- fedora33
|
|
||||||
- fedora34
|
|
||||||
- fedora35
|
|
||||||
- fedora36
|
|
||||||
- fedora37
|
|
||||||
- fedora38
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout git repo
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
with:
|
|
||||||
submodules: "recursive"
|
|
||||||
|
|
||||||
- name: Work around https://github.com/actions/checkout/issues/766
|
|
||||||
run: |
|
|
||||||
git config --global --add safe.directory "$GITHUB_WORKSPACE"
|
|
||||||
|
|
||||||
- name: Build
|
|
||||||
run: |
|
|
||||||
mkdir build
|
|
||||||
cd build
|
|
||||||
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=$(pwd)/rpm/BUILDROOT/usr ..
|
|
||||||
. ./version
|
|
||||||
make -j
|
|
||||||
|
|
||||||
- name: Run unit test
|
|
||||||
run: ./build/bin/unittests
|
|
||||||
50
.github/workflows/job-test-linux-ubuntu.yml
vendored
50
.github/workflows/job-test-linux-ubuntu.yml
vendored
|
|
@ -1,50 +0,0 @@
|
||||||
name: Test Ubuntu
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [master]
|
|
||||||
pull_request:
|
|
||||||
branches: [master]
|
|
||||||
|
|
||||||
concurrency:
|
|
||||||
group: "${{ github.workflow }}-${{ github.ref || github.run_id }}"
|
|
||||||
cancel-in-progress: true
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
test-linux-ubuntu:
|
|
||||||
name: ubuntu${{ matrix.distro }}
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
container: symless/synergy-core:ubuntu${{ matrix.distro }}
|
|
||||||
timeout-minutes: 10
|
|
||||||
|
|
||||||
env:
|
|
||||||
GIT_COMMIT: ${{ github.sha }}
|
|
||||||
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
distro:
|
|
||||||
- "22.04"
|
|
||||||
- "20.04"
|
|
||||||
flag:
|
|
||||||
- "-j"
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout git repo
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
with:
|
|
||||||
submodules: "recursive"
|
|
||||||
|
|
||||||
- name: Work around https://github.com/actions/checkout/issues/766
|
|
||||||
run: |
|
|
||||||
git config --global --add safe.directory "$GITHUB_WORKSPACE"
|
|
||||||
|
|
||||||
- name: Build
|
|
||||||
run: |
|
|
||||||
mkdir build
|
|
||||||
cd build
|
|
||||||
cmake -DCMAKE_BUILD_TYPE=Release ..
|
|
||||||
. ./version
|
|
||||||
make ${{ matrix.flag }}
|
|
||||||
|
|
||||||
- name: Run unit test
|
|
||||||
run: ./build/bin/unittests
|
|
||||||
71
.github/workflows/job-test-mac.yml
vendored
71
.github/workflows/job-test-mac.yml
vendored
|
|
@ -1,71 +0,0 @@
|
||||||
name: "Test macOS"
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [master]
|
|
||||||
pull_request:
|
|
||||||
branches: [master]
|
|
||||||
|
|
||||||
concurrency:
|
|
||||||
group: "${{ github.workflow }}-${{ github.ref || github.run_id }}"
|
|
||||||
cancel-in-progress: true
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
test-macos:
|
|
||||||
runs-on: ${{ matrix.runtime.os }}
|
|
||||||
timeout-minutes: 20
|
|
||||||
|
|
||||||
defaults:
|
|
||||||
run:
|
|
||||||
shell: ${{ matrix.runtime.shell }}
|
|
||||||
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
runtime:
|
|
||||||
- name: "macos-10-intel"
|
|
||||||
os: "macos-14-large"
|
|
||||||
arch: x64
|
|
||||||
target: "10.14"
|
|
||||||
shell: "bash"
|
|
||||||
- name: "macos-11-m1"
|
|
||||||
os: "macos-14"
|
|
||||||
arch: arm64
|
|
||||||
target: "11"
|
|
||||||
shell: "/usr/bin/arch -arch arm64e /bin/bash --noprofile --norc -eo pipefail {0}"
|
|
||||||
|
|
||||||
name: ${{ matrix.runtime.name }}
|
|
||||||
|
|
||||||
env:
|
|
||||||
GIT_COMMIT: ${{ github.sha }}
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Setup PATH
|
|
||||||
run: |
|
|
||||||
case "$ARCH" in
|
|
||||||
"arm64")
|
|
||||||
echo "/opt/homebrew/bin" >> $GITHUB_PATH
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
env:
|
|
||||||
ARCH: ${{ matrix.runtime.arch }}
|
|
||||||
|
|
||||||
- name: Checkout git repo
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
with:
|
|
||||||
submodules: "recursive"
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
run: |
|
|
||||||
pip install pyyaml
|
|
||||||
python ./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: Build
|
|
||||||
run: cmake --build build
|
|
||||||
|
|
||||||
- name: Run unit test
|
|
||||||
run: ./build/bin/unittests
|
|
||||||
75
.github/workflows/job-test-windows.yml
vendored
75
.github/workflows/job-test-windows.yml
vendored
|
|
@ -1,75 +0,0 @@
|
||||||
name: "Test Windows"
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [master]
|
|
||||||
pull_request:
|
|
||||||
branches: [master]
|
|
||||||
|
|
||||||
concurrency:
|
|
||||||
group: "${{ github.workflow }}-${{ github.ref || github.run_id }}"
|
|
||||||
cancel-in-progress: true
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
test-windows:
|
|
||||||
runs-on: windows-latest
|
|
||||||
timeout-minutes: 20
|
|
||||||
|
|
||||||
env:
|
|
||||||
GIT_COMMIT: ${{ github.sha }}
|
|
||||||
BONJOUR_BASE_DIR: ${{ github.workspace }}\deps\bonjour
|
|
||||||
QT_BASE_DIR: ${{ github.workspace }}\deps\Qt
|
|
||||||
QT_VERSION: 5.15.2
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout git repo
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
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: Cache Bonjour
|
|
||||||
id: cache-bonjour
|
|
||||||
uses: actions/cache@v1
|
|
||||||
with:
|
|
||||||
path: ${{ env.BONJOUR_BASE_DIR }}
|
|
||||||
key: ${{ runner.os }}-Bonjour
|
|
||||||
|
|
||||||
- name: Install Bonjour SDK
|
|
||||||
if: steps.cache-bonjour.outputs.cache-hit != 'true'
|
|
||||||
run: |
|
|
||||||
New-Item -Force -ItemType Directory -Path "$env:BONJOUR_BASE_DIR"
|
|
||||||
$client = new-object System.Net.WebClient
|
|
||||||
$client.DownloadFile("https://binaries.symless.com/bonjour/BonjourSDK.zip",".\bonjoursdk.zip")
|
|
||||||
[System.IO.Compression.ZipFile]::ExtractToDirectory(".\bonjoursdk.zip", "$env:BONJOUR_BASE_DIR")
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
run: |
|
|
||||||
pip install pyyaml
|
|
||||||
python ./scripts/install_deps.py
|
|
||||||
|
|
||||||
- name: Add msbuild to PATH
|
|
||||||
uses: microsoft/setup-msbuild@v1.0.2
|
|
||||||
|
|
||||||
- name: Build
|
|
||||||
env:
|
|
||||||
CMAKE_PREFIX_PATH: "${{ env.QT_BASE_DIR }}\\${{ env.QT_VERSION }}\\msvc2019_64\\"
|
|
||||||
run: |
|
|
||||||
mkdir build
|
|
||||||
cd build
|
|
||||||
cmake -DCMAKE_BUILD_TYPE=Release ..
|
|
||||||
. ./version
|
|
||||||
msbuild synergy-core.sln /p:Configuration=Release
|
|
||||||
|
|
||||||
- name: Run unit test
|
|
||||||
run: .\build\bin\Release\unittests.exe
|
|
||||||
|
|
@ -26,12 +26,12 @@ set(CMAKE_C_RESPONSE_FILE_LINK_FLAG "@")
|
||||||
set(CMAKE_CXX_RESPONSE_FILE_LINK_FLAG "@")
|
set(CMAKE_CXX_RESPONSE_FILE_LINK_FLAG "@")
|
||||||
set(CMAKE_NINJA_FORCE_RESPONSE_FILE 1 CACHE INTERNAL "")
|
set(CMAKE_NINJA_FORCE_RESPONSE_FILE 1 CACHE INTERNAL "")
|
||||||
|
|
||||||
if (DEFINED ENV{SYNERGY_NO_LEGACY})
|
if (DEFINED ENV{SYNERGY_BUILD_MINIMAL})
|
||||||
option (SYNERGY_BUILD_LEGACY_GUI "Build the legacy GUI" OFF)
|
option (SYNERGY_BUILD_GUI "Build the GUI" OFF)
|
||||||
option (SYNERGY_BUILD_LEGACY_INSTALLER "Build the legacy installer" OFF)
|
option (SYNERGY_BUILD_INSTALLER "Build the installer" OFF)
|
||||||
else()
|
else()
|
||||||
option (SYNERGY_BUILD_LEGACY_GUI "Build the legacy GUI" ON)
|
option (SYNERGY_BUILD_GUI "Build the GUI" ON)
|
||||||
option (SYNERGY_BUILD_LEGACY_INSTALLER "Build the legacy installer" ON)
|
option (SYNERGY_BUILD_INSTALLER "Build the installer" ON)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (DEFINED ENV{SYNERGY_NO_TESTS})
|
if (DEFINED ENV{SYNERGY_NO_TESTS})
|
||||||
|
|
@ -435,7 +435,7 @@ endmacro(generate_versionfile)
|
||||||
|
|
||||||
generate_versionfile()
|
generate_versionfile()
|
||||||
|
|
||||||
if (${SYNERGY_BUILD_LEGACY_INSTALLER})
|
if (${SYNERGY_BUILD_INSTALLER})
|
||||||
#
|
#
|
||||||
# macOS app Bundle
|
# macOS app Bundle
|
||||||
#
|
#
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
"name": "minimal",
|
"name": "minimal",
|
||||||
"hidden": true,
|
"hidden": true,
|
||||||
"environment": {
|
"environment": {
|
||||||
"SYNERGY_NO_LEGACY": "ON"
|
"SYNERGY_BUILD_MINIMAL": "ON"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,7 @@ Enhancements:
|
||||||
- #7335 Clickable debug source paths and new launch target
|
- #7335 Clickable debug source paths and new launch target
|
||||||
- #7336 Add C++ and LLDB to VS Code recommendations
|
- #7336 Add C++ and LLDB to VS Code recommendations
|
||||||
- #7351 Use deps script to make life easier for contribs
|
- #7351 Use deps script to make life easier for contribs
|
||||||
|
- #7352 Combine GitHub workflows to reduce config duplication
|
||||||
|
|
||||||
# 1.14.6
|
# 1.14.6
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,4 +8,7 @@
|
||||||
<!-- lock openssl to 3.1.1. as of 19th jan 2024, 3.2.0 breaks cmake configure. -->
|
<!-- lock openssl to 3.1.1. as of 19th jan 2024, 3.2.0 breaks cmake configure. -->
|
||||||
<package id="openssl" version="3.1.1" />
|
<package id="openssl" version="3.1.1" />
|
||||||
|
|
||||||
|
<package id="visualstudio2022buildtools"
|
||||||
|
packageParameters="--includeRecommended --add Microsoft.VisualStudio.Workload.MSBuildTools --add Microsoft.VisualStudio.Workload.VCTools " />
|
||||||
|
|
||||||
</packages>
|
</packages>
|
||||||
9
deps.yml
9
deps.yml
|
|
@ -5,6 +5,12 @@ dependencies:
|
||||||
version: 5.15.2
|
version: 5.15.2
|
||||||
mirror: https://qt.mirror.constant.com/
|
mirror: https://qt.mirror.constant.com/
|
||||||
install-dir: C:\Qt
|
install-dir: C:\Qt
|
||||||
|
ci:
|
||||||
|
skip:
|
||||||
|
edit-config: Chocolatey.config
|
||||||
|
packages:
|
||||||
|
- cmake
|
||||||
|
- visualstudio2022buildtools
|
||||||
|
|
||||||
mac:
|
mac:
|
||||||
command: brew bundle --file=Brewfile
|
command: brew bundle --file=Brewfile
|
||||||
|
|
@ -15,6 +21,7 @@ dependencies:
|
||||||
packages:
|
packages:
|
||||||
- cmake
|
- cmake
|
||||||
- make
|
- make
|
||||||
|
- g++
|
||||||
- xorg-dev
|
- xorg-dev
|
||||||
- libx11-dev
|
- libx11-dev
|
||||||
- libxtst-dev
|
- libxtst-dev
|
||||||
|
|
@ -38,11 +45,13 @@ dependencies:
|
||||||
- cmake
|
- cmake
|
||||||
- make
|
- make
|
||||||
- gcc-c++
|
- gcc-c++
|
||||||
|
- openssl-devel
|
||||||
- libXtst-devel
|
- libXtst-devel
|
||||||
- glib2-devel
|
- glib2-devel
|
||||||
- gdk-pixbuf2-devel
|
- gdk-pixbuf2-devel
|
||||||
- libnotify-devel
|
- libnotify-devel
|
||||||
- qt5-qtbase-devel
|
- qt5-qtbase-devel
|
||||||
|
- qt5-qttools-devel
|
||||||
- libxkbfile-devel
|
- libxkbfile-devel
|
||||||
- gtk3-devel
|
- gtk3-devel
|
||||||
- rpm-build
|
- rpm-build
|
||||||
|
|
|
||||||
|
|
@ -1,12 +0,0 @@
|
||||||
#! /bin/bash
|
|
||||||
|
|
||||||
export SYNERGY_NO_LEGACY=1
|
|
||||||
CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE:-Release}
|
|
||||||
mkdir -p build
|
|
||||||
pushd build
|
|
||||||
cmake -DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE ..
|
|
||||||
make synergyc synergys
|
|
||||||
zip synergy-core-linux-x64.zip bin/*
|
|
||||||
echo "::set-output name=location::build/synergy-core-linux-x64.zip"
|
|
||||||
echo "::set-output name=name::synergy-core-linux-x64.zip"
|
|
||||||
popd
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
||||||
#! /bin/zsh
|
|
||||||
|
|
||||||
export SYNERGY_NO_LEGACY=1
|
|
||||||
CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE:-Release}
|
|
||||||
mkdir -p build
|
|
||||||
pushd build
|
|
||||||
cmake -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl \
|
|
||||||
-DOPENSSL_LIBRARIES=/usr/local/opt/openssl/lib \
|
|
||||||
-DCMAKE_OSX_DEPLOYMENT_TARGET=10.13 \
|
|
||||||
-DCMAKE_OSX_ARCHITECTURES=x86_64 \
|
|
||||||
-DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE \
|
|
||||||
..
|
|
||||||
make synergyc synergys
|
|
||||||
zip synergy-core-macos-x64.zip bin/*
|
|
||||||
echo "::set-output name=location::build/synergy-core-macos-x64.zip"
|
|
||||||
echo "::set-output name=name::synergy-core-macos-x64.zip"
|
|
||||||
popd
|
|
||||||
|
|
@ -1,115 +0,0 @@
|
||||||
#
|
|
||||||
# Tests to see if command exists
|
|
||||||
#
|
|
||||||
Function Test-CommandExists {
|
|
||||||
Param ($command)
|
|
||||||
Try {
|
|
||||||
if (Get-Command $command) {
|
|
||||||
RETURN $true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Catch {
|
|
||||||
RETURN $false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# Check prerequisites
|
|
||||||
#
|
|
||||||
If (-not (Test-CommandExists "cmake" -ErrorAction SilentlyContinue)) {
|
|
||||||
Write-Error "Cmake not found. Aborting." -ErrorAction Stop
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# https://patrickwbarnes.com/articles/using-msbuild-with-powershell/
|
|
||||||
#
|
|
||||||
# Find vswhere (installed with recent Visual Studio versions).
|
|
||||||
#
|
|
||||||
If ($vsWhere = Get-Command "vswhere.exe" -ErrorAction SilentlyContinue) {
|
|
||||||
$vsWhere = $vsWhere.Path
|
|
||||||
}
|
|
||||||
ElseIf (Test-Path "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe") {
|
|
||||||
$vsWhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
|
|
||||||
}
|
|
||||||
Else {
|
|
||||||
Write-Error "vswhere not found. Aborting." -ErrorAction Stop
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# Get path to Visual Studio installation using vswhere.
|
|
||||||
#
|
|
||||||
$vsPath = &$vsWhere `
|
|
||||||
-latest `
|
|
||||||
-products * `
|
|
||||||
-version "[16.0,17.0)" `
|
|
||||||
-requires Microsoft.Component.MSBuild `
|
|
||||||
-property installationPath
|
|
||||||
If ([string]::IsNullOrEmpty("$vsPath")) {
|
|
||||||
Write-Error "Failed to find Visual Studio 2019 installation. Aborting." -ErrorAction Stop
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# Make sure the Visual Studio Command Prompt variables are set.
|
|
||||||
#
|
|
||||||
If (-not (Test-Path env:LIBPATH)) {
|
|
||||||
# Load VC vars
|
|
||||||
Push-Location "${vsPath}\VC\Auxiliary\Build"
|
|
||||||
Try {
|
|
||||||
cmd /c "vcvarsall.bat x64&set" |
|
|
||||||
ForEach-Object {
|
|
||||||
If ($_ -match "=") {
|
|
||||||
$v = $_.split("=")
|
|
||||||
Set-Item -Force -Path "ENV:\$($v[0])" -Value "$($v[1])"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Finally {
|
|
||||||
Pop-Location
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# Set undefined environment variables
|
|
||||||
#
|
|
||||||
$env:SYNERGY_NO_LEGACY = 1
|
|
||||||
If (-not (Test-Path env:SYNERGY_BUILD_TYPE)) {
|
|
||||||
$env:SYNERGY_BUILD_TYPE = "Release"
|
|
||||||
}
|
|
||||||
If (-not (Test-Path env:SYNERGY_BUILD_DIRECTORY)) {
|
|
||||||
$env:SYNERGY_BUILD_DIRECTORY = '.\build'
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# Create build folder and make builds
|
|
||||||
#
|
|
||||||
New-Item `
|
|
||||||
-Path . `
|
|
||||||
-Name $env:SYNERGY_BUILD_DIRECTORY `
|
|
||||||
-ItemType "directory" `
|
|
||||||
-ErrorAction SilentlyContinue | Out-Null
|
|
||||||
Push-Location $env:SYNERGY_BUILD_DIRECTORY
|
|
||||||
Try {
|
|
||||||
cmake `
|
|
||||||
-DCMAKE_BUILD_TYPE=$env:SYNERGY_BUILD_TYPE `
|
|
||||||
..
|
|
||||||
. ./version
|
|
||||||
msbuild synergy-core.sln `
|
|
||||||
/p:Configuration=$env:SYNERGY_BUILD_TYPE `
|
|
||||||
/p:Platform="x64" `
|
|
||||||
/m
|
|
||||||
|
|
||||||
Remove-Item -Force -Path "synergy-core-win-x64.zip" -ErrorAction SilentlyContinue
|
|
||||||
Compress-Archive `
|
|
||||||
-Path ".\bin\${env:SYNERGY_BUILD_TYPE}\*" `
|
|
||||||
-DestinationPath "synergy-core-win-x64.zip"
|
|
||||||
Write-Output "::set-output name=location::build\synergy-core-win-x64.zip"
|
|
||||||
Write-Output "::set-output name=name::synergy-core-win-x64.zip"
|
|
||||||
}
|
|
||||||
Finally {
|
|
||||||
Pop-Location
|
|
||||||
}
|
|
||||||
159
scripts/install_deps.py
Normal file → Executable file
159
scripts/install_deps.py
Normal file → Executable file
|
|
@ -1,6 +1,7 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
import os
|
import os
|
||||||
from lib import windows
|
from lib import windows, cmd_utils
|
||||||
import subprocess
|
|
||||||
import sys
|
import sys
|
||||||
import argparse
|
import argparse
|
||||||
import traceback
|
import traceback
|
||||||
|
|
@ -8,10 +9,6 @@ import traceback
|
||||||
config_file = "deps.yml"
|
config_file = "deps.yml"
|
||||||
|
|
||||||
|
|
||||||
class EnvError(Exception):
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
class YamlError(Exception):
|
class YamlError(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
@ -55,22 +52,6 @@ def main():
|
||||||
input("Press enter to continue...")
|
input("Press enter to continue...")
|
||||||
|
|
||||||
|
|
||||||
def run(command, check=True):
|
|
||||||
"""Runs a shell command and by default asserts that the return code is 0."""
|
|
||||||
|
|
||||||
command_str = command
|
|
||||||
if isinstance(command, list):
|
|
||||||
command_str = " ".join(command)
|
|
||||||
|
|
||||||
print(f"Running: {command_str}")
|
|
||||||
|
|
||||||
try:
|
|
||||||
subprocess.run(command, shell=True, check=check)
|
|
||||||
except subprocess.CalledProcessError as e:
|
|
||||||
print(f"Command failed: {command_str}", file=sys.stderr)
|
|
||||||
raise e
|
|
||||||
|
|
||||||
|
|
||||||
def get_os():
|
def get_os():
|
||||||
"""Detects the operating system."""
|
"""Detects the operating system."""
|
||||||
if sys.platform == "win32":
|
if sys.platform == "win32":
|
||||||
|
|
@ -178,7 +159,7 @@ class Dependencies:
|
||||||
|
|
||||||
# for ci, skip qt; we install qt separately so we can cache it.
|
# for ci, skip qt; we install qt separately so we can cache it.
|
||||||
if not ci_env or only_qt:
|
if not ci_env or only_qt:
|
||||||
qt = WindowsQt(self.config.get_qt_config())
|
qt = windows.WindowsQt(self.config.get_qt_config(), config_file)
|
||||||
qt_install_dir = qt.get_install_dir()
|
qt_install_dir = qt.get_install_dir()
|
||||||
if qt_install_dir:
|
if qt_install_dir:
|
||||||
print(f"Skipping Qt, already installed at: {qt_install_dir}")
|
print(f"Skipping Qt, already installed at: {qt_install_dir}")
|
||||||
|
|
@ -188,16 +169,19 @@ class Dependencies:
|
||||||
if only_qt:
|
if only_qt:
|
||||||
return
|
return
|
||||||
|
|
||||||
# use winget instead of choco to install the vc++ deps, since in choco there is no way
|
choco = windows.WindowsChoco()
|
||||||
# to load a choco config file but skip a specific package (i.e. to skip vc++ for ci)
|
|
||||||
if not ci_env:
|
|
||||||
winget = WindowsWinGet()
|
|
||||||
winget.install_visual_studio()
|
|
||||||
|
|
||||||
choco = WindowsChoco()
|
|
||||||
if ci_env:
|
if ci_env:
|
||||||
choco.config_ci_cache()
|
choco.config_ci_cache()
|
||||||
|
|
||||||
|
try:
|
||||||
|
ci_skip = self.config.os["ci"]["skip"]
|
||||||
|
choco_config_file = ci_skip["edit-config"]
|
||||||
|
remove_packages = ci_skip["packages"]
|
||||||
|
except KeyError:
|
||||||
|
raise YamlError(f"Bad mapping in {config_file} on Windows for: ci")
|
||||||
|
|
||||||
|
choco.remove_from_config(choco_config_file, remove_packages)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
command = self.config.os["command"]
|
command = self.config.os["command"]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
|
|
@ -212,7 +196,7 @@ class Dependencies:
|
||||||
except KeyError:
|
except KeyError:
|
||||||
raise YamlError(f"Nothing found in {config_file} on Mac for: command")
|
raise YamlError(f"Nothing found in {config_file} on Mac for: command")
|
||||||
|
|
||||||
run(command)
|
cmd_utils.run(command)
|
||||||
|
|
||||||
def linux(self):
|
def linux(self):
|
||||||
"""Installs dependencies on Linux."""
|
"""Installs dependencies on Linux."""
|
||||||
|
|
@ -222,115 +206,8 @@ class Dependencies:
|
||||||
raise PlatformError("Unable to detect Linux distro")
|
raise PlatformError("Unable to detect Linux distro")
|
||||||
|
|
||||||
command = self.config.get_linux_package_command(distro)
|
command = self.config.get_linux_package_command(distro)
|
||||||
run(command)
|
cmd_utils.run(command)
|
||||||
|
|
||||||
|
|
||||||
class WindowsWinGet:
|
if __name__ == "__main__":
|
||||||
"""WinGet for Windows."""
|
main()
|
||||||
|
|
||||||
def install_visual_studio(self):
|
|
||||||
"""Installs packages using WinGet."""
|
|
||||||
|
|
||||||
override = [
|
|
||||||
"--quiet",
|
|
||||||
"--wait",
|
|
||||||
"--includeRecommended",
|
|
||||||
"--add Microsoft.VisualStudio.Workload.MSBuildTools",
|
|
||||||
"--add Microsoft.VisualStudio.Workload.VCTools",
|
|
||||||
]
|
|
||||||
|
|
||||||
args = [
|
|
||||||
"winget",
|
|
||||||
"install",
|
|
||||||
"--silent",
|
|
||||||
"--id",
|
|
||||||
"Microsoft.VisualStudio.2022.BuildTools",
|
|
||||||
"--override",
|
|
||||||
f'"{" ".join(override)}"',
|
|
||||||
]
|
|
||||||
|
|
||||||
run(
|
|
||||||
" ".join(args),
|
|
||||||
check=False,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class WindowsChoco:
|
|
||||||
"""Chocolatey for Windows."""
|
|
||||||
|
|
||||||
def install(self, command, ci_env):
|
|
||||||
"""Installs packages using Chocolatey."""
|
|
||||||
if ci_env:
|
|
||||||
# don't show noisy choco progress bars in ci env
|
|
||||||
run(f"{command} --no-progress")
|
|
||||||
else:
|
|
||||||
run(command)
|
|
||||||
|
|
||||||
def config_ci_cache(self):
|
|
||||||
"""Configures Chocolatey cache for CI."""
|
|
||||||
|
|
||||||
runner_temp_key = "RUNNER_TEMP"
|
|
||||||
runner_temp = os.environ.get(runner_temp_key)
|
|
||||||
if runner_temp:
|
|
||||||
# sets the choco cache dir, which should match the dir in the ci cache action.
|
|
||||||
key_arg = '--name="cacheLocation"'
|
|
||||||
value_arg = f'--value="{runner_temp}/choco"'
|
|
||||||
run(["choco", "config", "set", key_arg, value_arg])
|
|
||||||
else:
|
|
||||||
print(f"Warning: CI environment variable {runner_temp_key} not set")
|
|
||||||
|
|
||||||
|
|
||||||
class WindowsQt:
|
|
||||||
"""Qt for Windows."""
|
|
||||||
|
|
||||||
def __init__(self, config):
|
|
||||||
self.config = config
|
|
||||||
|
|
||||||
self.version = os.environ.get("QT_VERSION")
|
|
||||||
if not self.version:
|
|
||||||
try:
|
|
||||||
default_version = config["version"]
|
|
||||||
except KeyError:
|
|
||||||
raise EnvError(f"Qt version not set in {config_file}")
|
|
||||||
|
|
||||||
print(f"QT_VERSION not set, using: {default_version}")
|
|
||||||
self.version = default_version
|
|
||||||
|
|
||||||
self.base_dir = os.environ.get("QT_BASE_DIR")
|
|
||||||
if not self.base_dir:
|
|
||||||
try:
|
|
||||||
default_base_dir = config["install-dir"]
|
|
||||||
except KeyError:
|
|
||||||
raise EnvError(f"Qt install-dir not set in {config_file}")
|
|
||||||
|
|
||||||
print(f"QT_BASE_DIR not set, using: {default_base_dir}")
|
|
||||||
self.base_dir = default_base_dir
|
|
||||||
|
|
||||||
self.install_dir = f"{self.base_dir}\\{self.version}"
|
|
||||||
|
|
||||||
def get_install_dir(self):
|
|
||||||
if os.path.isdir(self.install_dir):
|
|
||||||
return self.install_dir
|
|
||||||
|
|
||||||
def install(self):
|
|
||||||
"""Installs Qt on Windows."""
|
|
||||||
|
|
||||||
run(["pip", "install", "aqtinstall"])
|
|
||||||
|
|
||||||
try:
|
|
||||||
mirror_url = self.config["mirror"]
|
|
||||||
except KeyError:
|
|
||||||
raise EnvError(f"Qt mirror not set in {config_file}")
|
|
||||||
|
|
||||||
args = ["python", "-m", "aqt", "install-qt"]
|
|
||||||
args.extend(["--outputdir", self.base_dir])
|
|
||||||
args.extend(["--base", mirror_url])
|
|
||||||
args.extend(["windows", "desktop", self.version, "win64_msvc2019_64"])
|
|
||||||
run(args)
|
|
||||||
|
|
||||||
install_dir = self.get_install_dir()
|
|
||||||
if not install_dir:
|
|
||||||
raise EnvError(f"Qt not installed, path not found: {install_dir}")
|
|
||||||
|
|
||||||
|
|
||||||
main()
|
|
||||||
|
|
|
||||||
19
scripts/lib/cmd_utils.py
Normal file
19
scripts/lib/cmd_utils.py
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
import subprocess
|
||||||
|
import sys
|
||||||
|
|
||||||
|
|
||||||
|
def run(command, check=True):
|
||||||
|
"""Runs a shell command and by default asserts that the return code is 0."""
|
||||||
|
|
||||||
|
command_str = command
|
||||||
|
if isinstance(command, list):
|
||||||
|
command_str = " ".join(command)
|
||||||
|
|
||||||
|
print(f"Running: {command_str}")
|
||||||
|
sys.stdout.flush()
|
||||||
|
|
||||||
|
try:
|
||||||
|
subprocess.run(command, shell=True, check=check)
|
||||||
|
except subprocess.CalledProcessError as e:
|
||||||
|
print(f"Command failed: {command_str}", file=sys.stderr)
|
||||||
|
raise e
|
||||||
|
|
@ -1,11 +1,20 @@
|
||||||
import ctypes
|
import ctypes
|
||||||
import sys
|
import sys
|
||||||
|
import os
|
||||||
|
import xml.etree.ElementTree as ET
|
||||||
|
from lib import cmd_utils
|
||||||
|
|
||||||
|
|
||||||
|
class EnvError(Exception):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
def relaunch_as_admin(script):
|
def relaunch_as_admin(script):
|
||||||
args = ' '.join(sys.argv[1:])
|
args = " ".join(sys.argv[1:])
|
||||||
command = f'{script} --pause-on-exit {args}'
|
command = f"{script} --pause-on-exit {args}"
|
||||||
print(f'Re-launching script as admin: {command}')
|
print(f"Re-launching script as admin: {command}")
|
||||||
ctypes.windll.shell32.ShellExecuteW(None, 'runas', sys.executable, command, None, 1)
|
ctypes.windll.shell32.ShellExecuteW(None, "runas", sys.executable, command, None, 1)
|
||||||
|
|
||||||
|
|
||||||
def is_admin():
|
def is_admin():
|
||||||
"""Returns True if the current process has admin privileges."""
|
"""Returns True if the current process has admin privileges."""
|
||||||
|
|
@ -13,3 +22,95 @@ def is_admin():
|
||||||
return ctypes.windll.shell32.IsUserAnAdmin()
|
return ctypes.windll.shell32.IsUserAnAdmin()
|
||||||
except ctypes.WinError:
|
except ctypes.WinError:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
class WindowsChoco:
|
||||||
|
"""Chocolatey for Windows."""
|
||||||
|
|
||||||
|
def install(self, command, ci_env):
|
||||||
|
"""Installs packages using Chocolatey."""
|
||||||
|
if ci_env:
|
||||||
|
# don't show noisy choco progress bars in ci env
|
||||||
|
cmd_utils.run(f"{command} --no-progress")
|
||||||
|
else:
|
||||||
|
cmd_utils.run(command)
|
||||||
|
|
||||||
|
def config_ci_cache(self):
|
||||||
|
"""Configures Chocolatey cache for CI."""
|
||||||
|
|
||||||
|
runner_temp_key = "RUNNER_TEMP"
|
||||||
|
runner_temp = os.environ.get(runner_temp_key)
|
||||||
|
if runner_temp:
|
||||||
|
# sets the choco cache dir, which should match the dir in the ci cache action.
|
||||||
|
key_arg = '--name="cacheLocation"'
|
||||||
|
value_arg = f'--value="{runner_temp}/choco"'
|
||||||
|
cmd_utils.run(["choco", "config", "set", key_arg, value_arg])
|
||||||
|
else:
|
||||||
|
print(f"Warning: CI environment variable {runner_temp_key} not set")
|
||||||
|
|
||||||
|
def remove_from_config(self, config_file, remove_packages):
|
||||||
|
"""Removes a package from the Chocolatey configuration."""
|
||||||
|
|
||||||
|
tree = ET.parse(config_file)
|
||||||
|
root = tree.getroot()
|
||||||
|
for remove in remove_packages:
|
||||||
|
for package in root.findall("package"):
|
||||||
|
if package.get("id") == remove:
|
||||||
|
root.remove(package)
|
||||||
|
print(f"Removed package from choco config: {remove}")
|
||||||
|
|
||||||
|
tree.write(config_file)
|
||||||
|
|
||||||
|
|
||||||
|
class WindowsQt:
|
||||||
|
"""Qt for Windows."""
|
||||||
|
|
||||||
|
def __init__(self, config, config_file):
|
||||||
|
self.config = config
|
||||||
|
self.config_file = config_file
|
||||||
|
|
||||||
|
self.version = os.environ.get("QT_VERSION")
|
||||||
|
if not self.version:
|
||||||
|
try:
|
||||||
|
default_version = config["version"]
|
||||||
|
except KeyError:
|
||||||
|
raise EnvError(f"Qt version not set in {config_file}")
|
||||||
|
|
||||||
|
print(f"QT_VERSION not set, using: {default_version}")
|
||||||
|
self.version = default_version
|
||||||
|
|
||||||
|
self.base_dir = os.environ.get("QT_BASE_DIR")
|
||||||
|
if not self.base_dir:
|
||||||
|
try:
|
||||||
|
default_base_dir = config["install-dir"]
|
||||||
|
except KeyError:
|
||||||
|
raise EnvError(f"Qt install-dir not set in {config_file}")
|
||||||
|
|
||||||
|
print(f"QT_BASE_DIR not set, using: {default_base_dir}")
|
||||||
|
self.base_dir = default_base_dir
|
||||||
|
|
||||||
|
self.install_dir = f"{self.base_dir}\\{self.version}"
|
||||||
|
|
||||||
|
def get_install_dir(self):
|
||||||
|
if os.path.isdir(self.install_dir):
|
||||||
|
return self.install_dir
|
||||||
|
|
||||||
|
def install(self):
|
||||||
|
"""Installs Qt on Windows."""
|
||||||
|
|
||||||
|
cmd_utils.run(["pip", "install", "aqtinstall"])
|
||||||
|
|
||||||
|
try:
|
||||||
|
mirror_url = self.config["mirror"]
|
||||||
|
except KeyError:
|
||||||
|
raise EnvError(f"Qt mirror not set in {self.config_file}")
|
||||||
|
|
||||||
|
args = ["python", "-m", "aqt", "install-qt"]
|
||||||
|
args.extend(["--outputdir", self.base_dir])
|
||||||
|
args.extend(["--base", mirror_url])
|
||||||
|
args.extend(["windows", "desktop", self.version, "win64_msvc2019_64"])
|
||||||
|
cmd_utils.run(args)
|
||||||
|
|
||||||
|
install_dir = self.get_install_dir()
|
||||||
|
if not install_dir:
|
||||||
|
raise EnvError(f"Qt not installed, path not found: {install_dir}")
|
||||||
|
|
|
||||||
|
|
@ -19,9 +19,9 @@ include_directories (${CMAKE_CURRENT_BINARY_DIR}/lib)
|
||||||
|
|
||||||
add_subdirectory(lib)
|
add_subdirectory(lib)
|
||||||
add_subdirectory(cmd)
|
add_subdirectory(cmd)
|
||||||
if (SYNERGY_BUILD_LEGACY_GUI)
|
if (SYNERGY_BUILD_GUI)
|
||||||
add_subdirectory(gui)
|
add_subdirectory(gui)
|
||||||
endif (SYNERGY_BUILD_LEGACY_GUI)
|
endif (SYNERGY_BUILD_GUI)
|
||||||
|
|
||||||
if (BUILD_TESTS)
|
if (BUILD_TESTS)
|
||||||
add_subdirectory(test)
|
add_subdirectory(test)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue