Skip to content

Commit

Permalink
Add build-matrix
Browse files Browse the repository at this point in the history
  • Loading branch information
dwoz committed Nov 9, 2024
1 parent 8edbb65 commit 094530a
Show file tree
Hide file tree
Showing 10 changed files with 112 additions and 147 deletions.
56 changes: 42 additions & 14 deletions .github/workflows/build-deps-onedir.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,6 @@ on:
type: string
required: true
description: The Salt version to set prior to building packages.
github-hosted-runners:
type: boolean
required: true
self-hosted-runners:
type: boolean
required: true
cache-seed:
required: true
type: string
Expand Down Expand Up @@ -43,17 +37,47 @@ env:

jobs:

generate-matrix:
name: Test Matrix
runs-on: ubuntu-latest
outputs:
matrix-include: ${{ steps.generate-matrix.outputs.matrix }}
steps:
- uses: actions/setup-python@v5
with:
python-version: "3.10.14"

- name: "Throttle Builds"
shell: bash
run: |
t=$(shuf -i 1-30 -n 1); echo "Sleeping $t seconds"; sleep "$t"
- name: Checkout Source Code
uses: actions/checkout@v4

- name: Setup Python Tools Scripts
uses: ./.github/actions/setup-python-tools-scripts
with:
cache-prefix: ${{ inputs.cache-prefix }}
env:
PIP_INDEX_URL: https://pypi.org/simple

- name: Generate Test Matrix
id: generate-matrix
run: tools ci build-matrix ${{ inputs.kind }}


build-deps-linux:
name: Linux
if: ${{ inputs.self-hosted-runners && inputs.kind == 'linux' }}
if: ${{ inputs.kind == 'linux' }}
runs-on:
- ${{ matrix.arch == 'x86_64' && 'ubuntu-latest' || 'linux-arm64' }}
needs:
- generate-matrix
strategy:
fail-fast: false
matrix:
arch:
- x86_64
- arm64
runs-on:
- ${{ matrix.arch == 'x86_64' && 'ubuntu-latest' || 'linux-arm64' }}
include: ${{ fromJSON(needs.generate-matrix.outputs.matrix-include) }}
env:
USE_S3_CACHE: 'false'
steps:
Expand Down Expand Up @@ -90,12 +114,14 @@ jobs:

build-deps-macos:
name: macOS
if: ${{ inputs.github-hosted-runners && inputs.kind == 'macOS' }}
if: ${{ inputs.kind == 'macOS' }}
strategy:
fail-fast: false
max-parallel: 2
matrix:
arch: ${{ github.event.repository.fork && fromJSON('["x86_64"]') || fromJSON('["x86_64", "arm64"]') }}
needs:
- generate-matrix
runs-on:
- ${{ matrix.arch == 'arm64' && 'macos-14' || 'macos-13' }}
env:
Expand Down Expand Up @@ -144,14 +170,16 @@ jobs:

build-deps-windows:
name: Windows
if: ${{ inputs.github-hosted-runners && inputs.kind == 'windows' }}
if: ${{ inputs.kind == 'windows' }}
strategy:
fail-fast: false
max-parallel: 2
matrix:
arch:
- x86
- amd64
needs:
- generate-matrix
runs-on: windows-latest
env:
USE_S3_CACHE: 'false'
Expand Down
6 changes: 0 additions & 6 deletions .github/workflows/build-salt-onedir.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,6 @@ on:
type: string
required: true
description: The Salt version to set prior to building packages.
github-hosted-runners:
type: boolean
required: true
self-hosted-runners:
type: boolean
required: true
cache-seed:
required: true
type: string
Expand Down
32 changes: 7 additions & 25 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ jobs:
runs-on: ubuntu-latest
outputs:
jobs: ${{ steps.define-jobs.outputs.jobs }}
runners: ${{ steps.runner-types.outputs.runners }}
changed-files: ${{ steps.process-changed-files.outputs.changed-files }}
os-labels: ${{ steps.get-pull-labels.outputs.os-labels }}
pull-labels: ${{ steps.get-pull-labels.outputs.test-labels }}
Expand Down Expand Up @@ -196,11 +195,6 @@ jobs:
run: |
echo '${{ steps.process-changed-files.outputs.changed-files }}' | jq -C '.'
- name: Define Runner Types
id: runner-types
run: |
tools ci runner-types ${{ github.event_name }}
- name: Define Jobs To Run
id: define-jobs
run: |
Expand Down Expand Up @@ -376,7 +370,7 @@ jobs:

