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 098d80c
Show file tree
Hide file tree
Showing 7 changed files with 60 additions and 248 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"
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
51 changes: 13 additions & 38 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,28 @@ 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'

matrix: ${{ fromJson(needs.matrix-builder.outputs.matrix) }}
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 +59,28 @@ 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'

matrix: ${{ fromJson(needs.matrix-builder.outputs.matrix) }}
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 +89,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/*
124 changes: 0 additions & 124 deletions .github/workflows/tests-daily.yml.j2

This file was deleted.

7 changes: 5 additions & 2 deletions .github/workflows/try-release-daily.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,17 @@ permissions:
contents: read

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

daily-release-test:
runs-on: [self-hosted, kstest]
needs: matrix-builder
# Don't run scheduled workflows on forks.
if: github.event_name != 'schedule' || github.repository == 'rhinstaller/anaconda'
strategy:
fail-fast: false
matrix:
branch: ['master', 'fedora-40', 'rhel-9', 'rhel-10']
matrix: ${{ fromJson(needs.matrix-builder.outputs.matrix) }}

steps:
- name: Check out repo
Expand Down
75 changes: 0 additions & 75 deletions .github/workflows/try-release-daily.yml.j2

This file was deleted.

22 changes: 22 additions & 0 deletions .supported-branches.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[
{
"release": "fedora-40",
"branch": "fedora-40",
"variant": "fedora"
},
{
"release": "master",
"branch": "master",
"variant": "fedora"
},
{
"release": "rhel-9",
"branch": "rhel-9",
"variant": "rhel"
},
{
"release": "rhel-10",
"branch": "rhel-10",
"variant": "rhel"
}
}

0 comments on commit 098d80c

Please sign in to comment.