Compare commits
4
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
234d57d512 | ||
|
|
4ad661057c | ||
|
|
4a46552bd5 | ||
|
|
663e7c3dfc |
No files matched your search
+1
-6
@@ -8,12 +8,7 @@
|
||||
|
||||
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.postmarketos.org/postmarketOS/ci-common/-/raw/master/install_pmbootstrap.sh"
|
||||
sh ./install_pmbootstrap.sh
|
||||
fi
|
||||
|
||||
exec su "${TESTUSER:-pmos}" -c "sh -e $0"
|
||||
fi
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
|
||||
if [ "$(id -u)" = 0 ]; then
|
||||
set -x
|
||||
wget "https://gitlab.postmarketos.org/postmarketOS/ci-common/-/raw/master/install_pmbootstrap.sh"
|
||||
sh ./install_pmbootstrap.sh pytest
|
||||
exec su "${TESTUSER:-pmos}" -c "sh -e $0"
|
||||
fi
|
||||
|
||||
+2
-151
@@ -8,8 +8,7 @@ after_script:
|
||||
- .ci/lib/move_logs.sh $CI_PROJECT_DIR
|
||||
stages:
|
||||
- lint
|
||||
- build
|
||||
- autoupdate
|
||||
|
||||
|
||||
# This defines the rules for when a pipeline should run.
|
||||
workflow:
|
||||
@@ -22,61 +21,14 @@ workflow:
|
||||
# Run scheduled pipeline for autoupdate or manually triggered pipeline
|
||||
- if: $CI_PIPELINE_SOURCE == "schedule" || $CI_PIPELINE_SOURCE == "web"
|
||||
|
||||
# device documentation
|
||||
wiki:
|
||||
stage: lint
|
||||
rules:
|
||||
- if: $CI_PIPELINE_SOURCE == "merge_request_event" || $CI_COMMIT_REF_PROTECTED == "false"
|
||||
changes:
|
||||
- .ci/**/*
|
||||
- .gitlab-ci.yml
|
||||
- device/*/device-*/*
|
||||
script:
|
||||
- .ci/lib/gitlab_prepare_ci.sh
|
||||
- .ci/wiki.sh
|
||||
|
||||
# testcases linting
|
||||
ruff:
|
||||
stage: lint
|
||||
rules:
|
||||
- if: $CI_PIPELINE_SOURCE == "merge_request_event" || $CI_COMMIT_REF_PROTECTED == "false"
|
||||
changes:
|
||||
- .ci/*
|
||||
- .ci/*/*
|
||||
- .gitlab-ci.yml
|
||||
script:
|
||||
- .ci/lib/gitlab_prepare_ci.sh
|
||||
- .ci/ruff.sh
|
||||
|
||||
# shellcheck and various grep checks
|
||||
shellcheck-grep:
|
||||
stage: lint
|
||||
image: alpine:edge
|
||||
rules:
|
||||
- if: $CI_PIPELINE_SOURCE == "merge_request_event" || $CI_COMMIT_REF_PROTECTED == "false"
|
||||
script:
|
||||
- .ci/lib/gitlab_prepare_ci.sh
|
||||
- .ci/shellcheck.sh
|
||||
- .ci/grep.sh
|
||||
- .ci/codeowners.sh
|
||||
|
||||
editor-config:
|
||||
stage: lint
|
||||
image: alpine:edge
|
||||
rules:
|
||||
- if: $CI_PIPELINE_SOURCE == "merge_request_event" || $CI_COMMIT_REF_PROTECTED == "false"
|
||||
script:
|
||||
- .ci/lib/gitlab_prepare_ci.sh
|
||||
- .ci/ec.sh
|
||||
|
||||
# aports checks (generic)
|
||||
pytest-commits:
|
||||
stage: lint
|
||||
rules:
|
||||
- if: $CI_PIPELINE_SOURCE == "merge_request_event" || $CI_COMMIT_REF_PROTECTED == "false"
|
||||
script:
|
||||
- .ci/lib/gitlab_prepare_ci.sh
|
||||
- .ci/pytest.sh
|
||||
- .ci/lib/gitlab_prepare_ci.sh
|
||||
- .ci/commits.sh
|
||||
artifacts:
|
||||
when: on_failure
|
||||
@@ -85,104 +37,3 @@ pytest-commits:
|
||||
- log_testsuite_pmaports.txt
|
||||
- pmbootstrap.cfg
|
||||
expire_in: 1 week
|
||||
|
||||
# APKBUILD linting
|
||||
aport-lint:
|
||||
stage: lint
|
||||
rules:
|
||||
- if: $CI_PIPELINE_SOURCE == "merge_request_event" || $CI_COMMIT_REF_PROTECTED == "false"
|
||||
script:
|
||||
- .ci/lib/gitlab_prepare_ci.sh
|
||||
- .ci/apkbuild-lint.sh
|
||||
allow_failure: true
|
||||
|
||||
# kernel kconfig check
|
||||
kernel-kconfig:
|
||||
stage: lint
|
||||
rules:
|
||||
- if: $CI_PIPELINE_SOURCE == "merge_request_event" || $CI_COMMIT_REF_PROTECTED == "false"
|
||||
changes:
|
||||
- kconfigcheck.toml
|
||||
- device/*/linux-*/config-*
|
||||
- main/linux-*/config-*
|
||||
script:
|
||||
- .ci/lib/gitlab_prepare_ci.sh
|
||||
- .ci/kconfig.sh
|
||||
|
||||
# MR settings
|
||||
# (Checks for "Allow commits from members who can merge to the target branch")
|
||||
mr-settings:
|
||||
stage: lint
|
||||
rules:
|
||||
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
||||
before_script:
|
||||
- *global_before_scripts
|
||||
- apk -q add python3
|
||||
script:
|
||||
- wget -q "https://gitlab.postmarketos.org/postmarketOS/ci-common/-/raw/master/check_mr_settings.py"
|
||||
- python3 ./check_mr_settings.py
|
||||
|
||||
# build changed aports
|
||||
.build:
|
||||
stage: build
|
||||
rules:
|
||||
- if: $CI_PIPELINE_SOURCE == "merge_request_event" || $CI_COMMIT_REF_PROTECTED == "false"
|
||||
before_script:
|
||||
- *global_before_scripts
|
||||
- .ci/lib/gitlab_prepare_ci.sh
|
||||
after_script:
|
||||
- cp -r /home/pmos/.local/var/pmbootstrap/packages/ packages/ || true
|
||||
artifacts:
|
||||
expire_in: 1 week
|
||||
paths:
|
||||
- packages/
|
||||
timeout: 10 h
|
||||
|
||||
build-x86_64:
|
||||
extends: .build
|
||||
script:
|
||||
- .ci/build-x86_64.sh
|
||||
|
||||
build-x86:
|
||||
extends: .build
|
||||
script:
|
||||
- .ci/build-x86.sh
|
||||
|
||||
build-aarch64:
|
||||
extends: .build
|
||||
script:
|
||||
- .ci/build-aarch64.sh
|
||||
|
||||
build-armv7:
|
||||
extends: .build
|
||||
script:
|
||||
- .ci/build-armv7.sh
|
||||
|
||||
build-armhf:
|
||||
extends: .build
|
||||
script:
|
||||
- .ci/build-armhf.sh
|
||||
|
||||
build-riscv64:
|
||||
extends: .build
|
||||
script:
|
||||
- .ci/build-riscv64.sh
|
||||
|
||||
auto-update:
|
||||
stage: autoupdate
|
||||
rules:
|
||||
# This variable is set in the scheduled pipeline configuration. It should be a space separated list of
|
||||
# package names to update.
|
||||
- if: $AUTOUPDATE_PACKAGES != null && $CI_PIPELINE_SOURCE == "schedule" || $CI_PIPELINE_SOURCE == "web"
|
||||
before_script:
|
||||
- .ci/lib/gitlab_prepare_ci.sh
|
||||
script:
|
||||
- .ci/autoupdate.sh "$AUTOUPDATE_PACKAGES"
|
||||
after_script:
|
||||
- .ci/lib/move_logs.sh $CI_PROJECT_DIR
|
||||
artifacts:
|
||||
when: on_failure
|
||||
paths:
|
||||
- log.txt
|
||||
- log_testsuite_pmaports.txt
|
||||
- pmbootstrap.cfg
|
||||
Executable
+137
@@ -0,0 +1,137 @@
|
||||
#!/bin/sh -e
|
||||
# Copyright 2020 Oliver Smith
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
# usage: install_pmbootstrap.sh [ADDITIONAL_PACKAGE, ...]
|
||||
|
||||
: "${PMBOOTSTRAP_TAG:="master"}"
|
||||
: "${PMBOOTSTRAP_URL:="https://gitlab.postmarketos.org/postmarketOS/pmbootstrap.git"}"
|
||||
|
||||
# Add the "origin-original" remote to an existing pmaports.git clone, so
|
||||
# pmbootstrap can use its channels.cfg.
|
||||
add_remote_origin_original() {
|
||||
# Skip if existing (happens in single runner setup)
|
||||
remote_url="https://gitlab.postmarketos.org/postmarketOS/pmaports.git"
|
||||
remote_url_existing="$(git -C "$pmaports" \
|
||||
remote get-url origin-original 2>/dev/null \
|
||||
|| true)"
|
||||
if [ "$remote_url" = "$remote_url_existing" ]; then
|
||||
echo "Remote 'origin-original' is already configured"
|
||||
git -C "$pmaports" fetch -q origin-original
|
||||
return
|
||||
fi
|
||||
|
||||
# Mark pmaports dir as 'safe directory', so git doesn't complain about
|
||||
# it being owned by another user.
|
||||
git config --global --add safe.directory "$pmaports"
|
||||
su pmos -c "git config --global --add safe.directory '$pmaports'"
|
||||
|
||||
# Add the remote, display the output only on error
|
||||
if ! git -C "$pmaports" \
|
||||
remote add -f origin-original \
|
||||
"https://gitlab.postmarketos.org/postmarketOS/pmaports.git" \
|
||||
>/tmp/git_remote_add 2>&1; then
|
||||
echo "ERROR: failed to add original remote with git!"
|
||||
echo
|
||||
cat /tmp/git_remote_add
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Make sure everyone can write to the repo later, since CI runs as several different users (root, TESTUSER/pmos, build)
|
||||
chmod -R go+w "$pmaports/.git"
|
||||
}
|
||||
|
||||
# Set up depends
|
||||
depends="
|
||||
coreutils
|
||||
git
|
||||
losetup
|
||||
openssl
|
||||
procps
|
||||
python3
|
||||
sudo
|
||||
$*
|
||||
"
|
||||
printf "Installing dependencies:"
|
||||
for i in $depends; do
|
||||
printf "%s" " $i"
|
||||
done
|
||||
printf "\n"
|
||||
# shellcheck disable=SC2086
|
||||
apk -q add $depends
|
||||
|
||||
# Force IPv4 for gitlab.postmarketos.org until it supports IPv6 too, OSUOSL is
|
||||
# working on it (infra#195)
|
||||
echo "140.211.167.182 gitlab.postmarketos.org" >> /etc/hosts
|
||||
|
||||
# Set up binfmt_misc
|
||||
if ! mount | grep -q /proc/sys/fs/binfmt_misc; then
|
||||
mount -t binfmt_misc none /proc/sys/fs/binfmt_misc
|
||||
fi
|
||||
|
||||
# Create pmos user
|
||||
if id "pmos" > /dev/null 2>&1; then
|
||||
echo "User 'pmos' exists already"
|
||||
else
|
||||
echo "Creating pmos user"
|
||||
adduser -D pmos
|
||||
chown -R pmos:pmos .
|
||||
echo 'pmos ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
|
||||
fi
|
||||
|
||||
# pmaports: either checked out in current dir, or let pmbootstrap download it
|
||||
pmaports="$(cd "$(dirname "$0")"; pwd -P)"
|
||||
pmaports_arg=""
|
||||
if [ -e "$pmaports/pmaports.cfg" ]; then
|
||||
CFG="pmbootstrap_v3.cfg"
|
||||
if [ "$PMBOOTSTRAP_TAG" = "2.3.x" ]; then
|
||||
CFG="pmbootstrap.cfg"
|
||||
fi
|
||||
echo "pmbootstrap config file: $CFG"
|
||||
|
||||
echo "Found pmaports.cfg in current dir"
|
||||
pmaports_arg="--aports '$pmaports'"
|
||||
|
||||
add_remote_origin_original
|
||||
|
||||
# Use the channel of the current branch
|
||||
mkdir -p ~pmos/.config
|
||||
|
||||
( echo "[pmbootstrap]"
|
||||
echo "is_default_channel = False" ) > ~pmos/.config/"$CFG"
|
||||
chown -R pmos:pmos ~pmos/.config
|
||||
fi
|
||||
|
||||
# Download pmbootstrap (to /tmp/pmbootstrap)
|
||||
echo "Downloading pmbootstrap ($PMBOOTSTRAP_TAG): $PMBOOTSTRAP_URL"
|
||||
cd /tmp
|
||||
rm -rf pmbootstrap
|
||||
git clone -q "$PMBOOTSTRAP_URL" pmbootstrap
|
||||
git -C pmbootstrap checkout -q "$PMBOOTSTRAP_TAG"
|
||||
|
||||
# Install to $PATH and init
|
||||
ln -sf /tmp/pmbootstrap/pmbootstrap.py /usr/local/bin/pmbootstrap
|
||||
echo "Initializing pmbootstrap"
|
||||
if ! su pmos -c "yes '' | pmbootstrap \
|
||||
$pmaports_arg \
|
||||
--details-to-stdout \
|
||||
init \
|
||||
>/tmp/pmb_init 2>&1"; then
|
||||
cat /tmp/pmb_init
|
||||
echo
|
||||
echo "ERROR: pmbootstrap init failed!"
|
||||
echo
|
||||
echo "Most likely, this gets fixed by rebasing on master (or whatever"
|
||||
echo "branch yours is based on). Please do this and try again."
|
||||
echo
|
||||
echo "Let us know in the chat or issues if you have trouble with that"
|
||||
echo "and we will be happy to help. Sorry for the inconvenience."
|
||||
exit 1
|
||||
fi
|
||||
echo ""
|
||||
|
||||
# Workaround for pmb#2412: currently the pmaports_arg gets ignored in pmb v3,
|
||||
# so let pmbootstrap clone pmaports in the default dir during init, then change
|
||||
# the pmaports path to the one from the current merge request.
|
||||
if [ "$PMBOOTSTRAP_TAG" != "2.3.x" ] && [ -n "$pmaports_arg" ]; then
|
||||
su - pmos -c "pmbootstrap config aports '$pmaports'"
|
||||
fi
|
||||
Reference in new issue
Block a user