build-docs:
name: Documentation
if: ${{ fromJSON(needs.prepare-workflow.outputs.jobs)['build-docs'] && fromJSON(needs.prepare-workflow.outputs.runners)['self-hosted'] }}
if: ${{ fromJSON(needs.prepare-workflow.outputs.jobs)['build-docs'] }}
needs:
- prepare-workflow
- build-source-tarball
Expand Down Expand Up @@ -418,45 +412,39 @@ jobs:

build-deps-onedir-linux:
name: Build Onedir Dependencies
if: ${{ fromJSON(needs.prepare-workflow.outputs.jobs)['build-deps-onedir-linux'] && fromJSON(needs.prepare-workflow.outputs.runners)['self-hosted'] }}
if: ${{ fromJSON(needs.prepare-workflow.outputs.jobs)['build-deps-onedir-linux'] }}
needs:
- prepare-workflow
uses: ./.github/workflows/build-deps-onedir.yml
with:
cache-seed: ${{ needs.prepare-workflow.outputs.cache-seed }}
salt-version: "${{ needs.prepare-workflow.outputs.salt-version }}"
self-hosted-runners: ${{ fromJSON(needs.prepare-workflow.outputs.runners)['self-hosted'] }}
github-hosted-runners: ${{ fromJSON(needs.prepare-workflow.outputs.runners)['github-hosted'] }}
relenv-version: "0.18.0"
python-version: "3.10.15"
kind: linux

build-deps-onedir-macos:
name: Build Onedir Dependencies
if: ${{ fromJSON(needs.prepare-workflow.outputs.jobs)['build-deps-onedir-macos'] && fromJSON(needs.prepare-workflow.outputs.runners)['self-hosted'] }}
if: ${{ fromJSON(needs.prepare-workflow.outputs.jobs)['build-deps-onedir-macos'] }}
needs:
- prepare-workflow
uses: ./.github/workflows/build-deps-onedir.yml
with:
cache-seed: ${{ needs.prepare-workflow.outputs.cache-seed }}
salt-version: "${{ needs.prepare-workflow.outputs.salt-version }}"
self-hosted-runners: ${{ fromJSON(needs.prepare-workflow.outputs.runners)['self-hosted'] }}
github-hosted-runners: ${{ fromJSON(needs.prepare-workflow.outputs.runners)['github-hosted'] }}
relenv-version: "0.18.0"
python-version: "3.10.15"
kind: macos

build-deps-onedir-windows:
name: Build Onedir Dependencies
if: ${{ fromJSON(needs.prepare-workflow.outputs.jobs)['build-deps-onedir-windows'] && fromJSON(needs.prepare-workflow.outputs.runners)['self-hosted'] }}
if: ${{ fromJSON(needs.prepare-workflow.outputs.jobs)['build-deps-onedir-windows'] }}
needs:
- prepare-workflow
uses: ./.github/workflows/build-deps-onedir.yml
with:
cache-seed: ${{ needs.prepare-workflow.outputs.cache-seed }}
salt-version: "${{ needs.prepare-workflow.outputs.salt-version }}"
self-hosted-runners: ${{ fromJSON(needs.prepare-workflow.outputs.runners)['self-hosted'] }}
github-hosted-runners: ${{ fromJSON(needs.prepare-workflow.outputs.runners)['github-hosted'] }}
relenv-version: "0.18.0"
python-version: "3.10.15"
kind: windows
Expand All @@ -472,8 +460,6 @@ jobs:
with:
cache-seed: ${{ needs.prepare-workflow.outputs.cache-seed }}
salt-version: "${{ needs.prepare-workflow.outputs.salt-version }}"
self-hosted-runners: ${{ fromJSON(needs.prepare-workflow.outputs.runners)['self-hosted'] }}
github-hosted-runners: ${{ fromJSON(needs.prepare-workflow.outputs.runners)['github-hosted'] }}
relenv-version: "0.18.0"
python-version: "3.10.15"
kind: linux
Expand All @@ -489,8 +475,6 @@ jobs:
with:
cache-seed: ${{ needs.prepare-workflow.outputs.cache-seed }}
salt-version: "${{ needs.prepare-workflow.outputs.salt-version }}"
self-hosted-runners: ${{ fromJSON(needs.prepare-workflow.outputs.runners)['self-hosted'] }}
github-hosted-runners: ${{ fromJSON(needs.prepare-workflow.outputs.runners)['github-hosted'] }}
relenv-version: "0.18.0"
python-version: "3.10.15"
kind: macos
Expand All @@ -506,8 +490,6 @@ jobs:
with:
cache-seed: ${{ needs.prepare-workflow.outputs.cache-seed }}
salt-version: "${{ needs.prepare-workflow.outputs.salt-version }}"
self-hosted-runners: ${{ fromJSON(needs.prepare-workflow.outputs.runners)['self-hosted'] }}
github-hosted-runners: ${{ fromJSON(needs.prepare-workflow.outputs.runners)['github-hosted'] }}
relenv-version: "0.18.0"
python-version: "3.10.15"
kind: windows
Expand Down Expand Up @@ -558,7 +540,7 @@ jobs:
kind: windows
build-ci-deps-linux:
name: CI Deps
if: ${{ fromJSON(needs.prepare-workflow.outputs.jobs)['build-deps-ci'] && fromJSON(needs.prepare-workflow.outputs.runners)['self-hosted'] }}
if: ${{ fromJSON(needs.prepare-workflow.outputs.jobs)['build-deps-ci'] }}
needs:
- prepare-workflow
- build-salt-onedir-linux
Expand All @@ -574,7 +556,7 @@ jobs:

