forked from dod-cyber-crime-center/sqlite-dissect
-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitlab-ci.yml
78 lines (71 loc) · 2.25 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# While SQLite Dissect is primarily managed in GitHub, there are some forks that are being managed in GitLab instances.
# This runner configuration is analogous to what exists in ./.github/workflows/ci.yml but is configured for GitLab CI.
# As the primary repository resides in GitHub, this script does not include the logic to push the built wheel to PyPi.
# Pre-Requisites:
# - A GitLab runner with the `docker` executor that is tagged with `docker`.
# - Access to the internet for installation of dependencies during the build step.
# - If there's a proxy behind which the runner needs to be configured, set the PYPI_PROXY_URL environment variable.
default:
tags:
- docker
- devnet
image: python:3.11
stages:
- Lint
- Test
- Build
before_script:
- pip config set global.index-url ${PIP_URL}
- pip config set global.trusted-host ${ARTIFACTORY_HOST_NAME}
- pip config set search.index ${PIP_URL}
- python -m pip -q install --upgrade pip
FlakeLint:
stage: Lint
allow_failure: false
script:
- pip install .
- pip install -q flake8
# stop the build if there are Python syntax errors or undefined names
- flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
- flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
PyTest:
stage: Test
allow_failure: false
script:
- mkdir output
- pip install .
- pip -q install pytest pytest-cov
# Run the test with coverage
- pytest --cov-report term-missing --cov-report html --cov=sqlite_dissect --cov-config=.coveragerc --junitxml=report.xml
artifacts:
when: always
reports:
junit: report.xml
paths:
- htmlcov/*
BuildDocs:
stage: Build
allow_failure: false
script:
- pip install -q sphinx
- pip install -q sphinx-rtd-theme
- sphinx-build -b html ./docs/source/ ./docs/build/
artifacts:
paths:
- ./docs/build/*
BuildWheel:
stage: Build
allow_failure: false
script:
- pip install .
- pip install build twine wheel
# Build the wheel
- python setup.py sdist bdist_wheel
# Check the built wheel
- twine check dist/*
only:
- tags
artifacts:
paths:
- dist/*