Sync subscription code from rhel 9 #6769
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ====================================== | |
# WARNING! | |
# THIS FILE IS GENERATED FROM A TEMPLATE | |
# DO NOT EDIT THIS FILE MANUALLY! | |
# ====================================== | |
# The template is located in: tests.yml.j2 | |
name: Run validation tests | |
on: pull_request | |
permissions: | |
contents: read | |
# when force pushing the pr, cancel previous tests if still running | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
unit-tests: | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
strategy: | |
fail-fast: false | |
matrix: | |
release: [''] | |
include: | |
- release: '' | |
target_branch: 'rhel-10' | |
ci_tag: 'rhel-10' | |
env: | |
CI_TAG: '${{ matrix.ci_tag }}' | |
# Always avoid using cache because cache is not correctly invalidated. | |
CONTAINER_BUILD_ARGS: '--no-cache ${{ matrix.build-args }}' | |
TARGET_BRANCH_NAME: 'origin/${{ matrix.target_branch }}' | |
steps: | |
- name: Clone repository | |
uses: actions/checkout@v4 | |
with: | |
# TODO: Are we able to remove ref, fetch-depth and Rebase task? Seems that the checkout | |
# without ref is doing the rebase for us. | |
# otherwise we are testing target branch instead of the PR branch (see pull_request_target trigger) | |
ref: ${{ github.event.pull_request.head.sha }} | |
fetch-depth: 0 | |
- name: Rebase to current ${{ env.TARGET_BRANCH_NAME }} | |
run: | | |
git config user.name github-actions | |
git config user.email [email protected] | |
git log --oneline -1 ${{ env.TARGET_BRANCH_NAME }} | |
git rebase ${{ env.TARGET_BRANCH_NAME }} | |
- name: Check if rebuild of the container image is required | |
id: check-dockerfile-changed | |
run: | | |
changes=$(git diff $TARGET_BRANCH_NAME..HEAD -- dockerfile/anaconda-ci/ anaconda.spec.in) | |
# print for debugging | |
echo "$changes" | |
[ -z "$changes" ] || echo "changed=true" >> $GITHUB_OUTPUT | |
# build container if files for dockerfile changed in the PR | |
- name: Build anaconda-ci container | |
if: steps.check-dockerfile-changed.outputs.changed | |
run: make -f Makefile.am anaconda-ci-build | |
- name: Run tests in anaconda-ci container | |
run: | | |
# put the log in the output, where it's easy to read and link to | |
make -f Makefile.am container-ci || { cat test-logs/test-suite.log; exit 1; } | |
- name: Upload test and coverage logs | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: 'logs (${{ matrix.ci_tag }})' | |
path: test-logs/* | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
rpm-tests: | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 30 | |
strategy: | |
fail-fast: false | |
matrix: | |
release: [''] | |
include: | |
- release: '' | |
target_branch: 'rhel-10' | |
ci_tag: 'rhel-10' | |
env: | |
CI_TAG: '${{ matrix.ci_tag }}' | |
# Always avoid using cache because cache is not correctly invalidated. | |
CONTAINER_BUILD_ARGS: '--no-cache ${{ matrix.build-args }}' | |
TARGET_BRANCH_NAME: 'origin/${{ matrix.target_branch }}' | |
steps: | |
- name: Clone repository | |
uses: actions/checkout@v4 | |
with: | |
# TODO: Are we able to remove ref, fetch-depth and Rebase task? Seems that the checkout | |
# without ref is doing the rebase for us. | |
# otherwise we are testing target branch instead of the PR branch (see pull_request_target trigger) | |
ref: ${{ github.event.pull_request.head.sha }} | |
fetch-depth: 0 | |
- name: Rebase to current ${{ env.TARGET_BRANCH_NAME }} | |
run: | | |
git config user.name github-actions | |
git config user.email [email protected] | |
git log --oneline -1 ${{ env.TARGET_BRANCH_NAME }} | |
git rebase ${{ env.TARGET_BRANCH_NAME }} | |
- name: Check if container rebuild is needed | |
id: need_rebuild | |
run: | | |
changed_files=$(git diff --name-only ${{ env.TARGET_BRANCH_NAME }}..HEAD) | |
echo -e "Changed files: \n$changed_files\n" | |
. .structure-config | |
echo "Paths forcing the rebuild:" | |
rebuild="false" | |
for iter_f in $changed_files ; do | |
for rebuild_f in "${RPM_REBUILD_PATHS[@]}"; do | |
if [[ "$iter_f" =~ "$rebuild_f" ]]; then | |
echo "$iter_f" | |
rebuild="true" | |
break | |
fi | |
done | |
done | |
echo "rebuild=$rebuild" >> $GITHUB_OUTPUT | |
- name: Build RPM test container | |
if: ${{ steps.need_rebuild.outputs.rebuild == 'true' }} | |
run: make -f Makefile.am anaconda-rpm-build | |
- name: Run RPM tests in container | |
run: make -f Makefile.am container-rpm-test | |
- name: Upload test logs | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: 'logs-rpm-test (${{ matrix.ci_tag }})' | |
path: test-logs/* |