build-ci-deps-macos:
name: CI Deps
if: ${{ fromJSON(needs.prepare-workflow.outputs.jobs)['build-deps-ci'] && fromJSON(needs.prepare-workflow.outputs.runners)['self-hosted'] }}
if: ${{ fromJSON(needs.prepare-workflow.outputs.jobs)['build-deps-ci'] }}
needs:
- prepare-workflow
- build-salt-onedir-macos
Expand All @@ -590,7 +572,7 @@ jobs:

build-ci-deps-windows:
name: CI Deps
if: ${{ fromJSON(needs.prepare-workflow.outputs.jobs)['build-deps-ci'] && fromJSON(needs.prepare-workflow.outputs.runners)['self-hosted'] }}
if: ${{ fromJSON(needs.prepare-workflow.outputs.jobs)['build-deps-ci'] }}
needs:
- prepare-workflow
- build-salt-onedir-windows
Expand Down
32 changes: 7 additions & 25 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ jobs:
- workflow-requirements
outputs:
jobs: ${{ steps.define-jobs.outputs.jobs }}
runners: ${{ steps.runner-types.outputs.runners }}
changed-files: ${{ steps.process-changed-files.outputs.changed-files }}
os-labels: ${{ steps.get-pull-labels.outputs.os-labels }}
pull-labels: ${{ steps.get-pull-labels.outputs.test-labels }}
Expand Down Expand Up @@ -245,11 +244,6 @@ jobs:
run: |
echo '${{ steps.process-changed-files.outputs.changed-files }}' | jq -C '.'
- name: Define Runner Types
id: runner-types
run: |
tools ci runner-types ${{ github.event_name }}
- name: Define Jobs To Run
id: define-jobs
run: |
Expand Down Expand Up @@ -430,7 +424,7 @@ jobs:

build-docs:
name: Documentation
if: ${{ fromJSON(needs.prepare-workflow.outputs.jobs)['build-docs'] && fromJSON(needs.prepare-workflow.outputs.runners)['self-hosted'] }}
if: ${{ fromJSON(needs.prepare-workflow.outputs.jobs)['build-docs'] }}
needs:
- prepare-workflow
- build-source-tarball
Expand Down Expand Up @@ -472,45 +466,39 @@ jobs:

build-deps-onedir-linux:
name: Build Onedir Dependencies
if: ${{ fromJSON(needs.prepare-workflow.outputs.jobs)['build-deps-onedir-linux'] && fromJSON(needs.prepare-workflow.outputs.runners)['self-hosted'] }}
if: ${{ fromJSON(needs.prepare-workflow.outputs.jobs)['build-deps-onedir-linux'] }}
needs:
- prepare-workflow
uses: ./.github/workflows/build-deps-onedir.yml
with:
cache-seed: ${{ needs.prepare-workflow.outputs.cache-seed }}
salt-version: "${{ needs.prepare-workflow.outputs.salt-version }}"
self-hosted-runners: ${{ fromJSON(needs.prepare-workflow.outputs.runners)['self-hosted'] }}
github-hosted-runners: ${{ fromJSON(needs.prepare-workflow.outputs.runners)['github-hosted'] }}
relenv-version: "0.18.0"
python-version: "3.10.15"
kind: linux

build-deps-onedir-macos:
name: Build Onedir Dependencies
if: ${{ fromJSON(needs.prepare-workflow.outputs.jobs)['build-deps-onedir-macos'] && fromJSON(needs.prepare-workflow.outputs.runners)['self-hosted'] }}
if: ${{ fromJSON(needs.prepare-workflow.outputs.jobs)['build-deps-onedir-macos'] }}
needs:
- prepare-workflow
uses: ./.github/workflows/build-deps-onedir.yml
with:
cache-seed: ${{ needs.prepare-workflow.outputs.cache-seed }}
salt-version: "${{ needs.prepare-workflow.outputs.salt-version }}"
self-hosted-runners: ${{ fromJSON(needs.prepare-workflow.outputs.runners)['self-hosted'] }}
github-hosted-runners: ${{ fromJSON(needs.prepare-workflow.outputs.runners)['github-hosted'] }}
relenv-version: "0.18.0"
python-version: "3.10.15"
kind: macos

