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 a39537b
Show file tree
Hide file tree
Showing 15 changed files with 487 additions and 467 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
53 changes: 44 additions & 9 deletions .github/workflows/build-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,50 @@ 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-deb-packages:
name: DEB
if: ${{ inputs.kind == 'linux' }}
runs-on:
- ${{ matrix.arch == 'x86_64' && 'ubuntu-latest' || 'linux-arm64' }}
if: ${{ inputs.kind == 'linux' }}
needs:
- generate-matrix
strategy:
fail-fast: false
matrix:
arch:
- x86_64
- arm64
source:
- ${{ inputs.source }}
include: ${{ fromJSON(needs.generate-matrix.outputs.matrix-include) }}

container:
image: ghcr.io/saltstack/salt-ci-containers/packaging:debian-12
Expand Down Expand Up @@ -149,17 +180,17 @@ jobs:

build-rpm-packages:
name: RPM
runs-on:
- linux-${{ matrix.arch }}
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
source:
- ${{ inputs.source }}
include: ${{ fromJSON(needs.generate-matrix.outputs.matrix-include) }}

container:
image: ghcr.io/saltstack/salt-ci-containers/packaging:rockylinux-9
Expand Down Expand Up @@ -228,6 +259,8 @@ jobs:

build-macos-pkgs:
name: macOS
needs:
- generate-matrix
environment: ${{ inputs.environment }}
if: ${{ inputs.kind == 'macos' }}
strategy:
Expand Down Expand Up @@ -346,6 +379,8 @@ jobs:
build-windows-pkgs:
name: Windows
environment: ${{ inputs.environment }}
needs:
- generate-matrix
if: ${{ inputs.kind == 'windows' }}
strategy:
fail-fast: false
Expand Down
52 changes: 38 additions & 14 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 Expand Up @@ -43,19 +37,49 @@ 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-salt-linux:
name: Linux
if: ${{ inputs.self-hosted-runners && inputs.kind == 'linux' }}
if: ${{ inputs.kind == 'linux' }}
env:
USE_S3_CACHE: 'false'
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) }}
steps:

- name: "Throttle Builds"
Expand Down Expand Up @@ -97,7 +121,7 @@ jobs:

build-salt-macos:
name: macOS
if: ${{ inputs.self-hosted-runners && inputs.kind == 'macos' }}
if: ${{ inputs.kind == 'macos' }}
strategy:
fail-fast: false
max-parallel: 2
Expand Down Expand Up @@ -156,7 +180,7 @@ jobs:

build-salt-windows:
name: Windows
if: ${{ inputs.self-hosted-runners && inputs.kind == 'windows' }}
if: ${{ inputs.kind == 'windows' }}
strategy:
fail-fast: false
max-parallel: 2
Expand Down
Loading

0 comments on commit a39537b

Please sign in to comment.