diff --git a/.github/workflows/build_all.yml b/.github/workflows/build_all.yml index 1dd492617..21784c062 100644 --- a/.github/workflows/build_all.yml +++ b/.github/workflows/build_all.yml @@ -23,13 +23,15 @@ jobs: runs-on: ubuntu-latest outputs: cache-key: ${{ steps.cache-key.outputs.cache-key }} + matrix-alpine: ${{ steps.alpine.outputs.matrix }} + matrix-ubuntu: ${{ steps.ubuntu.outputs.matrix }} steps: - uses: actions/checkout@v5 with: fetch-depth: 0 - name: Install packages - run: python3 -m pip install git+https://github.com/mesonbuild/meson + run: python3 -m pip install PyYAML git+https://github.com/mesonbuild/meson - name: Calculate cache key id: cache-key @@ -59,6 +61,40 @@ jobs: path: subprojects/packagecache enableCrossOsArchive: true + - name: Build Ubuntu matrix + id: ubuntu + shell: python tools/filter_matrix.py {0} + run: | + - platform: aarch64 + runner: ubuntu-24.04-arm + - platform: ppc64le + runner: ubuntu-24.04-ppc64le + selfhosted: true + - platform: s390x + runner: ubuntu-24.04-s390x + selfhosted: true + - platform: x86_64 + runner: ubuntu-latest + + - name: Build Alpine matrix + id: alpine + shell: python tools/filter_matrix.py {0} + run: | + - platform: aarch64 + runner: ubuntu-24.04-arm + apk-tools-url: 'https://gitlab.alpinelinux.org/api/v4/projects/5/packages/generic/v2.14.7/aarch64/apk.static#!sha256!27a975638ddc95a411c9f17c63383e335da9edf6bb7de2281d950c291a11f878' + - platform: ppc64le + runner: ubuntu-24.04-ppc64le + apk-tools-url: 'https://gitlab.alpinelinux.org/api/v4/projects/5/packages/generic/v2.14.7/ppc64le/apk.static#!sha256!96ba92b49c8cc97fad06f0dfe3c50ec25c3344890e479999ded8752bf9e80d7f' + selfhosted: true + - platform: s390x + runner: ubuntu-24.04-s390x + apk-tools-url: 'https://gitlab.alpinelinux.org/api/v4/projects/5/packages/generic/v2.14.7/s390x/apk.static#!sha256!368996f2908ec8f10f1de500bc97a9bd1c3b0b46ce0bd44983ac09862cbab6d5' + selfhosted: true + - platform: x86_64 + runner: ubuntu-latest + apk-tools-url: 'https://gitlab.alpinelinux.org/api/v4/projects/5/packages/generic/v2.14.7/x86_64/apk.static#!sha256!bdd044e0fd6cc388c5e571e1093efa5f35f7767cc5aa338b0a2576a429009a62' + Ubuntu: if: github.event_name != 'schedule' || github.repository == 'mesonbuild/wrapdb' name: Ubuntu (${{ matrix.platform }}) @@ -66,11 +102,7 @@ jobs: needs: prelude strategy: matrix: - include: - - platform: aarch64 - runner: ubuntu-24.04-arm - - platform: x86_64 - runner: ubuntu-latest + include: ${{ fromJson(needs.prelude.outputs.matrix-ubuntu) }} steps: - uses: actions/checkout@v5 with: @@ -101,13 +133,7 @@ jobs: needs: prelude strategy: matrix: - include: - - platform: aarch64 - runner: ubuntu-24.04-arm - apk-tools-url: 'https://gitlab.alpinelinux.org/api/v4/projects/5/packages/generic/v2.14.7/aarch64/apk.static#!sha256!27a975638ddc95a411c9f17c63383e335da9edf6bb7de2281d950c291a11f878' - - platform: x86_64 - runner: ubuntu-latest - apk-tools-url: 'https://gitlab.alpinelinux.org/api/v4/projects/5/packages/generic/v2.14.7/x86_64/apk.static#!sha256!bdd044e0fd6cc388c5e571e1093efa5f35f7767cc5aa338b0a2576a429009a62' + include: ${{ fromJson(needs.prelude.outputs.matrix-alpine) }} steps: - uses: jirutka/setup-alpine@v1 with: diff --git a/.github/workflows/sanity_checks.yml b/.github/workflows/sanity_checks.yml index 715d217eb..b867f96fd 100644 --- a/.github/workflows/sanity_checks.yml +++ b/.github/workflows/sanity_checks.yml @@ -18,6 +18,8 @@ jobs: runs-on: ubuntu-latest outputs: cache-key: ${{ steps.cache-key.outputs.cache-key }} + matrix-alpine: ${{ steps.alpine.outputs.matrix }} + matrix-ubuntu: ${{ steps.ubuntu.outputs.matrix }} steps: - uses: actions/checkout@v5 with: @@ -25,7 +27,7 @@ jobs: - name: Install packages run: | - python3 -m pip install license-expression + python3 -m pip install license-expression PyYAML python3 -m pip install --pre meson - name: Calculate cache key @@ -59,6 +61,53 @@ jobs: run: | ./tools/fake_tty.py ./tools/sanity_checks.py + - name: Build Ubuntu matrix + id: ubuntu + shell: python tools/filter_matrix.py {0} + run: | + - platform: aarch64 + runner: ubuntu-24.04-arm + python: 3.8 + - platform: ppc64le + runner: ubuntu-24.04-ppc64le + python: 3.13 + selfhosted: true + - platform: s390x + runner: ubuntu-24.04-s390x + python: 3.13 + selfhosted: true + - platform: x86_64 + runner: ubuntu-latest + python: 3.13 + + - name: Build Alpine matrix + id: alpine + shell: python tools/filter_matrix.py {0} + run: | + - platform: aarch64 + runner: ubuntu-24.04-arm + apk-tools-url: 'https://gitlab.alpinelinux.org/api/v4/projects/5/packages/generic/v2.14.7/aarch64/apk.static#!sha256!27a975638ddc95a411c9f17c63383e335da9edf6bb7de2281d950c291a11f878' + - platform: armv7 + runner: ubuntu-24.04-arm + apk-tools-url: 'https://gitlab.alpinelinux.org/api/v4/projects/5/packages/generic/v2.14.7/aarch64/apk.static#!sha256!27a975638ddc95a411c9f17c63383e335da9edf6bb7de2281d950c291a11f878' + - platform: ppc64le + runner: ubuntu-24.04-ppc64le + apk-tools-url: 'https://gitlab.alpinelinux.org/api/v4/projects/5/packages/generic/v2.14.7/ppc64le/apk.static#!sha256!96ba92b49c8cc97fad06f0dfe3c50ec25c3344890e479999ded8752bf9e80d7f' + selfhosted: true + - platform: riscv64 + runner: ubuntu-24.04-arm + apk-tools-url: 'https://gitlab.alpinelinux.org/api/v4/projects/5/packages/generic/v2.14.7/aarch64/apk.static#!sha256!27a975638ddc95a411c9f17c63383e335da9edf6bb7de2281d950c291a11f878' + - platform: s390x + runner: ubuntu-24.04-s390x + apk-tools-url: 'https://gitlab.alpinelinux.org/api/v4/projects/5/packages/generic/v2.14.7/s390x/apk.static#!sha256!368996f2908ec8f10f1de500bc97a9bd1c3b0b46ce0bd44983ac09862cbab6d5' + selfhosted: true + - platform: x86 + runner: ubuntu-latest + apk-tools-url: 'https://gitlab.alpinelinux.org/api/v4/projects/5/packages/generic/v2.14.7/x86_64/apk.static#!sha256!bdd044e0fd6cc388c5e571e1093efa5f35f7767cc5aa338b0a2576a429009a62' + - platform: x86_64 + runner: ubuntu-latest + apk-tools-url: 'https://gitlab.alpinelinux.org/api/v4/projects/5/packages/generic/v2.14.7/x86_64/apk.static#!sha256!bdd044e0fd6cc388c5e571e1093efa5f35f7767cc5aa338b0a2576a429009a62' + Ubuntu: name: Ubuntu (${{ matrix.platform }}) runs-on: ${{ matrix.runner }} @@ -66,13 +115,7 @@ jobs: strategy: fail-fast: false matrix: - include: - - platform: aarch64 - runner: ubuntu-24.04-arm - python: 3.8 - - platform: x86_64 - runner: ubuntu-latest - python: 3.13 + include: ${{ fromJson(needs.prelude.outputs.matrix-ubuntu) }} steps: - uses: actions/checkout@v5 with: @@ -118,25 +161,7 @@ jobs: strategy: fail-fast: false matrix: - include: - - platform: aarch64 - runner: ubuntu-24.04-arm - apk-tools-url: 'https://gitlab.alpinelinux.org/api/v4/projects/5/packages/generic/v2.14.7/aarch64/apk.static#!sha256!27a975638ddc95a411c9f17c63383e335da9edf6bb7de2281d950c291a11f878' - - platform: armv7 - runner: ubuntu-24.04-arm - apk-tools-url: 'https://gitlab.alpinelinux.org/api/v4/projects/5/packages/generic/v2.14.7/aarch64/apk.static#!sha256!27a975638ddc95a411c9f17c63383e335da9edf6bb7de2281d950c291a11f878' - - platform: ppc64le - runner: ubuntu-24.04-arm - apk-tools-url: 'https://gitlab.alpinelinux.org/api/v4/projects/5/packages/generic/v2.14.7/aarch64/apk.static#!sha256!27a975638ddc95a411c9f17c63383e335da9edf6bb7de2281d950c291a11f878' - - platform: riscv64 - runner: ubuntu-24.04-arm - apk-tools-url: 'https://gitlab.alpinelinux.org/api/v4/projects/5/packages/generic/v2.14.7/aarch64/apk.static#!sha256!27a975638ddc95a411c9f17c63383e335da9edf6bb7de2281d950c291a11f878' - - platform: x86 - runner: ubuntu-latest - apk-tools-url: 'https://gitlab.alpinelinux.org/api/v4/projects/5/packages/generic/v2.14.7/x86_64/apk.static#!sha256!bdd044e0fd6cc388c5e571e1093efa5f35f7767cc5aa338b0a2576a429009a62' - - platform: x86_64 - runner: ubuntu-latest - apk-tools-url: 'https://gitlab.alpinelinux.org/api/v4/projects/5/packages/generic/v2.14.7/x86_64/apk.static#!sha256!bdd044e0fd6cc388c5e571e1093efa5f35f7767cc5aa338b0a2576a429009a62' + include: ${{ fromJson(needs.prelude.outputs.matrix-alpine) }} steps: - uses: actions/checkout@v5 with: diff --git a/tools/filter_matrix.py b/tools/filter_matrix.py new file mode 100755 index 000000000..7dd6a0f13 --- /dev/null +++ b/tools/filter_matrix.py @@ -0,0 +1,34 @@ +#!/usr/bin/env python3 + +# Copyright 2025 Benjamin Gilbert + +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at + +# https://www.apache.org/licenses/LICENSE-2.0 + +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import json +import os +import sys +import yaml +import typing as T + +UPSTREAM_OWNER = 'mesonbuild' + +with open(sys.argv[1]) as f: + jobs: list[dict[str, T.Any]] = yaml.safe_load(f) + +if os.environ['GITHUB_REPOSITORY_OWNER'] != UPSTREAM_OWNER: + jobs = [j for j in jobs if not j.get('selfhosted', False)] + +with open(os.environ['GITHUB_OUTPUT'], 'a') as f: + f.write('matrix=') + json.dump(jobs, f, separators=(',', ':')) + f.write('\n')