debian/test
¶
Configure jobs to test newly built Debian binary packages (.deb
).
Latest release¶
Description¶
This component creates multiple jobs, each with a common prefix, that take in newly built Debian binary packages (downloaded as artifacts of other jobs in the pipeline), bundle them into a local Apt repository, and install them before executing the user-specific test commands.
Usage¶
include:
- component: git.ligo.org/computing/gitlab/components/debian/test@<VERSION>
inputs:
test_script:
# sanity check executable installed from Debian package
- /usr/bin/my-script --help
Inputs¶
Input | Default value | Description |
---|---|---|
stage | test | The stage to add jobs to |
debian_versions | [bullseye, bookworm] | Debian/Ubuntu versions to test on, see Supported versions for details |
job_prefix | debian_test | Prefix to use for job name |
build_prefix | debian_build | Job name prefix used for build jobs on which to depend |
git_strategy | fetch | Value for GIT_STRATEGY |
test_install | "" | Packages to install to support the test_script |
test_script | Script commands to run as part of the debian test job |
Notes¶
Supported versions¶
See Supported versions in debian/build
for details.
Build image¶
See Build image in debian/build
for details.
Note that for debian/test
jobs, the default IGWN image is igwn/base
(not igwn/builder
).
Test jobs require matching jobs from debian/build
¶
debian/test
jobs are automatically configured with needs
referencing the job from debian/build
with the same debian_version
value. It is required that when configuring the debian/test
you also configure the debian/build
component.
See Examples for examples.
Test reports¶
The test jobs configured by debian/test
include artifacts:report
as follows:
artifacts:
reports:
# coverage report
coverage_report:
coverage_format: cobertura
path: coverage.xml
# test report
junit: "**/*junit*.xml"
paths:
- "**/.coverage*"
This is done to help projects automatically receive test reports and coverage information on merge request pages.
For projects that do not generate these reports, this will result in the following output at the end of the build log:
Uploading artifacts...
WARNING: coverage.xml: no matching files. Ensure that the artifact path is relative to the working directory (/builds/duncanmmacleod/component-debian)
ERROR: No files to upload
with the ERROR
line highlighted in red. These 'errors' are not fatal and can be safely ignored.
To remove the custom artifacts, override the artifacts setting for the debian_test
job configuration
debian_test: # (1)!
artifacts: null
- The
debian_test
job name should modified to match whatever you set as thejob_prefix
input when including thedebian/test
component.
Test jobs do not automatically install built packages¶
The debian/test
jobs find all Debian packages (.deb
) brought in as artifacts and bundle them into a local Apt repository. However, starting from version 2.0.0
of this component, the jobs configured by the debian/test
component do not automatically install any packages; this includes any packages included in the local Apt repository.
To ensure that built packages are installed for testing, include the appropriate package names in the test_install
input.
Examples¶
Build and test a Python application on Debian
include:
- component: git.ligo.org/computing/gitlab/components/python/sdist@0.1
inputs:
stage: source
- component: git.ligo.org/computing/gitlab/components/debian/build@<VERSION>
inputs:
needs: [sdist]
- component: git.ligo.org/computing/gitlab/components/debian/test@<VERSION>
inputs:
test_install: >-
python3
python3-mylibrary
python3-pytest
test_script:
- python3 -m pytest --pyargs my_library.tests