Newer
Older
- test
- package
- doc
- test-package
- sonar
- publish
- deploy
variables:
TOXENV: $CI_JOB_NAME
- apt-get -yq update
- apt-get install -yq rdiff-backup
- pip install tox
- export TOXENV=${TOXENV:-$CI_JOB_NAME}
- echo TOXENV=$TOXENV
- useradd myuser
- su myuser -c tox
- coverage-*.xml
- xunit-*.xml
black:
<<: *tox
isort:
<<: *tox
- TOXENV: py3
IMAGE: python:3.6
- TOXENV: py3
IMAGE: python:3.8
- TOXENV: bullseye
IMAGE: python:3.9-bullseye
- TOXENV: py3
IMAGE: python:3.10
- TOXENV: bookworm
IMAGE: python:3.11
selenium:
<<: *tox
before_script:
- apt update
- apt -y --no-install-recommends install xvfb xauth chromium-driver rdiff-backup
artifacts:
paths:
- coverage.xml
- xunit.xml
- apt-get update
- apt -y install librsync-dev
- pip install tox
- pip install -U rdiff-backup
postgresql-12:
services:
- postgres:12.2-alpine
TOXENV: bullseye
IMAGE: python:3.9-bullseye
RDIFFWEB_TEST_DATABASE_URI: "postgresql://admin@postgres/test"
POSTGRES_DB: test
POSTGRES_USER: admin
POSTGRES_PASSWORD: ""
POSTGRES_HOST_AUTH_METHOD: trust
doc:
<<: *tox
stage: doc
needs: []
dependencies: []
artifacts:
paths:
stage: package
needs: []
- pip3 install wheel
- python3 setup.py sdist bdist_wheel
package:docker:
stage: package
needs: []
dependencies: []
image: docker:20
services:
# Get docker layes
- docker pull ikus060/rdiffweb:latest || true
- docker pull ikus060/rdiffweb:$CI_COMMIT_REF_SLUG || true
- docker build --cache-from ikus060/rdiffweb:latest --cache-from ikus060/rdiffweb:$CI_COMMIT_REF_SLUG -t rdiffweb .
- docker build --target test .
- mkdir dist
- docker save rdiffweb --output dist/rdiffweb-docker.tar
stage: package
needs: []
image: buildpack-deps:$DIST
parallel:
matrix:
script:
# Clean-up
- rm -f ../rdiffweb_*
- rm -Rf ./dist/$DIST/*
# Install dependencies
- apt update
- apt -y --no-install-recommends install devscripts lsb-release
# Generate change log
- export DEBEMAIL=${CI_COMMIT_AUTHOR}
- debian/rules changelog
# Generate orig.tar.gz
- debian/rules gentarball
# Run build in separate target
- debuild -us -uc
# Move files to archives
- mkdir -p ./dist/$DIST
- mv ../rdiffweb_* ./dist/$DIST/
needs: ["package:deb"]
parallel:
matrix:
# Ubuntu tzdata is broken https://githubmate.com/repo/regebro/tzlocal/issues/101
# So we need to make it explicit using environment variable
- apt update
- apt install -y ./dist/$DIST/rdiffweb*.deb
- rdiffweb --version
- (/usr/bin/rdiffweb &)
- timeout 60 bash -c 'until curl --silent http://localhost:8080; do sleep 1; done'
# Check if static files are working
- curl http://localhost:8080/static/css/bootstrap.min.css
- curl http://localhost:8080/static/css/bootstrap.min.css.map
- curl http://localhost:8080/static/css/font-awesome.css.map
- curl http://localhost:8080/static/css/font-awesome.min.css
- curl http://localhost:8080/static/css/jquery.dataTables.min.css
- curl http://localhost:8080/static/css/responsive.dataTables.min.css
- curl http://localhost:8080/static/fonts/fontawesome-webfont.eot
- curl http://localhost:8080/static/fonts/fontawesome-webfont.svg
- curl http://localhost:8080/static/fonts/fontawesome-webfont.woff
- curl http://localhost:8080/static/fonts/fontawesome-webfont.woff2
- curl http://localhost:8080/static/images/sort_asc.png
- curl http://localhost:8080/static/images/sort_both.png
- curl http://localhost:8080/static/images/sort_desc.png
- curl http://localhost:8080/static/js/bootstrap.bundle.js.map
- curl http://localhost:8080/static/js/bootstrap.bundle.min.js
- curl http://localhost:8080/static/js/dataTables.buttons.min.js
- curl http://localhost:8080/static/js/dataTables.responsive.min.js
- curl http://localhost:8080/static/js/jquery.dataTables.min.js
- curl http://localhost:8080/static/js/jquery.min.js
image: sonarsource/sonar-scanner-cli
variables:
SONAR_PROJECT_BASE_DIR: "${CI_PROJECT_DIR}"
- sonar-scanner -X -Dsonar.python.coverage.reportPaths=coverage-*.xml -Dsonar.python.xunit.reportPaths=xunit-py3.xml -Dsonar.host.url=$SONAR_URL -Dsonar.login=$SONAR_TOKEN -Dsonar.projectKey=$CI_PROJECT_NAME -Dsonar.projectVersion=$(git describe) -Dsonar.qualitygate.wait=True
image: sonarsource/sonar-scanner-cli
only:
variables:
- $SONAR_URL
- $SONAR_TOKEN
variables:
SONAR_PROJECT_BASE_DIR: "${CI_PROJECT_DIR}"
- sonar-scanner -X -Dsonar.python.coverage.reportPaths=coverage-*.xml -Dsonar.python.xunit.reportPaths=xunit-*.xml -Dsonar.host.url=$SONAR_URL -Dsonar.login=$SONAR_TOKEN -Dsonar.projectKey=$CI_PROJECT_NAME-dev -Dsonar.projectVersion=$(git describe) -Dsonar.qualitygate.wait=True
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
only:
variables:
- $DOCKER_USR
- $DOCKER_PWD
script: |
set -x
docker login $DOCKER_REGISTRY -u $DOCKER_USR -p $DOCKER_PWD
docker load --input dist/*.tar
# Push commit hash
docker tag rdiffweb ikus060/rdiffweb:$CI_COMMIT_SHORT_SHA
docker push ikus060/rdiffweb:$CI_COMMIT_SHORT_SHA
# Push branch name
docker tag rdiffweb ikus060/rdiffweb:$CI_COMMIT_REF_SLUG
docker push ikus060/rdiffweb:$CI_COMMIT_REF_SLUG
# Push tags
if [ -n "$CI_COMMIT_TAG" ]; then
docker tag rdiffweb ikus060/rdiffweb:$CI_COMMIT_TAG
docker push ikus060/rdiffweb:$CI_COMMIT_TAG
fi
# Push tag as latest
case ${CI_COMMIT_TAG##*.} in
[0-9]*)
docker tag rdiffweb ikus060/rdiffweb:latest
docker push ikus060/rdiffweb:latest
;;
esac
stage: publish
publish:docker-readme:
needs:
only:
variables:
- $DOCKER_USR
- $DOCKER_PWD
- $CI_COMMIT_TAG
image:
name: chko/docker-pushrm
variables:
DOCKER_USER: $DOCKER_USR
DOCKER_PASS: $DOCKER_PWD
PUSHRM_SHORT: A web interface to rdiff-backup repositories.
PUSHRM_TARGET: docker.io/ikus060/rdiffweb
PUSHRM_DEBUG: 1
PUSHRM_FILE: $CI_PROJECT_DIR/README.md
# Keep top 400 lines to workarround Dockerhub limitation.
- cp README.md README.md.orig
- head -n 400 README.md.orig > README.md
# Push file
- /docker-pushrm
only:
variables:
- $NEXUS_USR
- $NEXUS_PWD
- DIST: [bullseye, bookworm, jammy, lunar, mantic]
if [[ "$CI_COMMIT_TAG" == *.+([0-9]) ]]; then
APT_URL="$NEXUS_URL/repository/apt-release-${DIST}/"
APT_URL="$NEXUS_URL/repository/apt-dev-${DIST}/"
fi
export FILE=$(ls -1 ./dist/$DIST/rdiffweb*.deb)
curl --fail -u "$NEXUS_USR:$NEXUS_PWD" -H "Content-Type: multipart/form-data" --data-binary "@$FILE" "$APT_URL"
stage: publish
variables:
- $NEXUS_USR
- $NEXUS_PWD
- $NEXUS_PYPI_URL
pip3 install wheel twine readme_renderer[md] --upgrade
LANG="C.UTF-8" python3 -m readme_renderer README.md -o /tmp/README.html
twine upload dist/*.whl -u $NEXUS_USR -p $NEXUS_PWD --repository-url $NEXUS_PYPI_URL
if [ ! -z "$CI_COMMIT_TAG" ]; then
twine upload dist/*.whl -u $PYPI_USR -p $PYPI_PWD
fi
publish:doc:
stage: publish
only:
variables:
- $NEXUS_USR
- $NEXUS_PWD
- $NEXUS_URL
Patrik Dufresne
committed
- export VERSION=$(python3 setup.py --version)
- cd .tox/doc/tmp/html
- find * -type f -exec curl --fail -u "$NEXUS_USR:$NEXUS_PWD" --upload-file "{}" $NEXUS_URL/repository/archive/rdiffweb/$VERSION/doc/{} \;
only:
variables:
environment:
name: demo
url: https://rdiffweb-demo.ikus-soft.com/
image: registry.gitlab.com/finestructure/pipeline-trigger
- export DEB_VERSION=$(ls -1 ./dist/bookworm/rdiffweb_*_all.deb | cut -d '_' -f 2)
- echo DEB_VERSION=$DEB_VERSION
# Trigger ansible-config pipeline
- trigger -a "$ANSIBLE_PIPELINE_GITLAB_API_TOKEN" -t master -e "RDIFFWEB_VERSION=$DEB_VERSION" -p 36bae86778d901fc6b2d6453a41844 18716492
stage: deploy
variables:
GIT_STRATEGY: none