👷 Add CI for GitLab
This commit is contained in:
parent
37086a3bed
commit
27e80b06aa
23
.gitlab-ci.yml
Normal file
23
.gitlab-ci.yml
Normal 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
|
5
Makefile
5
Makefile
@ -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 🚨
|
||||
|
4
main.py
4
main.py
@ -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())
|
||||
|
Loading…
Reference in New Issue
Block a user