CI: adjust .ci/common.py users to pmbootstrap ci (MR 3608)
Adjust all CI scripts that make use of .ci/common.py to 'pmbootstrap ci'. Move all scripts that are not direct entry points to running CI scripts to .ci/lib. Comment out the dtb check, as it is failing. Apparently it didn't run properly before. Let's fix this after this CI change is done.
This commit is contained in:
parent
8f78988b33
commit
da52dace85
19 changed files with 114 additions and 37 deletions
22
.ci/apkbuild-lint.sh
Executable file
22
.ci/apkbuild-lint.sh
Executable file
|
@ -0,0 +1,22 @@
|
||||||
|
#!/bin/sh -e
|
||||||
|
# Description: run apkbuild-lint on modified APKBUILDs
|
||||||
|
# Options: native
|
||||||
|
# Use 'native' because it requires git commit history.
|
||||||
|
# https://postmarktos.org/pmb-ci
|
||||||
|
|
||||||
|
if [ "$(id -u)" = 0 ]; then
|
||||||
|
set -x
|
||||||
|
wget "https://gitlab.com/postmarketOS/ci-common/-/raw/master/install_pmbootstrap.sh"
|
||||||
|
sh ./install_pmbootstrap.sh
|
||||||
|
exec su "${TESTUSER:-pmos}" -c "sh -e $0"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Wrap pmbootstrap to use this repository for --aports
|
||||||
|
pmaports="$(cd $(dirname $0)/..; pwd -P)"
|
||||||
|
_pmbootstrap="$(command -v pmbootstrap)"
|
||||||
|
pmbootstrap() {
|
||||||
|
"$_pmbootstrap" --aports="$pmaports" "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
.ci/lib/apkbuild_linting.py
|
||||||
|
|
1
.ci/build-aarch64.sh
Symbolic link
1
.ci/build-aarch64.sh
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
lib/build_changed_aports.sh
|
1
.ci/build-armhf.sh
Symbolic link
1
.ci/build-armhf.sh
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
lib/build_changed_aports.sh
|
1
.ci/build-armv7.sh
Symbolic link
1
.ci/build-armv7.sh
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
lib/build_changed_aports.sh
|
1
.ci/build-riscv64.sh
Symbolic link
1
.ci/build-riscv64.sh
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
lib/build_changed_aports.sh
|
1
.ci/build-x86.sh
Symbolic link
1
.ci/build-x86.sh
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
lib/build_changed_aports.sh
|
1
.ci/build-x86_64.sh
Symbolic link
1
.ci/build-x86_64.sh
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
lib/build_changed_aports.sh
|
|
@ -1,8 +0,0 @@
|
||||||
#!/bin/sh -e
|
|
||||||
# Convenience wrapper for short arch-specific build jobs in .gitlab-ci.yml
|
|
||||||
|
|
||||||
export PYTHONUNBUFFERED=1
|
|
||||||
JOB_ARCH="${CI_JOB_NAME#build-}"
|
|
||||||
|
|
||||||
set -x
|
|
||||||
su pmos -c ".ci/build_changed_aports.py $JOB_ARCH"
|
|
|
@ -1,7 +0,0 @@
|
||||||
#!/bin/sh -e
|
|
||||||
|
|
||||||
if grep -r 'INSTALL_DTBS_PATH="$pkgdir"/usr/share/dtb'; then
|
|
||||||
echo 'Please do not install dtbs to /usr/share/dtb!'
|
|
||||||
echo 'Unless you have a good reason not to, please put them in /boot/dtbs'
|
|
||||||
exit 1
|
|
||||||
fi
|
|
20
.ci/commits.sh
Executable file
20
.ci/commits.sh
Executable file
|
@ -0,0 +1,20 @@
|
||||||
|
#!/bin/sh -e
|
||||||
|
# Copyright 2022 Oliver Smith
|
||||||
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
# Description: check pkgver/pkgrel bumps, amount of changed pkgs etc
|
||||||
|
# Options: native
|
||||||
|
# Use 'native' because it requires git commit history.
|
||||||
|
# https://postmarktos.org/pmb-ci
|
||||||
|
|
||||||
|
if [ "$(id -u)" = 0 ]; then
|
||||||
|
set -x
|
||||||
|
# In .gitlab-ci.yml currently .ci/pytest.sh runs before this and
|
||||||
|
# already downloads and runs install_pmbootstrap.sh.
|
||||||
|
if ! [ -e install_pmbootstrap.sh ]; then
|
||||||
|
wget "https://gitlab.com/postmarketOS/ci-common/-/raw/master/install_pmbootstrap.sh"
|
||||||
|
sh ./install_pmbootstrap.sh
|
||||||
|
fi
|
||||||
|
exec su "${TESTUSER:-pmos}" -c "sh -e $0"
|
||||||
|
fi
|
||||||
|
|
||||||
|
.ci/lib/check_changed_aports_versions.py
|
|
@ -14,3 +14,11 @@ if grep -qr '(CHANGEME!)' *; then
|
||||||
grep --color=always -r '(CHANGEME!)' *
|
grep --color=always -r '(CHANGEME!)' *
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# DTBs installed to /usr/share/db
|
||||||
|
# FIXME: doesn't pass currently, fix it and enable it afterwards
|
||||||
|
# if grep -r 'INSTALL_DTBS_PATH="$pkgdir"/usr/share/dtb'; then
|
||||||
|
# echo 'Please do not install dtbs to /usr/share/dtb!'
|
||||||
|
# echo 'Unless you have a good reason not to, please put them in /boot/dtbs'
|
||||||
|
# exit 1
|
||||||
|
# fi
|
||||||
|
|
1
.ci/lib/add_pmbootstrap_to_import_path
Symbolic link
1
.ci/lib/add_pmbootstrap_to_import_path
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
../testcases/add_pmbootstrap_to_import_path
|
|
@ -7,7 +7,7 @@ import sys
|
||||||
import common
|
import common
|
||||||
|
|
||||||
# pmbootstrap
|
# pmbootstrap
|
||||||
import testcases.add_pmbootstrap_to_import_path
|
import add_pmbootstrap_to_import_path
|
||||||
import pmb.parse
|
import pmb.parse
|
||||||
import pmb.parse._apkbuild
|
import pmb.parse._apkbuild
|
||||||
import pmb.helpers.pmaports
|
import pmb.helpers.pmaports
|
19
.ci/lib/build_changed_aports.sh
Executable file
19
.ci/lib/build_changed_aports.sh
Executable file
|
@ -0,0 +1,19 @@
|
||||||
|
#!/bin/sh -e
|
||||||
|
# Description: build modified packages for this architecture
|
||||||
|
# Options: native slow
|
||||||
|
# https://postmarktos.org/pmb-ci
|
||||||
|
|
||||||
|
if [ "$(id -u)" = 0 ]; then
|
||||||
|
set -x
|
||||||
|
wget "https://gitlab.com/postmarketOS/ci-common/-/raw/master/install_pmbootstrap.sh"
|
||||||
|
sh ./install_pmbootstrap.sh
|
||||||
|
exec su "${TESTUSER:-pmos}" -c "sh -e $0"
|
||||||
|
fi
|
||||||
|
|
||||||
|
export PYTHONUNBUFFERED=1
|
||||||
|
|
||||||
|
# Get the architecture from the symlink we are running
|
||||||
|
arch="$(echo "$0" | cut -d '-' -f 2 | cut -d '.' -f 1)"
|
||||||
|
|
||||||
|
set -x
|
||||||
|
.ci/lib/build_changed_aports.py "$arch"
|
|
@ -11,7 +11,7 @@ import subprocess
|
||||||
import common
|
import common
|
||||||
|
|
||||||
# pmbootstrap
|
# pmbootstrap
|
||||||
import testcases.add_pmbootstrap_to_import_path # noqa
|
import add_pmbootstrap_to_import_path # noqa
|
||||||
import pmb.parse
|
import pmb.parse
|
||||||
import pmb.parse.version
|
import pmb.parse.version
|
||||||
import pmb.helpers.logging
|
import pmb.helpers.logging
|
|
@ -17,7 +17,7 @@ def get_pmaports_dir():
|
||||||
global cache
|
global cache
|
||||||
if "pmaports_dir" in cache:
|
if "pmaports_dir" in cache:
|
||||||
return cache["pmaports_dir"]
|
return cache["pmaports_dir"]
|
||||||
ret = os.path.realpath(os.path.join(os.path.dirname(__file__) + "/.."))
|
ret = os.path.realpath(os.path.join(os.path.dirname(__file__) + "/../.."))
|
||||||
cache["pmaports_dir"] = ret
|
cache["pmaports_dir"] = ret
|
||||||
return ret
|
return ret
|
||||||
|
|
|
@ -1,10 +1,21 @@
|
||||||
#!/bin/sh -e
|
#!/bin/sh -e
|
||||||
# Copyright 2021 Oliver Smith
|
# Copyright 2022 Oliver Smith
|
||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
# Description: lint with various python tests
|
||||||
|
# Options: native
|
||||||
|
# Use 'native' because it requires pmbootstrap.
|
||||||
|
# https://postmarktos.org/pmb-ci
|
||||||
|
|
||||||
# Require pmbootstrap
|
if [ "$(id -u)" = 0 ]; then
|
||||||
if ! command -v pmbootstrap > /dev/null; then
|
set -x
|
||||||
echo "ERROR: pmbootstrap needs to be installed."
|
wget "https://gitlab.com/postmarketOS/ci-common/-/raw/master/install_pmbootstrap.sh"
|
||||||
|
sh ./install_pmbootstrap.sh pytest
|
||||||
|
exec su "${TESTUSER:-pmos}" -c "sh -e $0"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Require pytest to be installed on the host system
|
||||||
|
if [ -z "$(command -v pytest)" ]; then
|
||||||
|
echo "ERROR: pytest command not found, make sure it is in your PATH."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -70,16 +70,13 @@ editor-config:
|
||||||
- .ci/ec.sh
|
- .ci/ec.sh
|
||||||
|
|
||||||
# aports checks (generic)
|
# aports checks (generic)
|
||||||
aports-static:
|
pytest-commits:
|
||||||
stage: lint
|
stage: lint
|
||||||
<<: *only-default
|
<<: *only-default
|
||||||
before_script:
|
|
||||||
- wget "https://gitlab.com/postmarketOS/ci-common/-/raw/master/install_pmbootstrap.sh"
|
|
||||||
- sh ./install_pmbootstrap.sh pytest
|
|
||||||
script:
|
script:
|
||||||
- su pmos -c ".ci/run_testcases.sh"
|
- .ci/lib/gitlab_prepare_ci.sh
|
||||||
- su pmos -c ".ci/check_changed_aports_versions.py"
|
- .ci/pytest.sh
|
||||||
- su pmos -c ".ci/check-dtb-install-location.sh"
|
- .ci/commits.sh
|
||||||
artifacts:
|
artifacts:
|
||||||
when: on_failure
|
when: on_failure
|
||||||
paths:
|
paths:
|
||||||
|
@ -103,11 +100,9 @@ distfile-check:
|
||||||
# APKBUILD linting
|
# APKBUILD linting
|
||||||
aport-lint:
|
aport-lint:
|
||||||
stage: lint
|
stage: lint
|
||||||
before_script:
|
|
||||||
- wget "https://gitlab.com/postmarketOS/ci-common/-/raw/master/install_pmbootstrap.sh"
|
|
||||||
- sh ./install_pmbootstrap.sh
|
|
||||||
script:
|
script:
|
||||||
- su pmos -c ".ci/apkbuild-linting.py"
|
- .ci/lib/gitlab_prepare_ci.sh
|
||||||
|
- .ci/apkbuild-lint.sh
|
||||||
only:
|
only:
|
||||||
- merge_requests
|
- merge_requests
|
||||||
allow_failure: true
|
allow_failure: true
|
||||||
|
@ -145,10 +140,8 @@ mr-settings:
|
||||||
stage: build
|
stage: build
|
||||||
<<: *only-default
|
<<: *only-default
|
||||||
before_script:
|
before_script:
|
||||||
- wget "https://gitlab.com/postmarketOS/ci-common/-/raw/master/install_pmbootstrap.sh"
|
- .ci/lib/gitlab_prepare_ci.sh
|
||||||
- sh ./install_pmbootstrap.sh
|
after_script:
|
||||||
script:
|
|
||||||
- .ci/build.sh
|
|
||||||
- cp -r /home/pmos/.local/var/pmbootstrap/packages/ packages/ || true
|
- cp -r /home/pmos/.local/var/pmbootstrap/packages/ packages/ || true
|
||||||
artifacts:
|
artifacts:
|
||||||
expire_in: 1 week
|
expire_in: 1 week
|
||||||
|
@ -158,18 +151,30 @@ mr-settings:
|
||||||
|
|
||||||
build-x86_64:
|
build-x86_64:
|
||||||
extends: .build
|
extends: .build
|
||||||
|
script:
|
||||||
|
- .ci/build-x86_64.sh
|
||||||
|
|
||||||
build-x86:
|
build-x86:
|
||||||
extends: .build
|
extends: .build
|
||||||
|
script:
|
||||||
|
- .ci/build-x86.sh
|
||||||
|
|
||||||
build-aarch64:
|
build-aarch64:
|
||||||
extends: .build
|
extends: .build
|
||||||
|
script:
|
||||||
|
- .ci/build-aarch64.sh
|
||||||
|
|
||||||
build-armv7:
|
build-armv7:
|
||||||
extends: .build
|
extends: .build
|
||||||
|
script:
|
||||||
|
- .ci/build-armv7.sh
|
||||||
|
|
||||||
build-armhf:
|
build-armhf:
|
||||||
extends: .build
|
extends: .build
|
||||||
|
script:
|
||||||
|
- .ci/build-armhf.sh
|
||||||
|
|
||||||
build-riscv64:
|
build-riscv64:
|
||||||
extends: .build
|
extends: .build
|
||||||
|
script:
|
||||||
|
- .ci/build-riscv64.sh
|
||||||
|
|
Loading…
Reference in a new issue