build-deps-onedir-windows:
name: Build Onedir Dependencies
if: ${{ fromJSON(needs.prepare-workflow.outputs.jobs)['build-deps-onedir-windows'] && fromJSON(needs.prepare-workflow.outputs.runners)['self-hosted'] }}
if: ${{ fromJSON(needs.prepare-workflow.outputs.jobs)['build-deps-onedir-windows'] }}
needs:
- prepare-workflow
uses: ./.github/workflows/build-deps-onedir.yml
with:
cache-seed: ${{ needs.prepare-workflow.outputs.cache-seed }}
salt-version: "${{ needs.prepare-workflow.outputs.salt-version }}"
self-hosted-runners: ${{ fromJSON(needs.prepare-workflow.outputs.runners)['self-hosted'] }}
github-hosted-runners: ${{ fromJSON(needs.prepare-workflow.outputs.runners)['github-hosted'] }}
relenv-version: "0.18.0"
python-version: "3.10.15"
kind: windows
Expand All @@ -526,8 +514,6 @@ jobs:
with:
cache-seed: ${{ needs.prepare-workflow.outputs.cache-seed }}
salt-version: "${{ needs.prepare-workflow.outputs.salt-version }}"
self-hosted-runners: ${{ fromJSON(needs.prepare-workflow.outputs.runners)['self-hosted'] }}
github-hosted-runners: ${{ fromJSON(needs.prepare-workflow.outputs.runners)['github-hosted'] }}
relenv-version: "0.18.0"
python-version: "3.10.15"
kind: linux
Expand All @@ -543,8 +529,6 @@ jobs:
with:
cache-seed: ${{ needs.prepare-workflow.outputs.cache-seed }}
salt-version: "${{ needs.prepare-workflow.outputs.salt-version }}"
self-hosted-runners: ${{ fromJSON(needs.prepare-workflow.outputs.runners)['self-hosted'] }}
github-hosted-runners: ${{ fromJSON(needs.prepare-workflow.outputs.runners)['github-hosted'] }}
relenv-version: "0.18.0"
python-version: "3.10.15"
kind: macos
Expand All @@ -560,8 +544,6 @@ jobs:
with:
cache-seed: ${{ needs.prepare-workflow.outputs.cache-seed }}
salt-version: "${{ needs.prepare-workflow.outputs.salt-version }}"
self-hosted-runners: ${{ fromJSON(needs.prepare-workflow.outputs.runners)['self-hosted'] }}
github-hosted-runners: ${{ fromJSON(needs.prepare-workflow.outputs.runners)['github-hosted'] }}
relenv-version: "0.18.0"
python-version: "3.10.15"
kind: windows
Expand Down Expand Up @@ -681,7 +663,7 @@ jobs:
secrets: inherit
build-ci-deps-linux:
name: CI Deps
if: ${{ fromJSON(needs.prepare-workflow.outputs.jobs)['build-deps-ci'] && fromJSON(needs.prepare-workflow.outputs.runners)['self-hosted'] }}
if: ${{ fromJSON(needs.prepare-workflow.outputs.jobs)['build-deps-ci'] }}
needs:
- prepare-workflow
- build-salt-onedir-linux
Expand All @@ -697,7 +679,7 @@ jobs:

build-ci-deps-macos:
name: CI Deps
if: ${{ fromJSON(needs.prepare-workflow.outputs.jobs)['build-deps-ci'] && fromJSON(needs.prepare-workflow.outputs.runners)['self-hosted'] }}
if: ${{ fromJSON(needs.prepare-workflow.outputs.jobs)['build-deps-ci'] }}
needs:
- prepare-workflow
- build-salt-onedir-macos
Expand All @@ -713,7 +695,7 @@ jobs:

build-ci-deps-windows:
name: CI Deps
if: ${{ fromJSON(needs.prepare-workflow.outputs.jobs)['build-deps-ci'] && fromJSON(needs.prepare-workflow.outputs.runners)['self-hosted'] }}
if: ${{ fromJSON(needs.prepare-workflow.outputs.jobs)['build-deps-ci'] }}
needs:
- prepare-workflow
- build-salt-onedir-windows
Expand Down
Loading

0 comments on commit 094530a

Please sign in to comment.