diff --git a/.github/actions/filter-json/action.yml b/.github/actions/filter-json/action.yml new file mode 100644 index 00000000000..bf043660e3d --- /dev/null +++ b/.github/actions/filter-json/action.yml @@ -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 diff --git a/.github/workflows/ci-linux.json b/.github/workflows/ci-linux.json new file mode 100644 index 00000000000..a7b366b5562 --- /dev/null +++ b/.github/workflows/ci-linux.json @@ -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" + } + ] +} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 972af10afde..4ec2bf1e980 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 }} @@ -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 @@ -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 }} @@ -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 }} @@ -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" @@ -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 }} @@ -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 }} @@ -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 }} @@ -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 @@ -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 }} @@ -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: diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 1de8deb50e3..67f22f9de97 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -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 diff --git a/.github/workflows/sonarcloud-analysis.yml b/.github/workflows/sonarcloud-analysis.yml index 2b11d7d3410..25a6b50cab0 100644 --- a/.github/workflows/sonarcloud-analysis.yml +++ b/.github/workflows/sonarcloud-analysis.yml @@ -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 diff --git a/ChangeLog b/ChangeLog index d1e7e4fcda2..a7244c4f9af 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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