Improve package download workflow matrices

Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
This commit is contained in:
Pedro Algarvio 2023-03-14 18:29:26 +00:00 committed by Pedro Algarvio
parent 7373223da4
commit 59d9843e49
7 changed files with 33 additions and 32 deletions

View file

@ -166,7 +166,7 @@ jobs:
uses: ./.github/workflows/test-package-downloads-action-macos.yml
with:
distro-slug: macos-12
platform: macos
platform: darwin
cache-prefix: ${{ needs.prepare-workflow.outputs.cache-seed }}|3.10.10
salt-version: "${{ needs.prepare-workflow.outputs.salt-version }}"
environment: release

View file

@ -1948,7 +1948,7 @@ jobs:
uses: ./.github/workflows/test-package-downloads-action-macos.yml
with:
distro-slug: macos-12
platform: macos
platform: darwin
cache-prefix: ${{ needs.prepare-workflow.outputs.cache-seed }}|3.10.10
salt-version: "${{ needs.prepare-workflow.outputs.salt-version }}"
environment: staging

View file

@ -27,7 +27,7 @@
uses: ./.github/workflows/test-package-downloads-action-macos.yml
with:
distro-slug: macos-12
platform: macos
platform: darwin
cache-prefix: ${{ needs.prepare-workflow.outputs.cache-seed }}|<{ python_version_macos }>
salt-version: "${{ needs.prepare-workflow.outputs.salt-version }}"
environment: <{ gh_environment }>

View file

@ -59,7 +59,8 @@ jobs:
name: Generate Package Test Matrix
runs-on: ubuntu-latest
outputs:
pkg-matrix-include: ${{ steps.generate-pkg-matrix.outputs.matrix }}
arch-matrix-include: ${{ steps.generate-pkg-matrix.outputs.arch }}
test-matrix-include: ${{ steps.generate-pkg-matrix.outputs.tests }}
steps:
- name: Checkout Source Code
uses: actions/checkout@v3
@ -70,7 +71,7 @@ jobs:
- name: Generate Package Test Matrix
id: generate-pkg-matrix
run: |
tools ci pkg-download-matrix macos
tools ci pkg-download-matrix linux
dependencies:
name: Setup Test Dependencies
@ -84,7 +85,7 @@ jobs:
strategy:
fail-fast: false
matrix:
include: ${{ fromJSON(needs.generate-matrix.outputs.pkg-matrix-include) }}
include: ${{ fromJSON(needs.generate-matrix.outputs.arch-matrix-include) }}
steps:
- name: Checkout Source Code
uses: actions/checkout@v3
@ -147,7 +148,7 @@ jobs:
strategy:
fail-fast: false
matrix:
include: ${{ fromJSON(needs.generate-matrix.outputs.pkg-matrix-include) }}
include: ${{ fromJSON(needs.generate-matrix.outputs.test-matrix-include) }}
steps:
- name: Checkout Source Code
@ -246,7 +247,7 @@ jobs:
strategy:
fail-fast: false
matrix:
include: ${{ fromJSON(needs.generate-matrix.outputs.pkg-matrix-include) }}
include: ${{ fromJSON(needs.generate-matrix.outputs.test-matrix-include) }}
steps:
- name: Checkout Source Code

View file

