mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
CI: Global refactor, yunohost-ci v2 ready
This commit is contained in:
parent
09ebed1d0b
commit
1abdf16b84
5 changed files with 203 additions and 251 deletions
262
.gitlab-ci.yml
262
.gitlab-ci.yml
|
@ -1,260 +1,20 @@
|
||||||
stages:
|
stages:
|
||||||
- build
|
- build
|
||||||
- install
|
- install
|
||||||
- postinstall
|
|
||||||
- tests
|
- tests
|
||||||
- lint
|
- lint
|
||||||
|
|
||||||
########################################
|
default:
|
||||||
# BUILD DEB
|
tags:
|
||||||
########################################
|
- yunohost-ci
|
||||||
|
# All jobs are interruptible by default
|
||||||
|
interruptible: true
|
||||||
|
|
||||||
.build-stage:
|
variables:
|
||||||
image: before-install
|
|
||||||
stage: build
|
|
||||||
variables:
|
|
||||||
YNH_BUILD_DIR: "ynh-build"
|
YNH_BUILD_DIR: "ynh-build"
|
||||||
YNH_SOURCE: "https://github.com/yunohost"
|
|
||||||
before_script:
|
|
||||||
- DEBIAN_FRONTEND=noninteractive apt --assume-yes -o Dpkg::Options::="--force-confold" install git git-buildpackage postfix python-setuptools
|
|
||||||
- mkdir -p $YNH_BUILD_DIR
|
|
||||||
cache:
|
|
||||||
paths:
|
|
||||||
- $YNH_BUILD_DIR/*.deb
|
|
||||||
key: "$CI_PIPELINE_ID"
|
|
||||||
|
|
||||||
.build_script: &build_script |
|
include:
|
||||||
cd $YNH_BUILD_DIR/$PACKAGE
|
- local: .gitlab/ci/build.gitlab-ci.yml
|
||||||
VERSION=$(dpkg-parsechangelog -S Version 2>/dev/null)
|
- local: .gitlab/ci/install.gitlab-ci.yml
|
||||||
VERSION_NIGHTLY="${VERSION}~${CI_COMMIT_REF_SLUG//-}+$(date +%Y%m%d%H%M)"
|
- local: .gitlab/ci/test.gitlab-ci.yml
|
||||||
dch --package "${PACKAGE}" --force-bad-version -v "${VERSION_NIGHTLY}" -D "unstable" --force-distribution "Daily build."
|
- local: .gitlab/ci/lint.gitlab-ci.yml
|
||||||
debuild -us -uc
|
|
||||||
|
|
||||||
build-yunohost:
|
|
||||||
extends: .build-stage
|
|
||||||
variables:
|
|
||||||
PACKAGE: "yunohost"
|
|
||||||
script:
|
|
||||||
- git ls-files | xargs tar -czf archive.tar.gz
|
|
||||||
- mkdir -p $YNH_BUILD_DIR/$PACKAGE
|
|
||||||
- cat archive.tar.gz | tar -xz -C $YNH_BUILD_DIR/$PACKAGE
|
|
||||||
- rm archive.tar.gz
|
|
||||||
- DEBIAN_FRONTEND=noninteractive apt --assume-yes -o Dpkg::Options::="--force-confold" build-dep $(pwd)/$YNH_BUILD_DIR/$PACKAGE
|
|
||||||
- *build_script
|
|
||||||
|
|
||||||
|
|
||||||
build-ssowat:
|
|
||||||
extends: .build-stage
|
|
||||||
variables:
|
|
||||||
PACKAGE: "ssowat"
|
|
||||||
script:
|
|
||||||
- git clone $YNH_SOURCE/$PACKAGE -b $CI_COMMIT_REF_NAME $YNH_BUILD_DIR/$PACKAGE || git clone $YNH_SOURCE/$PACKAGE $YNH_BUILD_DIR/$PACKAGE
|
|
||||||
- DEBIAN_FRONTEND=noninteractive apt --assume-yes -o Dpkg::Options::="--force-confold" build-dep $(pwd)/$YNH_BUILD_DIR/$PACKAGE
|
|
||||||
- *build_script
|
|
||||||
|
|
||||||
build-moulinette:
|
|
||||||
extends: .build-stage
|
|
||||||
variables:
|
|
||||||
PACKAGE: "moulinette"
|
|
||||||
script:
|
|
||||||
- git clone $YNH_SOURCE/$PACKAGE -b $CI_COMMIT_REF_NAME $YNH_BUILD_DIR/$PACKAGE || git clone $YNH_SOURCE/$PACKAGE $YNH_BUILD_DIR/$PACKAGE
|
|
||||||
- DEBIAN_FRONTEND=noninteractive apt --assume-yes -o Dpkg::Options::="--force-confold" build-dep $(pwd)/$YNH_BUILD_DIR/$PACKAGE
|
|
||||||
- *build_script
|
|
||||||
|
|
||||||
########################################
|
|
||||||
# INSTALL DEB
|
|
||||||
########################################
|
|
||||||
|
|
||||||
install:
|
|
||||||
image: before-install
|
|
||||||
stage: install
|
|
||||||
variables:
|
|
||||||
YNH_BUILD_DIR: "ynh-build"
|
|
||||||
before_script:
|
|
||||||
- apt install --assume-yes wget debhelper
|
|
||||||
- echo "deb http://forge.yunohost.org/debian/ stretch stable testing unstable" > /etc/apt/sources.list.d/yunohost.list
|
|
||||||
- wget -O- https://forge.yunohost.org/yunohost.asc -q | apt-key add -qq - >/dev/null 2>&1
|
|
||||||
- apt update
|
|
||||||
# https://github.com/YunoHost/install_script/blob/3e16abd7c4e1fe9c518cbc573282cb8fb1fcbbd7/install_yunohost#L433-L485
|
|
||||||
- touch /var/log/auth.log
|
|
||||||
- >
|
|
||||||
if ! id avahi > /dev/null 2>&1; then
|
|
||||||
avahi_id=$((500 + RANDOM % 500))
|
|
||||||
while cut -d ':' -f 3 /etc/passwd | grep -q $avahi_id
|
|
||||||
do
|
|
||||||
avahi_id=$((500 + RANDOM % 500))
|
|
||||||
done
|
|
||||||
adduser --disabled-password --quiet --system --home /var/run/avahi-daemon --no-create-home --gecos "Avahi mDNS daemon" --group avahi --uid $avahi_id
|
|
||||||
fi
|
|
||||||
script:
|
|
||||||
- |
|
|
||||||
debconf-set-selections << EOF
|
|
||||||
slapd slapd/password1 password yunohost
|
|
||||||
slapd slapd/password2 password yunohost
|
|
||||||
slapd slapd/domain string yunohost.org
|
|
||||||
slapd shared/organization string yunohost.org
|
|
||||||
slapd slapd/allow_ldap_v2 boolean false
|
|
||||||
slapd slapd/invalid_config boolean true
|
|
||||||
slapd slapd/backend select MDB
|
|
||||||
postfix postfix/main_mailer_type select Internet Site
|
|
||||||
postfix postfix/mailname string /etc/mailname
|
|
||||||
mariadb-server-10.1 mysql-server/root_password password yunohost
|
|
||||||
mariadb-server-10.1 mysql-server/root_password_again password yunohost
|
|
||||||
nslcd nslcd/ldap-bindpw password
|
|
||||||
nslcd nslcd/ldap-starttls boolean false
|
|
||||||
nslcd nslcd/ldap-reqcert select
|
|
||||||
nslcd nslcd/ldap-uris string ldap://localhost/
|
|
||||||
nslcd nslcd/ldap-binddn string
|
|
||||||
nslcd nslcd/ldap-base string dc=yunohost,dc=org
|
|
||||||
libnss-ldapd libnss-ldapd/nsswitch multiselect group, passwd, shadow
|
|
||||||
postsrsd postsrsd/domain string yunohost.org
|
|
||||||
EOF
|
|
||||||
- cd $YNH_BUILD_DIR
|
|
||||||
- DEBIAN_FRONTEND=noninteractive SUDO_FORCE_REMOVE=yes apt --assume-yes -o Dpkg::Options::="--force-confold" --allow-downgrades install ./*.deb
|
|
||||||
artifacts:
|
|
||||||
paths:
|
|
||||||
- $YNH_BUILD_DIR/*.deb
|
|
||||||
cache:
|
|
||||||
paths:
|
|
||||||
- $YNH_BUILD_DIR/
|
|
||||||
policy: pull
|
|
||||||
key: "$CI_PIPELINE_ID"
|
|
||||||
|
|
||||||
########################################
|
|
||||||
# POSTINSTALL
|
|
||||||
########################################
|
|
||||||
|
|
||||||
postinstall:
|
|
||||||
image: before-postinstall
|
|
||||||
stage: postinstall
|
|
||||||
script:
|
|
||||||
- apt install --no-install-recommends -y $(cat debian/control | grep "^Depends" -A50 | grep "Recommends:" -B50 | grep "^ *," | grep -o -P "[\w\-]{3,}")
|
|
||||||
- yunohost tools postinstall -d domain.tld -p the_password --ignore-dyndns
|
|
||||||
|
|
||||||
########################################
|
|
||||||
# TESTS
|
|
||||||
########################################
|
|
||||||
|
|
||||||
.test-stage:
|
|
||||||
image: after-postinstall
|
|
||||||
stage: tests
|
|
||||||
variables:
|
|
||||||
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
|
|
||||||
before_script:
|
|
||||||
- apt-get install python-pip -y
|
|
||||||
- pip install -U pip
|
|
||||||
- hash -d pip
|
|
||||||
- pip install pytest pytest-sugar pytest-mock requests-mock mock
|
|
||||||
- export PYTEST_ADDOPTS="--color=yes"
|
|
||||||
cache:
|
|
||||||
paths:
|
|
||||||
- .cache/pip
|
|
||||||
- src/yunohost/tests/apps
|
|
||||||
key: "$CI_JOB_STAGE-$CI_COMMIT_REF_SLUG"
|
|
||||||
|
|
||||||
root-tests:
|
|
||||||
extends: .test-stage
|
|
||||||
script:
|
|
||||||
- py.test tests
|
|
||||||
|
|
||||||
test-apps:
|
|
||||||
extends: .test-stage
|
|
||||||
script:
|
|
||||||
- cd src/yunohost
|
|
||||||
- py.test tests/test_apps.py
|
|
||||||
|
|
||||||
test-appscatalog:
|
|
||||||
extends: .test-stage
|
|
||||||
script:
|
|
||||||
- cd src/yunohost
|
|
||||||
- py.test tests/test_appscatalog.py
|
|
||||||
|
|
||||||
test-appurl:
|
|
||||||
extends: .test-stage
|
|
||||||
script:
|
|
||||||
- cd src/yunohost
|
|
||||||
- py.test tests/test_appurl.py
|
|
||||||
|
|
||||||
test-apps-arguments-parsing:
|
|
||||||
extends: .test-stage
|
|
||||||
script:
|
|
||||||
- cd src/yunohost
|
|
||||||
- py.test tests/test_apps_arguments_parsing.py
|
|
||||||
|
|
||||||
test-backuprestore:
|
|
||||||
extends: .test-stage
|
|
||||||
script:
|
|
||||||
- cd src/yunohost
|
|
||||||
- py.test tests/test_backuprestore.py
|
|
||||||
|
|
||||||
test-changeurl:
|
|
||||||
extends: .test-stage
|
|
||||||
script:
|
|
||||||
- cd src/yunohost
|
|
||||||
- py.test tests/test_changeurl.py
|
|
||||||
|
|
||||||
test-permission:
|
|
||||||
extends: .test-stage
|
|
||||||
script:
|
|
||||||
- cd src/yunohost
|
|
||||||
- py.test tests/test_permission.py
|
|
||||||
|
|
||||||
test-settings:
|
|
||||||
extends: .test-stage
|
|
||||||
script:
|
|
||||||
- cd src/yunohost
|
|
||||||
- py.test tests/test_settings.py
|
|
||||||
|
|
||||||
test-user-group:
|
|
||||||
extends: .test-stage
|
|
||||||
script:
|
|
||||||
- cd src/yunohost
|
|
||||||
- py.test tests/test_user-group.py
|
|
||||||
|
|
||||||
test-regenconf:
|
|
||||||
extends: .test-stage
|
|
||||||
script:
|
|
||||||
- cd src/yunohost
|
|
||||||
- py.test tests/test_regenconf.py
|
|
||||||
|
|
||||||
test-service:
|
|
||||||
extends: .test-stage
|
|
||||||
script:
|
|
||||||
- cd src/yunohost
|
|
||||||
- py.test tests/test_service.py
|
|
||||||
|
|
||||||
########################################
|
|
||||||
# LINTER
|
|
||||||
########################################
|
|
||||||
|
|
||||||
.lint-stage:
|
|
||||||
image: before-postinstall
|
|
||||||
stage: lint
|
|
||||||
before_script:
|
|
||||||
- apt-get install python-pip -y
|
|
||||||
- mkdir -p .pip
|
|
||||||
- pip install -U pip
|
|
||||||
- hash -d pip
|
|
||||||
- pip --cache-dir=.pip install tox
|
|
||||||
cache:
|
|
||||||
paths:
|
|
||||||
- .pip
|
|
||||||
- .tox
|
|
||||||
key: "$CI_JOB_STAGE-$CI_COMMIT_REF_SLUG"
|
|
||||||
|
|
||||||
lint:
|
|
||||||
extends: .lint-stage
|
|
||||||
allow_failure: true
|
|
||||||
script:
|
|
||||||
- tox -e lint
|
|
||||||
|
|
||||||
invalidcode:
|
|
||||||
extends: .lint-stage
|
|
||||||
script:
|
|
||||||
- tox -e invalidcode
|
|
||||||
|
|
||||||
# Disabled, waiting for buster
|
|
||||||
#format-check:
|
|
||||||
# extends: .lint-stage
|
|
||||||
# script:
|
|
||||||
# - black --check --diff
|
|
||||||
|
|
52
.gitlab/ci/build.gitlab-ci.yml
Normal file
52
.gitlab/ci/build.gitlab-ci.yml
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
.build-stage:
|
||||||
|
stage: build
|
||||||
|
image: "before-install"
|
||||||
|
variables:
|
||||||
|
YNH_SOURCE: "https://github.com/yunohost"
|
||||||
|
before_script:
|
||||||
|
- mkdir -p $YNH_BUILD_DIR
|
||||||
|
artifacts:
|
||||||
|
paths:
|
||||||
|
- $YNH_BUILD_DIR/*.deb
|
||||||
|
|
||||||
|
.build_script: &build_script
|
||||||
|
- cd $YNH_BUILD_DIR/$PACKAGE
|
||||||
|
- VERSION=$(dpkg-parsechangelog -S Version 2>/dev/null)
|
||||||
|
- VERSION_NIGHTLY="${VERSION}+$(date +%Y%m%d%H%M)"
|
||||||
|
- dch --package "${PACKAGE}" --force-bad-version -v "${VERSION_NIGHTLY}" -D "unstable" --force-distribution "Daily build."
|
||||||
|
- debuild --no-lintian -us -uc
|
||||||
|
|
||||||
|
########################################
|
||||||
|
# BUILD DEB
|
||||||
|
########################################
|
||||||
|
|
||||||
|
build-yunohost:
|
||||||
|
extends: .build-stage
|
||||||
|
variables:
|
||||||
|
PACKAGE: "yunohost"
|
||||||
|
script:
|
||||||
|
- git ls-files | xargs tar -czf archive.tar.gz
|
||||||
|
- mkdir -p $YNH_BUILD_DIR/$PACKAGE
|
||||||
|
- cat archive.tar.gz | tar -xz -C $YNH_BUILD_DIR/$PACKAGE
|
||||||
|
- rm archive.tar.gz
|
||||||
|
- DEBIAN_FRONTEND=noninteractive apt --assume-yes -o Dpkg::Options::="--force-confold" build-dep $(pwd)/$YNH_BUILD_DIR/$PACKAGE
|
||||||
|
- *build_script
|
||||||
|
|
||||||
|
|
||||||
|
build-ssowat:
|
||||||
|
extends: .build-stage
|
||||||
|
variables:
|
||||||
|
PACKAGE: "ssowat"
|
||||||
|
script:
|
||||||
|
- git clone $YNH_SOURCE/$PACKAGE -b $CI_COMMIT_REF_NAME $YNH_BUILD_DIR/$PACKAGE || git clone $YNH_SOURCE/$PACKAGE $YNH_BUILD_DIR/$PACKAGE
|
||||||
|
- DEBIAN_FRONTEND=noninteractive apt --assume-yes -o Dpkg::Options::="--force-confold" build-dep $(pwd)/$YNH_BUILD_DIR/$PACKAGE
|
||||||
|
- *build_script
|
||||||
|
|
||||||
|
build-moulinette:
|
||||||
|
extends: .build-stage
|
||||||
|
variables:
|
||||||
|
PACKAGE: "moulinette"
|
||||||
|
script:
|
||||||
|
- git clone $YNH_SOURCE/$PACKAGE -b $CI_COMMIT_REF_NAME $YNH_BUILD_DIR/$PACKAGE || git clone $YNH_SOURCE/$PACKAGE $YNH_BUILD_DIR/$PACKAGE
|
||||||
|
- DEBIAN_FRONTEND=noninteractive apt --assume-yes -o Dpkg::Options::="--force-confold" build-dep $(pwd)/$YNH_BUILD_DIR/$PACKAGE
|
||||||
|
- *build_script
|
16
.gitlab/ci/install.gitlab-ci.yml
Normal file
16
.gitlab/ci/install.gitlab-ci.yml
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
########################################
|
||||||
|
# INSTALL DEB
|
||||||
|
########################################
|
||||||
|
|
||||||
|
upgrade:
|
||||||
|
stage: install
|
||||||
|
image: "after-install"
|
||||||
|
script:
|
||||||
|
- DEBIAN_FRONTEND=noninteractive SUDO_FORCE_REMOVE=yes apt --assume-yes -o Dpkg::Options::="--force-confold" --allow-downgrades install ./$YNH_BUILD_DIR/*.deb
|
||||||
|
|
||||||
|
install-postinstall:
|
||||||
|
stage: install
|
||||||
|
image: "before-install"
|
||||||
|
script:
|
||||||
|
- DEBIAN_FRONTEND=noninteractive SUDO_FORCE_REMOVE=yes apt --assume-yes -o Dpkg::Options::="--force-confold" --allow-downgrades install ./$YNH_BUILD_DIR/*.deb
|
||||||
|
- yunohost tools postinstall -d domain.tld -p the_password --ignore-dyndns
|
22
.gitlab/ci/lint.gitlab-ci.yml
Normal file
22
.gitlab/ci/lint.gitlab-ci.yml
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
########################################
|
||||||
|
# LINTER
|
||||||
|
########################################
|
||||||
|
|
||||||
|
lint:
|
||||||
|
stage: lint
|
||||||
|
image: "before-install"
|
||||||
|
allow_failure: true
|
||||||
|
script:
|
||||||
|
- tox -e lint
|
||||||
|
|
||||||
|
invalidcode:
|
||||||
|
stage: lint
|
||||||
|
image: "before-install"
|
||||||
|
script:
|
||||||
|
- tox -e invalidcode
|
||||||
|
|
||||||
|
# Disabled, waiting for buster
|
||||||
|
#format-check:
|
||||||
|
# extends: .lint-stage
|
||||||
|
# script:
|
||||||
|
# - black --check --diff
|
102
.gitlab/ci/test.gitlab-ci.yml
Normal file
102
.gitlab/ci/test.gitlab-ci.yml
Normal file
|
@ -0,0 +1,102 @@
|
||||||
|
.install_debs: &install_debs
|
||||||
|
- DEBIAN_FRONTEND=noninteractive SUDO_FORCE_REMOVE=yes apt --assume-yes -o Dpkg::Options::="--force-confold" --allow-downgrades install ./$YNH_BUILD_DIR/*.deb
|
||||||
|
|
||||||
|
.test-stage:
|
||||||
|
stage: tests
|
||||||
|
image: "after-install"
|
||||||
|
variables:
|
||||||
|
PYTEST_ADDOPTS: "--color=yes"
|
||||||
|
before_script:
|
||||||
|
- *install_debs
|
||||||
|
cache:
|
||||||
|
paths:
|
||||||
|
- src/yunohost/tests/apps
|
||||||
|
key: "$CI_JOB_STAGE-$CI_COMMIT_REF_SLUG"
|
||||||
|
|
||||||
|
########################################
|
||||||
|
# TESTS
|
||||||
|
########################################
|
||||||
|
|
||||||
|
full-tests:
|
||||||
|
stage: tests
|
||||||
|
image: "before-install"
|
||||||
|
variables:
|
||||||
|
PYTEST_ADDOPTS: "--color=yes"
|
||||||
|
before_script:
|
||||||
|
- *install_debs
|
||||||
|
- yunohost tools postinstall -d domain.tld -p the_password --ignore-dyndns
|
||||||
|
script:
|
||||||
|
- py.test tests
|
||||||
|
- cd src/yunohost
|
||||||
|
- py.test tests
|
||||||
|
|
||||||
|
root-tests:
|
||||||
|
extends: .test-stage
|
||||||
|
script:
|
||||||
|
- py.test tests
|
||||||
|
|
||||||
|
test-apps:
|
||||||
|
extends: .test-stage
|
||||||
|
script:
|
||||||
|
- cd src/yunohost
|
||||||
|
- py.test tests/test_apps.py
|
||||||
|
|
||||||
|
test-appscatalog:
|
||||||
|
extends: .test-stage
|
||||||
|
script:
|
||||||
|
- cd src/yunohost
|
||||||
|
- py.test tests/test_appscatalog.py
|
||||||
|
|
||||||
|
test-appurl:
|
||||||
|
extends: .test-stage
|
||||||
|
script:
|
||||||
|
- cd src/yunohost
|
||||||
|
- py.test tests/test_appurl.py
|
||||||
|
|
||||||
|
test-apps-arguments-parsing:
|
||||||
|
extends: .test-stage
|
||||||
|
script:
|
||||||
|
- cd src/yunohost
|
||||||
|
- py.test tests/test_apps_arguments_parsing.py
|
||||||
|
|
||||||
|
test-backuprestore:
|
||||||
|
extends: .test-stage
|
||||||
|
script:
|
||||||
|
- cd src/yunohost
|
||||||
|
- py.test tests/test_backuprestore.py
|
||||||
|
|
||||||
|
test-changeurl:
|
||||||
|
extends: .test-stage
|
||||||
|
script:
|
||||||
|
- cd src/yunohost
|
||||||
|
- py.test tests/test_changeurl.py
|
||||||
|
|
||||||
|
test-permission:
|
||||||
|
extends: .test-stage
|
||||||
|
script:
|
||||||
|
- cd src/yunohost
|
||||||
|
- py.test tests/test_permission.py
|
||||||
|
|
||||||
|
test-settings:
|
||||||
|
extends: .test-stage
|
||||||
|
script:
|
||||||
|
- cd src/yunohost
|
||||||
|
- py.test tests/test_settings.py
|
||||||
|
|
||||||
|
test-user-group:
|
||||||
|
extends: .test-stage
|
||||||
|
script:
|
||||||
|
- cd src/yunohost
|
||||||
|
- py.test tests/test_user-group.py
|
||||||
|
|
||||||
|
test-regenconf:
|
||||||
|
extends: .test-stage
|
||||||
|
script:
|
||||||
|
- cd src/yunohost
|
||||||
|
- py.test tests/test_regenconf.py
|
||||||
|
|
||||||
|
test-service:
|
||||||
|
extends: .test-stage
|
||||||
|
script:
|
||||||
|
- cd src/yunohost
|
||||||
|
- py.test tests/test_service.py
|
Loading…
Add table
Reference in a new issue