Use GitHub vars to determine custom runner names (#7509)

* Use `WINDOWS_RUNNER` var to determine custom runner name

* Remove `if` step

* Change var to `CI_WINDOWS_RUNNER`

* Use other runner vars and fall back to free runners

* Update ChangeLog

* Use `CI_MAC_INTEL_RUNNER`

* Set Mac name depending on var

* Use `CI_LINUX_ARM_RUNNER`

* Change CI var to `CI_ENABLE_PACKAGING`

* Use exclusions to remove ARM runners when var not set

* Switch to `CI_USE_LINUX_ARM_RUNNER` var

* Exclude arm runners if `CI_USE_LINUX_ARM_RUNNER` not set

* Fixed path and actually capture `matrix` as var

* Fixed path

* Add debug step

* Kick build

* Add EOL delimiters

* Move action to composite action for reuse

* Make JSON output pretty

* Add shell prop

* Fixed output var name

* Cleanup debug

* Move debug to same step

* Kick build

* Use `needs` on other jobs

* Also depend unix on setup
This commit is contained in:
Nick Bolton
2024-09-12 14:12:28 +01:00
committed by GitHub
parent f9287cddd1
commit fe16ba63fd
6 changed files with 149 additions and 75 deletions

37
.github/actions/filter-json/action.yml vendored Normal file
View File

@ -0,0 +1,37 @@
name: Filter JSON
description: A composite action to filter a JSON file using `jq`
inputs:
json-file:
description: "The JSON file to filter"
required: true
condition:
description: "A condition to determine if the JSON should be filtered"
required: true
jq-filter:
description: "A `jq` filter to run on the JSON"
required: true
outputs:
json:
description: "JSON filtered using `jq`"
value: ${{ steps.filter.outputs.json }}
runs:
using: "composite"
steps:
- id: filter
shell: bash
run: |
json_file="${{ inputs.json-file }}"
if [ ${{ inputs.condition }} ]; then
echo "Filtering JSON"
json=$(jq '${{ inputs.jq-filter }}' $json_file)
else
echo "Not filtering JSON"
json=$(cat $json_file)
fi
echo $json
echo "json=$(echo $json)" >> $GITHUB_OUTPUT

76
.github/workflows/ci-linux.json vendored Normal file
View File

@ -0,0 +1,76 @@
{
"distro": [
{
"name": "debian-13-amd64",
"container": "symless/synergy-core:debian-13-amd64",
"runs-on": "ubuntu-latest",
"extra-packages": true
},
{
"name": "debian-12-arm64",
"container": "symless/synergy-core:debian-12-arm64",
"runs-on": "ubuntu-24.04-8-core-arm64",
"extra-packages": true
},
{
"name": "debian-12-amd64",
"container": "symless/synergy-core:debian-12-amd64",
"runs-on": "ubuntu-latest",
"extra-packages": true
},
{
"name": "ubuntu-24.04-amd64",
"container": "symless/synergy-core:ubuntu-24.04-amd64",
"runs-on": "ubuntu-latest",
"extra-dep-args": "--meson-no-system libportal --meson-static libportal --subprojects",
"extra-cmake-args": "-DSYSTEM_LIBPORTAL=OFF -DSTATIC_LIBPORTAL=ON"
},
{
"name": "ubuntu-22.04-amd64",
"container": "symless/synergy-core:ubuntu-22.04-amd64",
"runs-on": "ubuntu-latest"
},
{
"name": "fedora-40-arm64",
"container": "symless/synergy-core:fedora-40-arm64",
"runs-on": "ubuntu-24.04-8-core-arm64"
},
{
"name": "fedora-40-amd64",
"container": "symless/synergy-core:fedora-40-amd64",
"runs-on": "ubuntu-latest"
},
{
"name": "fedora-39-amd64",
"container": "symless/synergy-core:fedora-39-amd64",
"runs-on": "ubuntu-latest"
},
{
"name": "opensuse-amd64",
"container": "symless/synergy-core:opensuse-amd64",
"runs-on": "ubuntu-latest"
},
{
"name": "rockylinux-9-amd64",
"container": "symless/synergy-core:rockylinux-9-amd64",
"runs-on": "ubuntu-latest"
},
{
"name": "almalinux-9-amd64",
"container": "symless/synergy-core:almalinux-9-amd64",
"runs-on": "ubuntu-latest"
},
{
"name": "archlinux-amd64",
"container": "symless/synergy-core:archlinux-amd64",
"runs-on": "ubuntu-latest",
"package-user": "build"
},
{
"name": "manjaro-amd64",
"container": "symless/synergy-core:manjaro-amd64",
"runs-on": "ubuntu-latest",
"package-user": "build"
}
]
}

View File

@ -42,6 +42,7 @@ jobs:
uses: ./.github/actions/run-tests-setup uses: ./.github/actions/run-tests-setup
windows: windows:
needs: setup
name: ${{ matrix.target.name }} name: ${{ matrix.target.name }}
runs-on: ${{ matrix.target.runs-on }} runs-on: ${{ matrix.target.runs-on }}
container: ${{ matrix.target.container }} container: ${{ matrix.target.container }}
@ -55,7 +56,7 @@ jobs:
matrix: matrix:
target: target:
- name: windows-2022-x64 - name: windows-2022-x64
runs-on: windows-2022-8-core-x64 runs-on: ${{ vars.CI_WINDOWS_RUNNER || 'windows-2022' }}
steps: steps:
- name: Checkout - name: Checkout
@ -113,14 +114,14 @@ jobs:
job: ${{ matrix.target.name }} job: ${{ matrix.target.name }}
- name: Package - name: Package
if: ${{ vars.SYNERGY_ENABLE_PACKAGING && env.PACKAGE_BUILD == 'true' }} if: ${{ vars.CI_ENABLE_PACKAGING && env.PACKAGE_BUILD == 'true' }}
run: python ./scripts/package.py run: python ./scripts/package.py
env: env:
WINDOWS_PFX_CERTIFICATE: ${{ secrets.WINDOWS_PFX }} WINDOWS_PFX_CERTIFICATE: ${{ secrets.WINDOWS_PFX }}
WINDOWS_PFX_PASSWORD: ${{ secrets.WINDOWS_PFX_PASS }} WINDOWS_PFX_PASSWORD: ${{ secrets.WINDOWS_PFX_PASS }}
- name: Upload - name: Upload
if: ${{ vars.SYNERGY_ENABLE_PACKAGING && env.PACKAGE_UPLOAD == 'true' }} if: ${{ vars.CI_ENABLE_PACKAGING && env.PACKAGE_UPLOAD == 'true' }}
uses: ./.github/actions/dist-upload uses: ./.github/actions/dist-upload
with: with:
use_github: ${{ env.UPLOAD_TO_GITHUB }} use_github: ${{ env.UPLOAD_TO_GITHUB }}
@ -132,6 +133,7 @@ jobs:
package-version: ${{ env.SYNERGY_VERSION }} package-version: ${{ env.SYNERGY_VERSION }}
macos: macos:
needs: setup
name: ${{ matrix.target.name }} name: ${{ matrix.target.name }}
runs-on: ${{ matrix.target.os }} runs-on: ${{ matrix.target.os }}
timeout-minutes: ${{ matrix.target.timeout }} timeout-minutes: ${{ matrix.target.timeout }}
@ -153,9 +155,9 @@ jobs:
arch: arm64 arch: arm64
shell: "/usr/bin/arch -arch arm64e /bin/bash --noprofile --norc -eo pipefail {0}" shell: "/usr/bin/arch -arch arm64e /bin/bash --noprofile --norc -eo pipefail {0}"
- name: "macos-14-x64" - name: ${{ vars.CI_MAC_INTEL_NAME || 'macos-13-x64' }}
timeout: 20 timeout: 20
os: "macos-14-large" os: ${{ vars.CI_MAC_INTEL_RUNNER || 'macos-13' }}
arch: x64 arch: x64
shell: "bash" shell: "bash"
@ -195,7 +197,7 @@ jobs:
job: ${{ matrix.target.name }} job: ${{ matrix.target.name }}
- name: Package - name: Package
if: ${{ vars.SYNERGY_ENABLE_PACKAGING && env.PACKAGE_BUILD == 'true' }} if: ${{ vars.CI_ENABLE_PACKAGING && env.PACKAGE_BUILD == 'true' }}
run: ./scripts/package.py run: ./scripts/package.py
env: env:
APPLE_CODESIGN_ID: ${{ secrets.APPLE_CODESIGN_ID }} APPLE_CODESIGN_ID: ${{ secrets.APPLE_CODESIGN_ID }}
@ -206,7 +208,7 @@ jobs:
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
- name: Upload - name: Upload
if: ${{ vars.SYNERGY_ENABLE_PACKAGING && env.PACKAGE_UPLOAD == 'true' }} if: ${{ vars.CI_ENABLE_PACKAGING && env.PACKAGE_UPLOAD == 'true' }}
uses: ./.github/actions/dist-upload uses: ./.github/actions/dist-upload
with: with:
use_github: ${{ env.UPLOAD_TO_GITHUB }} use_github: ${{ env.UPLOAD_TO_GITHUB }}
@ -217,7 +219,26 @@ jobs:
gdrive-parent-folder-id: ${{ secrets.GOOGLE_DRIVE_TECH_DRIVE }} gdrive-parent-folder-id: ${{ secrets.GOOGLE_DRIVE_TECH_DRIVE }}
package-version: ${{ env.SYNERGY_VERSION }} package-version: ${{ env.SYNERGY_VERSION }}
linux-matrix:
runs-on: ubuntu-latest
outputs:
json-matrix: ${{ steps.filter.outputs.json }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Filter JSON
uses: ./.github/actions/filter-json
id: filter
with:
json-file: .github/workflows/ci-linux.json
condition: '"${{ vars.CI_USE_LINUX_ARM_RUNNER }}" != "true"'
jq-filter: .distro |= map(select(.["runs-on"] | contains("arm64") | not))
linux: linux:
needs: [setup, linux-matrix]
name: linux-${{ matrix.distro.name }} name: linux-${{ matrix.distro.name }}
runs-on: ${{ matrix.distro.runs-on }} runs-on: ${{ matrix.distro.runs-on }}
container: ${{ matrix.distro.container }} container: ${{ matrix.distro.container }}
@ -227,69 +248,7 @@ jobs:
# Normally, we want to fail fast, but in this case we shouldn't since one distro may # Normally, we want to fail fast, but in this case we shouldn't since one distro may
# fail due to transient issues unrelated to the build. # fail due to transient issues unrelated to the build.
fail-fast: false fail-fast: false
matrix: ${{fromJson(needs.linux-matrix.outputs.json-matrix)}}
matrix:
distro:
- name: debian-13-amd64
container: symless/synergy-core:debian-13-amd64
runs-on: ubuntu-latest
extra-packages: true
- name: debian-12-arm64
container: symless/synergy-core:debian-12-arm64
runs-on: ubuntu-24.04-8-core-arm64
extra-packages: true
- name: debian-12-amd64
container: symless/synergy-core:debian-12-amd64
runs-on: ubuntu-latest
extra-packages: true
- name: ubuntu-24.04-amd64
container: symless/synergy-core:ubuntu-24.04-amd64
runs-on: ubuntu-latest
# Static libportal only needed until libportal is updated to 0.8.x.
extra-dep-args: --meson-no-system libportal --meson-static libportal --subprojects
extra-cmake-args: -DSYSTEM_LIBPORTAL=OFF -DSTATIC_LIBPORTAL=ON
- name: ubuntu-22.04-amd64
container: symless/synergy-core:ubuntu-22.04-amd64
runs-on: ubuntu-latest
- name: fedora-40-arm64
container: symless/synergy-core:fedora-40-arm64
runs-on: ubuntu-24.04-8-core-arm64
- name: fedora-40-amd64
container: symless/synergy-core:fedora-40-amd64
runs-on: ubuntu-latest
- name: fedora-39-amd64
container: symless/synergy-core:fedora-39-amd64
runs-on: ubuntu-latest
- name: opensuse-amd64
container: symless/synergy-core:opensuse-amd64
runs-on: ubuntu-latest
- name: rockylinux-9-amd64
container: symless/synergy-core:rockylinux-9-amd64
runs-on: ubuntu-latest
- name: almalinux-9-amd64
container: symless/synergy-core:almalinux-9-amd64
runs-on: ubuntu-latest
- name: archlinux-amd64
container: symless/synergy-core:archlinux-amd64
runs-on: ubuntu-latest
package-user: build
- name: manjaro-amd64
container: symless/synergy-core:manjaro-amd64
runs-on: ubuntu-latest
package-user: build
steps: steps:
- name: Checkout - name: Checkout
@ -327,14 +286,14 @@ jobs:
job: linux-${{ matrix.distro.name }} job: linux-${{ matrix.distro.name }}
- name: Package - name: Package
if: ${{ vars.SYNERGY_ENABLE_PACKAGING && env.PACKAGE_BUILD == 'true' }} if: ${{ vars.CI_ENABLE_PACKAGING && env.PACKAGE_BUILD == 'true' }}
env: env:
LINUX_EXTRA_PACKAGES: ${{ matrix.distro.extra-packages }} LINUX_EXTRA_PACKAGES: ${{ matrix.distro.extra-packages }}
LINUX_PACKAGE_USER: ${{ matrix.distro.package-user }} LINUX_PACKAGE_USER: ${{ matrix.distro.package-user }}
run: ./scripts/package.py run: ./scripts/package.py
- name: Upload - name: Upload
if: ${{ vars.SYNERGY_ENABLE_PACKAGING && env.PACKAGE_UPLOAD == 'true' }} if: ${{ vars.CI_ENABLE_PACKAGING && env.PACKAGE_UPLOAD == 'true' }}
uses: ./.github/actions/dist-upload uses: ./.github/actions/dist-upload
with: with:
use_github: ${{ env.UPLOAD_TO_GITHUB }} use_github: ${{ env.UPLOAD_TO_GITHUB }}
@ -347,8 +306,9 @@ jobs:
# Technically, "unix" is a misnomer, but we use it here to mean "Unix-like BSD-derived". # Technically, "unix" is a misnomer, but we use it here to mean "Unix-like BSD-derived".
unix: unix:
needs: setup
name: unix-${{ matrix.distro.name }} name: unix-${{ matrix.distro.name }}
runs-on: ubuntu-24.04-16-core-x64 runs-on: ${{ vars.CI_UNIX_RUNNER || 'ubuntu-24.04' }}
timeout-minutes: 20 timeout-minutes: 20
env: env:

View File

@ -16,7 +16,7 @@ jobs:
if: ${{ !github.event.pull_request.draft }} if: ${{ !github.event.pull_request.draft }}
name: Analyze name: Analyze
runs-on: ubuntu-24.04-16-core-x64 runs-on: ${{ vars.CODEQL_RUNNER || 'ubuntu-24.04' }}
container: symless/synergy-core:ubuntu-24.04-amd64 container: symless/synergy-core:ubuntu-24.04-amd64
timeout-minutes: 20 timeout-minutes: 20

View File

@ -15,7 +15,7 @@ jobs:
sonarcloud-analysis: sonarcloud-analysis:
if: ${{ vars.SONAR_SCANNER_ENABLED }} if: ${{ vars.SONAR_SCANNER_ENABLED }}
runs-on: ubuntu-24.04-32-core-x64 runs-on: ${{ vars.SONAR_SCANNER_RUNNER || 'ubuntu-24.04' }}
container: symless/synergy-core:ubuntu-22.04-amd64 container: symless/synergy-core:ubuntu-22.04-amd64
timeout-minutes: 20 timeout-minutes: 20

View File

@ -6,6 +6,7 @@ Enhancements:
- #7505 Remove static link of libportal from Debian Trixie CI - #7505 Remove static link of libportal from Debian Trixie CI
- #7506 Make `APPLE_CODESIGN_ID` env var optional for CE CI - #7506 Make `APPLE_CODESIGN_ID` env var optional for CE CI
- #7507 Add `run-retry` action to workaround `integtest` `gcovr` issue - #7507 Add `run-retry` action to workaround `integtest` `gcovr` issue
- #7509 Use GitHub vars to determine custom runner names
# 1.16.0 # 1.16.0