Set $HOME to the user's home directory in sync scripts #7758
Workflow file for this run
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: CI | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
unit-test: | |
runs-on: ubuntu-22.04 | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
steps: | |
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 | |
- name: Install | |
run: | | |
sudo apt-get update | |
sudo apt-get install pandoc python3-pytest | |
python3 -m pip install --upgrade setuptools wheel pip | |
python3 -m pip install mypy ruff | |
npm install -g pyright | |
- name: Run ruff | |
run: | | |
ruff --version | |
ruff mkosi/ tests/ kernel-install/50-mkosi.install | |
- name: Check that tabs are not used in code | |
run: sh -c '! git grep -P "\\t" "*.py"' | |
- name: Type Checking (mypy) | |
run: | | |
python3 -m mypy --version | |
python3 -m mypy mkosi/ tests/ kernel-install/50-mkosi.install | |
- name: Type Checking (pyright) | |
run: | | |
pyright --version | |
pyright mkosi/ tests/ kernel-install/50-mkosi.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: Test shell scripts | |
run: | | |
sudo apt-get update && sudo apt-get install --no-install-recommends shellcheck | |
bash -c 'shopt -s globstar; shellcheck bin/mkosi tools/*.sh' | |
- name: Test man page generation | |
run: pandoc -s mkosi.md -o mkosi.1 | |
integration-test: | |
runs-on: ubuntu-22.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 | |
- debian | |
- fedora | |
- opensuse | |
- ubuntu | |
# TODO: Add CentOS once they have systemd v254 or newer. | |
exclude: | |
# pacman and archlinux-keyring are 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 | |
# This combination results in rpm failing because of SIGPIPE. | |
# TODO: Try again once Arch gets a new rpm release. | |
- distro: centos | |
tools: arch | |
steps: | |
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 | |
- 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 | |
- name: Install | |
run: | | |
sudo apt-get update | |
sudo apt-get install python3-pytest lvm2 cryptsetup-bin btrfs-progs | |
# Make sure the latest changes from the pull request are used. | |
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 | |
Environment=SYSTEMD_REPART_MKFS_OPTIONS_EROFS="--quiet" | |
[Host] | |
QemuKvm=yes | |
EOF | |
# Work around for https://src.fedoraproject.org/rpms/grub2/pull-request/61 by disabling obsoletes. | |
tee mkosi/resources/mkosi-tools/mkosi.local.conf <<EOF | |
[Distribution] | |
PackageManagerTrees=mkosi.pkgmngr | |
EOF | |
mkdir -p mkosi/resources/mkosi-tools/mkosi.pkgmngr/etc/dnf | |
echo -e "[main]\nobsoletes=0" > mkosi/resources/mkosi-tools/mkosi.pkgmngr/etc/dnf/dnf.conf | |
# 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 | |
- name: Run integration tests | |
run: | | |
sudo --preserve-env \ | |
timeout -k 30 1h python3 -m pytest \ | |
--tb=no \ | |
--capture=no \ | |
--verbose \ | |
-m integration \ | |
--distribution ${{ matrix.distro }} \ | |
$([ "${{ matrix.distro }}" = "debian" ] && echo --release=unstable) \ | |
$([ "${{ matrix.tools }}" = "debian" ] && echo --tools-tree-release=unstable) \ | |
--tools-tree-distribution ${{ matrix.tools }} \ | |
tests/ |