From cd36a0e97990e619272e56351a58665b7a5ffc39 Mon Sep 17 00:00:00 2001 From: Piotr Bartman-Szwarc Date: Tue, 11 Jun 2024 17:39:48 +0200 Subject: [PATCH] run ci tests --- .gitlab-ci.yml | 16 ++++++++++++++ ci/codecov-keys.asc | 52 +++++++++++++++++++++++++++++++++++++++++++++ ci/codecov-wrapper | 24 +++++++++++++++++++++ ci/coveragerc | 5 +++++ ci/requirements.txt | 12 +++++++++++ run-tests.sh | 3 +++ 6 files changed, 112 insertions(+) create mode 100644 ci/codecov-keys.asc create mode 100755 ci/codecov-wrapper create mode 100644 ci/coveragerc create mode 100644 ci/requirements.txt create mode 100755 run-tests.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 30615e2c..41d65b9f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -3,3 +3,19 @@ include: project: QubesOS/qubes-continuous-integration - file: /r4.2/gitlab-host.yml project: QubesOS/qubes-continuous-integration + +checks:tests: + stage: checks + variables: + PYTEST_ADDOPTS: "--color=yes" + before_script: &before-script + - "PATH=$PATH:$HOME/.local/bin" + - sudo dnf install -y python3-pytest python3-coverage + - pip3 install --quiet -r ci/requirements.txt + - git clone https://github.com/QubesOS/qubes-core-admin-client ~/core-admin-client + script: + - export PATH="$HOME/.local/bin:$PATH" + - PYTHONPATH=~/core-admin-client ./run-tests.sh + after_script: + - "PATH=$PATH:$HOME/.local/bin" + - ci/codecov-wrapper \ No newline at end of file diff --git a/ci/codecov-keys.asc b/ci/codecov-keys.asc new file mode 100644 index 00000000..b7dfce0e --- /dev/null +++ b/ci/codecov-keys.asc @@ -0,0 +1,52 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- + +mQINBGCsMn0BEACiCKZOhkbhUjb+obvhH49p3ShjJzU5b/GqAXSDhRhdXUq7ZoGq +KEKCd7sQHrCf16Pi5UVacGIyE9hS93HwY15kMlLwM+lNeAeCglEscOjpCly1qUIr +sN1wjkd2cwDXS6zHBJTqJ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Y633 +e5B4FWorIXx0tTmsVM4rkQ6IgAodeywKG+c2Ikd+5dQLFmb7dW/6CwARAQABiQI2 +BBgBCgAgFiEEJwNOf9uFDgu8LGL/gGuyiu13mGkFAmCsMn0CGwwACgkQgGuyiu13 +mGkYWxAAkzF64SVpYvY9nY/QSYikL8UHlyyqirs6eFZ3Mj9lMRpHM2Spn9a3c701 +0Ge4wDbRP2oftCyPP+p9pdUA77ifMTlRcoMYX8oXAuyE5RT2emBDiWvSR6hQQ8bZ +WFNXal+bUPpaRiruCCUPD2b8Od1ftzLqbYOosxr/m5Du0uahgOuGw6zlGBJCVOo7 +UB2Y++oZ8P7oDGF722opepWQ+bl2a6TRMLNWWlj4UANknyjlhyZZ7PKhWLjoC6MU +dAKcwQUdp+XYLc/3b00bvgju0e99QgHZMX2fN3d3ktdN5Q2fqiAi5R6BmCCO4ISF +o5j10gGU/sdqGHvNhv5C21ibun7HEzMtxBhnhGmytfBJzrsj7GOReePsfTLoCoUq +dFMOAVUDciVfRtL2m8cv42ZJOXtPfDjsFOf8AKJk40/tc8mMMqZP7RVBr9RWOoq5 +y9D37NfI6UB8rPZ6qs0a1Vfm8lIh2/k1AFECduXgftMDTsmmXOgXXS37HukGW7AL +QKWiWJQF/XopkXwkyAYpyuyRMZ77oF7nuqLFnl5VVEiRo0Fwu45erebc6ccSwYZU +8pmeSx7s0aJtxCZPSZEKZ3mn0BXOR32Cgs48CjzFWf6PKucTwOy/YO0/4Gt/upNJ +3DyeINcYcKyD08DEIF9f5tLyoiD4xz+N23ltTBoMPyv4f3X/wCQ= +=ch7z +-----END PGP PUBLIC KEY BLOCK----- diff --git a/ci/codecov-wrapper b/ci/codecov-wrapper new file mode 100755 index 00000000..c345ae4e --- /dev/null +++ b/ci/codecov-wrapper @@ -0,0 +1,24 @@ +#!/bin/bash + +set -xe + +curl -Os https://uploader.codecov.io/latest/linux/codecov +curl -Os https://uploader.codecov.io/latest/linux/codecov.SHA256SUM +curl -Os https://uploader.codecov.io/latest/linux/codecov.SHA256SUM.sig + +sqv --keyring ci/codecov-keys.asc codecov.SHA256SUM.sig codecov.SHA256SUM +shasum -a 256 -c codecov.SHA256SUM + +chmod +x codecov + +if [[ "$CI_COMMIT_BRANCH" =~ ^pr- ]]; then + PR=${CI_COMMIT_BRANCH#pr-} + parents=$(git show -s --format='%P %ae') + if [ $(wc -w <<<"$parents") -eq 3 ] && [ "${parents##* }" = "fepitre-bot@qubes-os.org" ]; then + commit_sha=$(cut -f 2 -d ' ' <<<"${parents}") + else + commit_sha=$(git show -s --format='%H') + fi + exec ./codecov --pr "$PR" --sha "$commit_sha" "$@" +fi +exec ./codecov "$@" diff --git a/ci/coveragerc b/ci/coveragerc new file mode 100644 index 00000000..b31dc6eb --- /dev/null +++ b/ci/coveragerc @@ -0,0 +1,5 @@ +[run] +source = vmupdate +omit = + vmupdate/agent/* + vmupdate/tests/* diff --git a/ci/requirements.txt b/ci/requirements.txt new file mode 100644 index 00000000..925cf6e5 --- /dev/null +++ b/ci/requirements.txt @@ -0,0 +1,12 @@ +# WARNING: those requirements are used only for travis-ci.org +# they SHOULD NOT be used under normal conditions; use system package manager +docutils +pylint +sphinx +python-daemon +mock +lxml +PyYAML +xcffib +tqdm +pyxdg diff --git a/run-tests.sh b/run-tests.sh new file mode 100755 index 00000000..50616e6e --- /dev/null +++ b/run-tests.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +python3 -m coverage run -m pytest -vv vmupdate/tests