Skip to content
This repository has been archived by the owner on Sep 23, 2024. It is now read-only.

Commit

Permalink
Use GitHub vars to determine custom runner names (deskflow#7509)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
nbolton authored Sep 12, 2024
1 parent f9287cd commit fe16ba6
Show file tree
Hide file tree
Showing 6 changed files with 149 additions and 75 deletions.
37 changes: 37 additions & 0 deletions .github/actions/filter-json/action.yml
Original file line number Diff line number Diff line change
@@ -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 changes: 76 additions & 0 deletions .github/workflows/ci-linux.json
Original file line number Diff line number Diff line change
@@ -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"
}
]
}
106 changes: 33 additions & 73 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ jobs:
uses: ./.github/actions/run-tests-setup

windows:
needs: setup
name: ${{ matrix.target.name }}
runs-on: ${{ matrix.target.runs-on }}
container: ${{ matrix.target.container }}
Expand All @@ -55,7 +56,7 @@ jobs:
matrix:
target:
- name: windows-2022-x64
runs-on: windows-2022-8-core-x64
runs-on: ${{ vars.CI_WINDOWS_RUNNER || 'windows-2022' }}

steps:
- name: Checkout
Expand Down Expand Up @@ -113,14 +114,14 @@ jobs:
job: ${{ matrix.target.name }}

- 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
env:
WINDOWS_PFX_CERTIFICATE: ${{ secrets.WINDOWS_PFX }}
WINDOWS_PFX_PASSWORD: ${{ secrets.WINDOWS_PFX_PASS }}

- 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
with:
use_github: ${{ env.UPLOAD_TO_GITHUB }}
Expand All @@ -132,6 +133,7 @@ jobs:
package-version: ${{ env.SYNERGY_VERSION }}

macos:
needs: setup
name: ${{ matrix.target.name }}
runs-on: ${{ matrix.target.os }}
timeout-minutes: ${{ matrix.target.timeout }}
Expand All @@ -153,9 +155,9 @@ jobs:
arch: arm64
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
os: "macos-14-large"
os: ${{ vars.CI_MAC_INTEL_RUNNER || 'macos-13' }}
arch: x64
shell: "bash"

Expand Down Expand Up @@ -195,7 +197,7 @@ jobs:
job: ${{ matrix.target.name }}

- name: Package
if: ${{ vars.SYNERGY_ENABLE_PACKAGING && env.PACKAGE_BUILD == 'true' }}
if: ${{ vars.CI_ENABLE_PACKAGING && env.PACKAGE_BUILD == 'true' }}
run: ./scripts/package.py
env:
APPLE_CODESIGN_ID: ${{ secrets.APPLE_CODESIGN_ID }}
Expand All @@ -206,7 +208,7 @@ jobs:
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}

- 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
with:
use_github: ${{ env.UPLOAD_TO_GITHUB }}
Expand All @@ -217,7 +219,26 @@ jobs:
gdrive-parent-folder-id: ${{ secrets.GOOGLE_DRIVE_TECH_DRIVE }}
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:
needs: [setup, linux-matrix]
name: linux-${{ matrix.distro.name }}
runs-on: ${{ matrix.distro.runs-on }}
container: ${{ matrix.distro.container }}
Expand All @@ -227,69 +248,7 @@ jobs:
# 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-fast: false

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
matrix: ${{fromJson(needs.linux-matrix.outputs.json-matrix)}}

steps:
- name: Checkout
Expand Down Expand Up @@ -327,14 +286,14 @@ jobs:
job: linux-${{ matrix.distro.name }}

- name: Package
if: ${{ vars.SYNERGY_ENABLE_PACKAGING && env.PACKAGE_BUILD == 'true' }}
if: ${{ vars.CI_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: ${{ vars.SYNERGY_ENABLE_PACKAGING && env.PACKAGE_UPLOAD == 'true' }}
if: ${{ vars.CI_ENABLE_PACKAGING && env.PACKAGE_UPLOAD == 'true' }}
uses: ./.github/actions/dist-upload
with:
use_github: ${{ env.UPLOAD_TO_GITHUB }}
Expand All @@ -347,8 +306,9 @@ jobs:

# Technically, "unix" is a misnomer, but we use it here to mean "Unix-like BSD-derived".
unix:
needs: setup
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

env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
if: ${{ !github.event.pull_request.draft }}

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
timeout-minutes: 20

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sonarcloud-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
sonarcloud-analysis:
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
timeout-minutes: 20

Expand Down
1 change: 1 addition & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Enhancements:
- #7505 Remove static link of libportal from Debian Trixie CI
- #7506 Make `APPLE_CODESIGN_ID` env var optional for CE CI
- #7507 Add `run-retry` action to workaround `integtest` `gcovr` issue
- #7509 Use GitHub vars to determine custom runner names

# 1.16.0

Expand Down

0 comments on commit fe16ba6

Please sign in to comment.