ci: generate all matrices in a single step/job

Signed-off-by: Unai Martinez-Corral <umartinezcorral@antmicro.com>
This commit is contained in:
Unai Martinez-Corral 2022-06-16 01:38:43 +02:00
parent 7d47070d99
commit 2dc5a4e943
3 changed files with 33 additions and 34 deletions

View File

@ -117,9 +117,7 @@ def get_jobs(
return jobs return jobs
distribution = environ['F4PGA_EXAMPLES_DISTRIBUTION'] for distribution in ['debian', 'ubuntu', 'fedora', 'centos']:
jobs = get_jobs(distribution, False) + get_jobs(distribution, True) jobs = get_jobs(distribution, False) + get_jobs(distribution, True)
print(f'::set-output name={distribution}::{jobs!s}')
print(f'::set-output name=matrix::{jobs!s}') print(f"{distribution}: {jobs!s}")
print(str(jobs))

View File

@ -14,23 +14,43 @@ on:
jobs: jobs:
Debian: Matrices:
if: ${{ !(github.event_name != 'pull_request' && github.actor == 'dependabot[bot]') }} if: ${{ !(github.event_name != 'pull_request' && github.actor == 'dependabot[bot]') }}
runs-on: ubuntu-latest
outputs:
debian: ${{ steps.generate.outputs.debian }}
ubuntu: ${{ steps.generate.outputs.ubuntu }}
fedora: ${{ steps.generate.outputs.fedora }}
centos: ${{ steps.generate.outputs.centos }}
steps:
- uses: actions/checkout@v3
- id: generate
run: ./.github/scripts/generate_job_matrices.py '${{ github.repository }}'
Debian:
needs: Matrices
uses: ./.github/workflows/sphinx-tuttest.yml uses: ./.github/workflows/sphinx-tuttest.yml
with: with:
distribution: debian matrix: ${{ needs.Matrices.outputs.debian }}
Ubuntu: Ubuntu:
if: ${{ !(github.event_name != 'pull_request' && github.actor == 'dependabot[bot]') }} needs: Matrices
uses: ./.github/workflows/sphinx-tuttest.yml uses: ./.github/workflows/sphinx-tuttest.yml
with: with:
distribution: ubuntu matrix: ${{ needs.Matrices.outputs.ubuntu }}
Fedora: Fedora:
if: ${{ !(github.event_name != 'pull_request' && github.actor == 'dependabot[bot]') }} needs: Matrices
uses: ./.github/workflows/sphinx-tuttest.yml uses: ./.github/workflows/sphinx-tuttest.yml
with: with:
distribution: fedora matrix: ${{ needs.Matrices.outputs.fedora }}
Centos:
needs: Matrices
uses: ./.github/workflows/sphinx-tuttest.yml
with:
matrix: ${{ needs.Matrices.outputs.centos }}
Automerge: Automerge:
@ -38,6 +58,7 @@ jobs:
- Debian - Debian
- Ubuntu - Ubuntu
- Fedora - Fedora
- Centos
if: github.event_name == 'pull_request' && github.actor == 'dependabot[bot]' if: github.event_name == 'pull_request' && github.actor == 'dependabot[bot]'
runs-on: ubuntu-latest runs-on: ubuntu-latest
name: Automerge dependabot PRs name: Automerge dependabot PRs

View File

@ -3,7 +3,7 @@ name: doc-test
on: on:
workflow_call: workflow_call:
inputs: inputs:
distribution: matrix:
description: 'Distribution to execute tests on' description: 'Distribution to execute tests on'
required: true required: true
type: string type: string
@ -11,31 +11,11 @@ on:
jobs: jobs:
Matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.generate.outputs.matrix }}
surelog-matrix: ${{ steps.generate-surelog.outputs.matrix }}
steps:
- name: Setup repository
uses: actions/checkout@v3
- name: Generate examples matrix
id: generate
run: >-
F4PGA_EXAMPLES_DISTRIBUTION='${{ inputs.distribution }}'
./.github/scripts/generate_job_matrix.py
'${{ github.repository }}'
Test: Test:
needs: Matrix
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
include: ${{ fromJson(needs.Matrix.outputs.matrix) }} include: ${{ fromJson(inputs.matrix) }}
runs-on: ${{ matrix.runs-on }} runs-on: ${{ matrix.runs-on }}
name: ${{ matrix.os-version }} | ${{ matrix.name }} | ${{ matrix.fpga-fam }} | ${{ matrix.example }} name: ${{ matrix.os-version }} | ${{ matrix.name }} | ${{ matrix.fpga-fam }} | ${{ matrix.example }}