Skip to content

Remove unneeded assert #10431

Remove unneeded assert

Remove unneeded assert #10431

Workflow file for this run

name: CI
on:
pull_request:
branches:
- main
jobs:
unit-test:
runs-on: ubuntu-24.04
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- name: Install
run: |
sudo apt-get install --assume-yes --no-install-recommends pandoc python3-pytest shellcheck
python3 -m pip install --break-system-packages --upgrade setuptools wheel pip
python3 -m pip install --break-system-packages codespell mypy reuse ruff
npm install -g pyright
- name: Run ruff check
run: |
ruff --version
ruff check mkosi/ tests/ kernel-install/*.install
- name: Run ruff format
run: |
ruff --version
if ! ruff format --check --quiet mkosi/ tests/ kernel-install/*.install
then
echo "Please run 'ruff format' on the above files or apply the diffs below manually"
ruff format --check --quiet --diff mkosi/ tests/ kernel-install/*.install
fi
- name: Check that tabs are not used in code
run: sh -c '! git grep -P "\\t" "*.py"'
- name: Spell Checking (codespell)
run: |
codespell --version
codespell
- name: License Checking (reuse)
run: |
reuse --version
reuse lint
- name: Type Checking (mypy)
run: |
python3 -m mypy --version
python3 -m mypy mkosi/ tests/ kernel-install/*.install
- name: Type Checking (pyright)
run: |
pyright --version
pyright mkosi/ tests/ kernel-install/*.install
- name: Unit Tests
run: |
python3 -m pytest --version
python3 -m pytest -sv tests/
- name: Test execution from current working directory
run: python3 -m mkosi -h
- name: Test execution from current working directory (sudo call)
run: sudo python3 -m mkosi -h
- name: Test venv installation
run: |
python3 -m venv testvenv
testvenv/bin/python3 -m pip install --upgrade setuptools wheel pip
testvenv/bin/python3 -m pip install .
testvenv/bin/mkosi -h
rm -rf testvenv
- name: Test editable venv installation
run: |
python3 -m venv testvenv
testvenv/bin/python3 -m pip install --upgrade setuptools wheel pip
testvenv/bin/python3 -m pip install --editable .
testvenv/bin/mkosi -h
rm -rf testvenv
- name: Test zipapp creation
run: |
./tools/generate-zipapp.sh
./builddir/mkosi -h
./builddir/mkosi documentation
- name: Run shellcheck on scripts
run: |
bash -c 'shopt -s globstar; shellcheck bin/mkosi tools/*.sh'
bin/mkosi completion bash | shellcheck -
- name: Test man page generation
run: tools/make-man-page.sh
integration-test:
runs-on: ubuntu-24.04
needs: unit-test
concurrency:
group: ${{ github.workflow }}-${{ matrix.distro }}-${{ matrix.tools }}-${{ github.ref }}
cancel-in-progress: true
strategy:
fail-fast: false
matrix:
distro:
- arch
- centos
- debian
- fedora
- opensuse
- ubuntu
tools:
- arch
- centos
- debian
- fedora
- opensuse
- ubuntu
exclude:
# pacman is not packaged in EPEL.
- distro: arch
tools: centos
# apt and debian-keyring are not packaged in EPEL.
- distro: debian
tools: centos
- distro: ubuntu
tools: centos
# pacman is not packaged in openSUSE.
- distro: arch
tools: opensuse
# apt, debian-keyring and ubuntu-keyring are not packaged in openSUSE.
- distro: debian
tools: opensuse
- distro: ubuntu
tools: opensuse
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- uses: ./
# Freeing up disk space with rm -rf can take multiple minutes. Since we don't need the extra free space
# immediately, we remove the files in the background. However, we first move them to a different location so that
# nothing tries to use anything in these directories anymore while we're busy deleting them.
- name: Free disk space
run: |
sudo mv /usr/local /usr/local.trash
sudo mv /opt/hostedtoolcache /opt/hostedtoolcache.trash
sudo systemd-run rm -rf /usr/local.trash /opt/hostedtoolcache.trash
# Make sure the latest changes from the pull request are used.
- name: Install
run: sudo ln -svf $PWD/bin/mkosi /usr/bin/mkosi
working-directory: ./
- name: Configure
run: |
tee mkosi.local.conf <<EOF
[Output]
ManifestFormat=json
[Content]
KernelCommandLine=systemd.default_device_timeout_sec=180
[Build]
ToolsTree=default
ToolsTreeDistribution=${{ matrix.tools }}
Environment=SYSTEMD_REPART_MKFS_OPTIONS_EROFS="--quiet"
[Runtime]
KVM=yes
EOF
# TODO: Remove once all distros have recent enough systemd that knows systemd.default_device_timeout_sec.
mkdir -p mkosi-initrd/mkosi.extra/usr/lib/systemd/system.conf.d
tee mkosi-initrd/mkosi.extra/usr/lib/systemd/system.conf.d/device-timeout.conf <<EOF
[Manager]
DefaultDeviceTimeoutSec=180
EOF
# fail if the script already exists, to avoid hard to debug CI errors
[[ -f mkosi.configure ]] && exit 1
tee mkosi.configure <<EOF
#!/bin/bash
echo "Hello from inside mkosi.configure!" >&2
cat
EOF
chmod +x mkosi.configure
# prepare and postinst are already used in CI
for script in sync build finalize postoutput clean
do
[[ -f "mkosi.${script}" ]] && exit 1
tee "mkosi.${script}" <<TOK
#!/bin/bash
echo "Hello from inside mkosi.${script}" >&2
TOK
chmod +x "mkosi.${script}"
done
- name: Build tools tree
run: sudo mkosi -f sandbox true
- name: Build image
run: sudo mkosi --distribution ${{ matrix.distro }} -f
- name: Run integration tests
run: |
sudo mkosi sandbox \
timeout -k 30 1h \
python3 -m pytest \
--tb=no \
--capture=no \
--verbose \
-m integration \
--distribution ${{ matrix.distro }} \
tests/