-
Notifications
You must be signed in to change notification settings - Fork 356
163 lines (141 loc) · 5.65 KB
/
tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
# ======================================
# 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-20.04
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
release: ['']
include:
- release: ''
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'
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@v3
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 scripts/testing/install_dependencies.sh)
# 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@v3
with:
name: 'logs (${{ matrix.ci_tag }})'
path: test-logs/*
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
rpm-tests:
runs-on: ubuntu-20.04
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
release: ['']
include:
- release: ''
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'
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@v3
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@v3
with:
name: 'logs-rpm-test (${{ matrix.ci_tag }})'
path: test-logs/*