diff --git a/.ci/check_devices_in_wiki.py b/.ci/lib/check_devices_in_wiki.py similarity index 98% rename from .ci/check_devices_in_wiki.py rename to .ci/lib/check_devices_in_wiki.py index fb88eabc5..3f2d5c200 100755 --- a/.ci/check_devices_in_wiki.py +++ b/.ci/lib/check_devices_in_wiki.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -# Copyright 2021 Oliver Smith +# Copyright 2022 Oliver Smith # SPDX-License-Identifier: GPL-3.0-or-later import argparse @@ -13,7 +13,7 @@ def get_devices(): """:returns: list of all devices""" ret = [] pmaports = (os.path.realpath(os.path.join(os.path.dirname(__file__) + - "/.."))) + "/../.."))) for path in glob.glob(pmaports + "/device/*/device-*/"): device = os.path.dirname(path).split("device-", 1)[1] diff --git a/.ci/lib/gitlab_prepare_ci.sh b/.ci/lib/gitlab_prepare_ci.sh new file mode 100755 index 000000000..fe48d8974 --- /dev/null +++ b/.ci/lib/gitlab_prepare_ci.sh @@ -0,0 +1,17 @@ +#!/bin/sh -e +# Copyright 2022 Oliver Smith +# SPDX-License-Identifier: GPL-3.0-or-later + +if ! mount | grep -q /proc/sys/fs/binfmt_misc; then + echo "Mounting binfmt_misc" + mount -t binfmt_misc none /proc/sys/fs/binfmt_misc +fi + +if id "build" > /dev/null 2>&1; then + echo "User 'build' exists already" +else + echo "Creating build user" + adduser -D build + chown -R build:build . + echo 'build ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers +fi diff --git a/.ci/wiki.sh b/.ci/wiki.sh new file mode 100755 index 000000000..b436defcb --- /dev/null +++ b/.ci/wiki.sh @@ -0,0 +1,15 @@ +#!/bin/sh -e +# Description: verify devices are documented in the wiki +# Options: native +# Run natively so we don't need to set up a chroot, python3 is the only dep. +# https://postmarktos.org/pmb-ci + +if [ "$(id -u)" = 0 ]; then + set -x + apk -q add \ + python3 + exec su "${TESTUSER:-build}" -c "sh -e $0" +fi + +set -x +.ci/lib/check_devices_in_wiki.py --booting diff --git a/.gitignore b/.gitignore index 756c204bd..9955160bd 100644 --- a/.gitignore +++ b/.gitignore @@ -20,7 +20,6 @@ dist/ downloads/ eggs/ .eggs/ -lib/ lib64/ parts/ sdist/ diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6aa70c72f..e9173e495 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -31,10 +31,9 @@ wiki: - merge_requests changes: - device/*/device-*/* - before_script: - - apk -q add python3 script: - - .ci/check_devices_in_wiki.py --booting + - .ci/lib/gitlab_prepare_ci.sh + - .ci/wiki.sh # testcases linting testcases-linting: