@@ -92,242 +92,3 @@ jobs:
9292 name : ${{ matrix.tag }}-intgcheck-valgrind
9393 path : |
9494 ./sssd/ci-build-debug/*.valgrind.log
95-
96- system :
97- if : github.event_name == 'push' || !contains(github.event.pull_request.labels.*.name, 'Accepted')
98- needs : [prepare]
99- strategy :
100- fail-fast : false
101- matrix :
102- tag : ${{ fromJson(needs.prepare.outputs.matrix).multihost }}
103- runs-on : ubuntu-latest
104- permissions :
105- contents : read
106- steps :
107- - uses : actions/setup-python@v6
108- with :
109- python-version : ' 3.x'
110-
111- - name : Checkout sssd repository
112- uses : actions/checkout@v5
113- with :
114- path : sssd
115-
116- - name : Setup containers
117- uses : SSSD/sssd-ci-containers/actions/setup@master
118- with :
119- path : sssd-ci-containers
120- tag : ${{ matrix.tag }}
121- override : |
122- services:
123- client:
124- image: ${REGISTRY}/ci-client-devel:${TAG}
125- shm_size: 4G
126- tmpfs:
127- - /dev/shm
128- volumes:
129- - ../sssd:/sssd:rw
130- ipa:
131- image: ${REGISTRY}/ci-ipa-devel:${TAG}
132- shm_size: 4G
133- tmpfs:
134- - /dev/shm
135- volumes:
136- - ../sssd:/sssd:rw
137-
138- - name : Build SSSD on the client and IPA
139- uses : SSSD/sssd-ci-containers/actions/exec@master
140- with :
141- log-file : build.log
142- working-directory : /sssd
143- where : |
144- client
145- ipa
146- script : |
147- #!/bin/bash
148- set -ex
149-
150- ./contrib/ci/run --deps-only
151- autoreconf -if
152-
153- mkdir -p /dev/shm/sssd
154- pushd /dev/shm/sssd
155- /sssd/configure --enable-silent-rules
156- make rpms
157-
158- - name : Install SSSD on the client and IPA
159- uses : SSSD/sssd-ci-containers/actions/exec@master
160- with :
161- log-file : install.log
162- user : root
163- where : |
164- client
165- ipa
166- script : |
167- #!/bin/bash
168- set -ex
169-
170- dnf install -y /dev/shm/sssd/rpmbuild/RPMS/*/*.rpm
171- rm -fr /dev/shm/sssd
172-
173- # We need to reenable sssd-kcm since it was disabled by removing sssd not not enabled again
174- systemctl enable --now sssd-kcm.socket
175-
176- - name : Restart SSSD on IPA server
177- uses : SSSD/sssd-ci-containers/actions/exec@master
178- with :
179- user : root
180- where : ipa
181- script : |
182- #!/bin/bash
183- set -ex
184-
185- systemctl restart sssd || systemctl status sssd
186-
187- - name : Patch the SSH configuration
188- uses : SSSD/sssd-ci-containers/actions/exec@master
189- with :
190- user : root
191- script : |
192- #!/bin/bash
193- test -x /usr/bin/sss_ssh_knownhosts && \
194- sed -e 's/GlobalKnownHostsFile/#GlobalKnownHostsFile/' \
195- -e 's/ProxyCommand \/usr\/bin\/sss_ssh_knownhostsproxy -p %p %h/KnownHostsCommand \/usr\/bin\/sss_ssh_knownhosts %H/' \
196- -i /etc/ssh/ssh_config.d/04-ipa.conf
197-
198- - name : Install system tests dependencies
199- shell : bash
200- working-directory : ./sssd/src/tests/system
201- run : |
202- set -ex
203-
204- sudo apt-get update
205-
206- # Install dependencies for python-ldap
207- sudo apt-get install -y libsasl2-dev python3-dev libldap2-dev libssl-dev libssh-dev
208-
209- # Virtualenv
210- pip3 install virtualenv
211- python3 -m venv .venv
212- source .venv/bin/activate
213-
214- # Install system tests requirements
215- pip3 install -r ./requirements.txt
216-
217- # Install yq to parse yaml files
218- sudo wget -qO /usr/local/bin/yq https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64
219- sudo chmod a+x /usr/local/bin/yq
220-
221- - name : Remove ad from mhc.yaml
222- shell : bash
223- working-directory : ./sssd/src/tests/system
224- run : |
225- yq -i 'del(.domains[0].hosts.[] | select(.role == "ad"))' mhc.yaml
226-
227- - name : Get changed tests
228- shell : bash {0}
229- env :
230- PR_ID : ${{ github.event.pull_request.number }}
231- GH_TOKEN : ${{ github.token }}
232- working-directory : sssd
233- id : select-tests
234- run : |
235- set -e
236-
237- # Check if non-test files were changed or not run inside PR
238- FILES=`gh pr diff "$PR_ID" --name-only 2>&1 || exit 0`
239-
240- if echo "$FILES" | grep 'no pull requests found'; then
241- echo "Script not running against PR event. Will run all tests."
242- echo "SELECT_TESTS=" >> "$GITHUB_OUTPUT"
243- exit 0
244- elif echo "$FILES" | grep -v 'src/tests/system/tests'; then
245- echo "Non-test files were changed. Will run all tests."
246- echo "SELECT_TESTS=" >> "$GITHUB_OUTPUT"
247- exit 0
248- fi
249-
250- DIFF=`gh pr diff "$PR_ID"`
251-
252- # Find if any non-test function was modified, in that case we need to
253- # run all tests as we do not know where the function is used
254- if echo "$DIFF" | grep -P '^(@@.+|\+|-)\s*def (?!test_)'; then
255- echo "Non-test function was modified. Will run all tests."
256- echo "SELECT_TESTS=" >> "$GITHUB_OUTPUT"
257- exit 0
258- fi
259-
260- # Find all tests that were added
261- ADDED=`echo "$DIFF" | grep -P "^\+\s*def test_" | sed -E 's/.+def (test_[^(]+).+/\1/'`
262-
263- # Find all tests that are used as tokens in diff
264- MODIFIED=`echo "$DIFF" | grep -E "^@@.+def test_" | sed -E 's/.+def (test_[^(]+).+/\1/'`
265-
266- # Combine and sort
267- TESTS=`echo -e "$ADDED\n$MODIFIED" | sort | uniq`
268-
269- echo "Following tests were added or modified (or token is present in diff):"
270- echo "$TESTS"
271-
272- ARGS=""
273- if [ ! -z "$TESTS" ]; then
274- FILTER=`echo "$TESTS" | xargs | sed 's/ / or /g'`
275- ARGS="-k \"$FILTER\""
276- fi
277-
278- echo "SELECT_TESTS=$ARGS" >> "$GITHUB_OUTPUT"
279-
280- echo "Set SELECT_TESTS as GitHub Output:"
281- grep SELECT_TESTS "$GITHUB_OUTPUT"
282-
283- - name : Check polarion metadata
284- shell : bash
285- working-directory : ./sssd/src/tests/system
286- run : |
287- # Run pytest in collect only mode to quickly catch issues in Polarion metadata.
288- set -ex -o pipefail
289-
290- mkdir -p $GITHUB_WORKSPACE/artifacts
291- source .venv/bin/activate
292- pytest \
293- --color=yes \
294- --mh-config=./mhc.yaml \
295- --mh-artifacts-dir=$GITHUB_WORKSPACE/artifacts \
296- --polarion-config=../polarion.yaml \
297- --output-polarion-testcase=$GITHUB_WORKSPACE/artifacts/testcase.xml \
298- ${{ steps.select-tests.outputs.SELECT_TESTS }} \
299- --collect-only . |& tee $GITHUB_WORKSPACE/pytest-collect.log
300-
301- - name : Run tests
302- shell : bash
303- working-directory : ./sssd/src/tests/system
304- run : |
305- set -ex -o pipefail
306-
307- mkdir -p $GITHUB_WORKSPACE/artifacts
308- source .venv/bin/activate
309- pytest \
310- --durations=0 \
311- --color=yes \
312- --show-capture=no \
313- --mh-config=./mhc.yaml \
314- --mh-artifacts-dir=$GITHUB_WORKSPACE/artifacts \
315- --polarion-config=../polarion.yaml \
316- --output-polarion-testcase=$GITHUB_WORKSPACE/artifacts/testcase.xml \
317- --output-polarion-testrun=$GITHUB_WORKSPACE/artifacts/testrun.xml \
318- ${{ steps.select-tests.outputs.SELECT_TESTS }} \
319- -vvv . |& tee $GITHUB_WORKSPACE/pytest.log
320-
321- - name : Upload artifacts
322- if : always()
323- uses : actions/upload-artifact@v5
324- with :
325- if-no-files-found : ignore
326- name : ${{ matrix.tag }}-system
327- path : |
328- sssd/ci-install-deps.log
329- artifacts
330- build.log
331- install.log
332- pytest.log
333- pytest-collect.log
0 commit comments