Skip to content

Commit

Permalink
infra: switch from using templating to using reusable matrix
Browse files Browse the repository at this point in the history
This will enable us to get rid of the custom jinja rendering and the
workflow duplication with the templates.
  • Loading branch information
KKoukiou committed Apr 22, 2024
1 parent ef49bb4 commit 200a3e8
Show file tree
Hide file tree
Showing 11 changed files with 82 additions and 358 deletions.
9 changes: 0 additions & 9 deletions .branch-variables.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,3 @@ distro_release: "rawhide" # "rawhide" or a number without quotation marks

# The following only applies for rawhide.
rawhide_fedora_version: 41 # number without quotation marks, or nothing if CI should not run for branched Fedora

# List of all the branches which are currently supported and CI should be executed on these.
supported_branches:
- fedora-40:
variant: "fedora"
- rhel-9:
variant: "rhel"
- rhel-10:
variant: "rhel"
22 changes: 12 additions & 10 deletions .github/workflows/container-autoupdate-fedora.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,21 @@ permissions:
contents: read

jobs:
matrix-builder:
uses: ./.github/workflows/matrix-builder.yml

master:
container-rebuild-matrix:
# Don't run scheduled workflows on forks.
if: github.event_name != 'schedule' || github.repository == 'rhinstaller/anaconda'
needs: matrix-builder
uses: ./.github/workflows/container-rebuild-action.yml
strategy:
fail-fast: false
matrix:
include: ${{ fromJson(needs.matrix-builder.outputs.matrix) }}
exclude:
- variant: "rhel"
secrets: inherit
with:
container-tag: master
branch: master

fedora-40:
uses: ./.github/workflows/container-rebuild-action.yml
secrets: inherit
with:
container-tag: fedora-40
branch: fedora-40
container-tag: ${{ matrix.branch }}
branch: ${{ matrix.branch }}
31 changes: 0 additions & 31 deletions .github/workflows/container-autoupdate-fedora.yml.j2

This file was deleted.

7 changes: 6 additions & 1 deletion .github/workflows/l10n-po-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,23 @@ on:
workflow_dispatch:

jobs:
matrix-builder:
uses: ./.github/workflows/matrix-builder.yml

update:
runs-on: ubuntu-latest
if: github.event_name != 'schedule' || github.repository == 'rhinstaller/anaconda'
environment: releases
permissions:
contents: write
pull-requests: write
strategy:
needs: matrix-builder
strategy:
fail-fast: false
max-parallel: 1
matrix:
branch: ['master', 'fedora-40', 'rhel-9', 'rhel-10']
include: ${{ fromJson(needs.matrix-builder.outputs.matrix) }}

steps:
- name: Set up dependencies
Expand Down
70 changes: 0 additions & 70 deletions .github/workflows/l10n-po-update.yml.j2

This file was deleted.

20 changes: 20 additions & 0 deletions .github/workflows/matrix-builder.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Matrix builder
on:
workflow_call:
# Map the workflow outputs to job outputs
outputs:
matrix:
description: "Matrix of configurations"
value: ${{ jobs.matrix-builder.outputs.matrix }}

jobs:
matrix-builder:
runs-on: ubuntu-20.04
outputs:
matrix: ${{ steps.convert.outputs.matrix }}
steps:
- uses: actions/checkout@v2
- name: Assign the matrix from .supported-branches.json
id: convert
run: |
echo "matrix=$(yq -P -o=json .supported-branches.json | jq -c .)" >> $GITHUB_OUTPUT
53 changes: 17 additions & 36 deletions .github/workflows/tests-daily.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
# ======================================
# WARNING!
# THIS FILE IS GENERATED FROM A TEMPLATE
# DO NOT EDIT THIS FILE MANUALLY!
# ======================================
# The template is located in: tests-daily.yml.j2

# Run unit tests daily.
#
# This is different from container rebuilds, where the tests "gate" the new version. The last
Expand Down Expand Up @@ -34,38 +27,31 @@ permissions:
contents: read

jobs:
matrix-builder:
uses: ./.github/workflows/matrix-builder.yml

unit-tests:
runs-on: ubuntu-20.04
timeout-minutes: 30
# Don't run scheduled workflows on forks.
if: github.event_name != 'schedule' || github.repository == 'rhinstaller/anaconda'
needs: matrix-builder
strategy:
fail-fast: false
matrix:
release: ['master', 'fedora-40']
include:
- release: 'master'
target_branch: 'master'
ci_tag: 'master'
## add to release: [...] also eln if re-enabled by uncommenting the below
#- release: 'eln'
# target_branch: 'master'
# ci_tag: 'eln'
# build-args: '--build-arg=image=quay.io/fedoraci/fedora:eln-x86_64'
- release: 'fedora-40'
target_branch: 'fedora-40'
ci_tag: 'fedora-40'

include: ${{ fromJson(needs.matrix-builder.outputs.matrix) }}
exclude:
- variant: "rhel"
env:
CI_TAG: '${{ matrix.ci_tag }}'
CI_TAG: '${{ matrix.branch }}'
# Always avoid using cache because cache is not correctly invalidated.
CONTAINER_BUILD_ARGS: '--no-cache ${{ matrix.build-args }}'

steps:
- name: Clone repository
uses: actions/checkout@v4
with:
ref: ${{ matrix.target_branch }}
ref: ${{ matrix.branch }}

- name: Run tests in anaconda-ci container
run: |
Expand All @@ -76,36 +62,31 @@ jobs:
if: always()
uses: actions/upload-artifact@v4
with:
name: 'logs (${{ matrix.ci_tag }})'
name: 'logs (${{ matrix.branch }})'
path: test-logs/*

rpm-tests:
runs-on: ubuntu-20.04
timeout-minutes: 30
# Don't run scheduled workflows on forks.
if: github.event_name != 'schedule' || github.repository == 'rhinstaller/anaconda'
needs: matrix-builder
strategy:
fail-fast: false
matrix:
release: ['master', 'fedora-40']
include:
- release: 'master'
target_branch: 'master'
ci_tag: 'master'
- release: 'fedora-40'
target_branch: 'fedora-40'
ci_tag: 'fedora-40'

include: ${{ fromJson(needs.matrix-builder.outputs.matrix) }}
exclude:
- variant: "rhel"
env:
CI_TAG: '${{ matrix.ci_tag }}'
CI_TAG: '${{ matrix.branch }}'
# Always avoid using cache because cache is not correctly invalidated.
CONTAINER_BUILD_ARGS: '--no-cache ${{ matrix.build-args }}'

steps:
- name: Clone repository
uses: actions/checkout@v4
with:
ref: ${{ matrix.target_branch }}
ref: ${{ matrix.branch }}

- name: Run RPM tests in container
run: make -f Makefile.am container-rpm-test
Expand All @@ -114,5 +95,5 @@ jobs:
if: always()
uses: actions/upload-artifact@v4
with:
name: 'logs-rpm-test (${{ matrix.ci_tag }})'
name: 'logs-rpm-test (${{ matrix.branch }})'
path: test-logs/*
Loading

0 comments on commit 200a3e8

Please sign in to comment.