@ -59,7 +59,8 @@ jobs:
name: Generate Package Test Matrix
runs-on: ubuntu-latest
outputs:
pkg-matrix-include: ${{ steps.generate-pkg-matrix.outputs.matrix }}
arch-matrix-include: ${{ steps.generate-pkg-matrix.outputs.arch }}
test-matrix-include: ${{ steps.generate-pkg-matrix.outputs.tests }}
steps:
- name: Checkout Source Code
uses: actions/checkout@v3
@ -81,7 +82,7 @@ jobs:
strategy:
fail-fast: false
matrix:
include: ${{ fromJSON(needs.generate-matrix.outputs.pkg-matrix-include) }}
include: ${{ fromJSON(needs.generate-matrix.outputs.arch-matrix-include) }}
steps:
- name: Checkout Source Code
uses: actions/checkout@v3
@ -157,7 +158,7 @@ jobs:
strategy:
fail-fast: false
matrix:
include: ${{ fromJSON(needs.generate-matrix.outputs.pkg-matrix-include) }}
include: ${{ fromJSON(needs.generate-matrix.outputs.test-matrix-include) }}
steps:
- name: Checkout Source Code
@ -266,7 +267,7 @@ jobs:
strategy:
fail-fast: false
matrix:
include: ${{ fromJSON(needs.generate-matrix.outputs.pkg-matrix-include) }}
include: ${{ fromJSON(needs.generate-matrix.outputs.test-matrix-include) }}
steps:
- name: Checkout Source Code

View file

@ -59,7 +59,8 @@ jobs:
name: Generate Package Test Matrix
runs-on: ubuntu-latest
outputs:
pkg-matrix-include: ${{ steps.generate-pkg-matrix.outputs.matrix }}
arch-matrix-include: ${{ steps.generate-pkg-matrix.outputs.arch }}
test-matrix-include: ${{ steps.generate-pkg-matrix.outputs.tests }}
steps:
- name: Checkout Source Code
uses: actions/checkout@v3
@ -81,7 +82,7 @@ jobs:
strategy:
fail-fast: false
matrix:
include: ${{ fromJSON(needs.generate-matrix.outputs.pkg-matrix-include) }}
include: ${{ fromJSON(needs.generate-matrix.outputs.arch-matrix-include) }}
steps:
- name: Checkout Source Code
uses: actions/checkout@v3
@ -148,7 +149,7 @@ jobs:
strategy:
fail-fast: false
matrix:
include: ${{ fromJSON(needs.generate-matrix.outputs.pkg-matrix-include) }}
include: ${{ fromJSON(needs.generate-matrix.outputs.test-matrix-include) }}
steps:
- name: Checkout Source Code
@ -252,7 +253,7 @@ jobs:
strategy:
fail-fast: false
matrix:
include: ${{ fromJSON(needs.generate-matrix.outputs.pkg-matrix-include) }}
include: ${{ fromJSON(needs.generate-matrix.outputs.test-matrix-include) }}
steps:
- name: Checkout Source Code

View file

@ -721,6 +721,7 @@ def pkg_matrix(ctx: Context, distro_slug: str, pkg_type: str):
arguments={
"platform": {
"help": "The OS platform to generate the matrix for",
"choices": ("linux", "windows", "macos", "darwin"),
},
},
)
@ -732,28 +733,25 @@ def pkg_download_matrix(ctx: Context, platform: str):
if github_output is None:
ctx.warn("The 'GITHUB_OUTPUT' variable is not set.")
_matrix = []
tests = []
arches = []
if platform == "windows":
for arch in ("amd64", "x86"):
arches.append({"arch": arch})
for install_type in ("msi", "nsis"):
_matrix.append(
{
"arch": arch,
"install_type": install_type,
},
)
tests.append({"arch": arch, "install_type": install_type})
else:
for arch in ("x86_64", "arm64"):
if platform == "macos" and arch == "arm64":
for arch in ("x86_64", "aarch64"):
if platform in ("macos", "darwin") and arch == "aarch64":
continue
_matrix.append(
{
"arch": arch,
},
)
arches.append({"arch": arch})
tests.append({"arch": arch})
ctx.info("Generated arch matrix:")
ctx.print(arches, soft_wrap=True)
ctx.info("Generated test matrix:")
ctx.print(_matrix, soft_wrap=True)
ctx.print(tests, soft_wrap=True)
if github_output is not None:
with open(github_output, "a", encoding="utf-8") as wfh:
wfh.write(f"matrix={json.dumps(_matrix)}\n")
wfh.write(f"arch={json.dumps(arches)}\n")
wfh.write(f"tests={json.dumps(tests)}\n")
ctx.exit(0)