sources: skip ostree tests if no ostree binary if found #903
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
name: Tests | |
on: [pull_request, push] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
env: | |
# Share the store between the workers speeds things up further | |
OSBUILD_TEST_STORE: /var/tmp/osbuild-test-store | |
jobs: | |
test_suite: | |
name: "Unittest" | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
test: | |
- parallel | |
- normal | |
environment: | |
- "py36" # RH8 | |
- "py39" # RH9 | |
- "py313" # latest fedora | |
steps: | |
- name: "Clone Repository" | |
uses: actions/checkout@v4 | |
- name: "Run" | |
uses: osbuild/containers/src/actions/privdocker@552e30cf1b4ed19c6ddaa57f96c342b3dff4227b | |
with: | |
image: ghcr.io/osbuild/osbuild-ci:latest-202411221033 | |
run: | | |
# Hacky replacement of container storage driver: | |
# The default overlayfs doesn't work in the runner, so let's change | |
# it to vfs for the local storage skopeo stage test. | |
sed -i 's/overlay/vfs/g' /usr/share/containers/storage.conf # default system config | |
sed -i 's/overlay/vfs/g' /etc/containers/storage.conf || true # potential overrides | |
if [ "${{ matrix.test }}" == "parallel" ]; then | |
# 4 is a bit arbitrary | |
TEST_WORKERS="-n 4" | |
TEST_CATEGORY="test_stages.py" | |
else | |
# test_assemblers.py is run below | |
TEST_CATEGORY="not test_stages.py and not test_assemblers.py" | |
# DNF python package can't be installed using pip in the tox environment. | |
# We need to use the version from the system to test things. | |
# Since we are running tests on Fedora, enable site packages only | |
# for Python version which is available on Fedora. | |
# See also: https://github.com/osbuild/containers/pull/79 | |
if [ "${{ matrix.environment }}" == "$(cat /osb/libdnf-python-version)" ]; then | |
TOX_ARGS="-x testenv.sitepackages=True" | |
fi | |
fi | |
OSBUILD_TEST_STORE="${{ env.OSBUILD_TEST_STORE }}" \ | |
tox -e "${{ matrix.environment }}" $TOX_ARGS -- -rs $TEST_WORKERS -k "$TEST_CATEGORY" | |
v1_manifests: | |
name: "Assembler test (legacy)" | |
runs-on: ubuntu-latest | |
steps: | |
- name: "Clone Repository" | |
uses: actions/checkout@v4 | |
- name: "Run" | |
uses: osbuild/containers/src/actions/privdocker@552e30cf1b4ed19c6ddaa57f96c342b3dff4227b | |
env: | |
# Using 4 workers is a bit arbitrary, "auto" is probably too aggressive. | |
TEST_WORKERS: "-n 4" | |
with: | |
image: ghcr.io/osbuild/osbuild-ci:latest-202411221033 | |
run: | | |
OSBUILD_TEST_STORE="${{ env.OSBUILD_TEST_STORE }}" \ | |
tox -e "py36" -- ${{ env.TEST_WORKERS }} test.run.test_assemblers | |
# This smoke test runs the unit tests directly on the runner and as a | |
# normal user - it is fast (2min) and should detect obvious issues | |
# (like from pr#1942) | |
unittests_as_user_smoke: | |
name: "Smoke run: unittest as normal user on default runner" | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
# The test_host.py:test_signals_on_separate_fd runs itself but that | |
# run will happen without the tox env so a pip/tox installed pytest | |
# will not be found, install the pytest package as a workaround | |
- run: sudo apt install -y tox python3-pytest | |
- name: "Run as user on default runer" | |
# Run with -n 16 as depsolve tests tend to be slow but fast when | |
# parallized, the runtime is around 1-2min with this setup. | |
run: | | |
tox -e py312 -- -n 16 |