👷 Add CI for GitLab

This commit is contained in:
Freezed 2022-10-25 00:28:11 +02:00
parent 37086a3bed
commit 27e80b06aa
3 changed files with 30 additions and 2 deletions

23
.gitlab-ci.yml Normal file
View File

@ -0,0 +1,23 @@
variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
cache:
paths:
- .cache/pip
- /var/venv/
lint:
image: python:3.8-slim
stage: test
except:
- /^wip-.*$/
- /^old-.*$/
- pitchme
script:
- python -V
- apt-get update -qq && apt-get -qq -y install make python3-venv
- python3 -m venv /var/venv/
- source /var/venv/bin/activate
- pip install -r requirements-dev.txt
- make --no-print-directory --quiet lint
- make --no-print-directory --quiet test

View File

@ -26,8 +26,11 @@ lint: # Lint code
open_all: # Open all projects files
${EDITOR} ${VBIN}/activate
${EDITOR} main.py Makefile pyproject.toml README.md requirements-dev.txt requirements.txt
${EDITOR} .gitlab-ci.yml main.py Makefile pyproject.toml README.md requirements-dev.txt requirements.txt
${EDITOR} .git/hooks/p*-commit
pre_commit: # Run the pre-commit hook
bash .git/hooks/pre-commit
test: # Run the code tests
./main.py -h 1> /dev/null && echo|| echo 🚨

View File

@ -12,6 +12,7 @@ This file is part of [`<GIT REPO NAME>`](<GIT REPO URL>)
"""
import argparse
from os import environ
import sys
from pprint import pprint as pp
@ -123,5 +124,6 @@ def main():
if __name__ == "__main__":
import doctest
doctest.testmod()
# When running on GitLab CI, a doctest error raised an error
doctest.testmod(raise_on_error=environ.get("CI", False))
sys.exit(main())