argos/.gitlab-ci.yml

90 lines
1.7 KiB
YAML

---
image: python:3.11
stages:
- install
- test
- deploy
default:
cache: &global_cache
key: "$CI_COMMIT_SHA"
paths:
- venv/
.pull-cache: &pull_cache
cache:
<<: *global_cache
policy: pull
install:
stage: install
before_script:
- apt-get update
- apt-get install -y build-essential libldap-dev libsasl2-dev
script:
- make venv
- make develop
cache:
<<: *global_cache
policy: push
pytest:
<<: *pull_cache
stage: test
script:
- make test
djlint:
<<: *pull_cache
stage: test
script:
- make djlint
mypy:
<<: *pull_cache
stage: test
script:
- make mypy
pylint:
<<: *pull_cache
stage: test
script:
- make pylint | python3 .fix-pylint-output-for-gitlab-ci.py
allow_failure: true
coverage: '/Your code has been rated at ([0-9.]+)\/100/'
format:
<<: *pull_cache
stage: test
script:
- make ruff
release_job:
stage: deploy
image: registry.gitlab.com/gitlab-org/release-cli:latest
rules:
- if: $CI_COMMIT_TAG
script:
- sed -n '/^## '$CI_COMMIT_TAG'/,/^#/p' CHANGELOG.md | sed -e '/^\(#\|$\|Date\)/d' > release.md
release: # See https://docs.gitlab.com/ee/ci/yaml/#release for available properties
tag_name: '$CI_COMMIT_TAG'
description: './release.md'
assets:
links:
- name: 'PyPI page'
url: 'https://pypi.org/project/argos-monitoring/$CI_COMMIT_TAG/'
pages:
<<: *pull_cache
stage: deploy
script:
- sed -e "/Unreleased/,+1d" -i CHANGELOG.md
- make docs
- echo "https://framasoft.frama.io/framaspace/argos/* https://argos-monitoring.framasoft.org/:splat 301" > public/_redirects
artifacts:
paths:
- public/
rules:
- if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH