Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
L
ldv_datamanagement_tasks
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LDV
ldv_datamanagement_tasks
Commits
52b61297
Commit
52b61297
authored
2 years ago
by
Klaas Kliffen
Browse files
Options
Downloads
Patches
Plain Diff
Initial tox in CI/CD
parent
5b480fd9
No related branches found
No related tags found
1 merge request
!5
Resolve CWG-11 "Features/ add tox"
Pipeline
#39016
failed
2 years ago
Stage: lint
Stage: test
Stage: package
Stage: integration
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
.gitlab-ci.yml
+12
-20
12 additions, 20 deletions
.gitlab-ci.yml
tox.ini
+1
-41
1 addition, 41 deletions
tox.ini
with
13 additions
and
61 deletions
.gitlab-ci.yml
+
12
−
20
View file @
52b61297
default
:
default
:
image
:
python:3.7
# minimum supported version
image
:
python:3.7
# minimum supported version
# Make sure each step is executed in a virtual environment with some basic dependencies present
before_script
:
before_script
:
-
python --version
# For debugging
-
python --version
# For debugging
-
python -m venv venv
-
source venv/bin/activate
-
python -m pip install --upgrade pip
-
python -m pip install --upgrade pip
# install common packages required for linting, building, docs etc.
-
pip install --upgrade tox twine
-
pip install --upgrade black build flake8 pylint setuptools sphinx twine wheel
cache
:
cache
:
paths
:
paths
:
-
.cache/pip
-
.cache/pip
-
venv/
# Do not cache .tox, to recreate virtualenvs for every step
stages
:
stages
:
-
lint
-
lint
...
@@ -29,22 +25,19 @@ variables:
...
@@ -29,22 +25,19 @@ variables:
run_black
:
run_black
:
stage
:
lint
stage
:
lint
script
:
script
:
-
python -m black --version
-
tox -e black
-
python -m black --check --diff .
allow_failure
:
true
allow_failure
:
true
run_flake8
:
run_flake8
:
stage
:
lint
stage
:
lint
script
:
script
:
-
python -m flake8 --version
-
tox -e pep8
-
python -m flake8 map
allow_failure
:
true
allow_failure
:
true
run_pylint
:
run_pylint
:
stage
:
lint
stage
:
lint
script
:
script
:
-
python -m pylint --version
-
tox -e pylint
-
python -m pylint map
allow_failure
:
true
allow_failure
:
true
# build_extensions:
# build_extensions:
...
@@ -55,8 +48,7 @@ run_pylint:
...
@@ -55,8 +48,7 @@ run_pylint:
run_unit_tests
:
run_unit_tests
:
stage
:
test
stage
:
test
script
:
script
:
-
pip install -r requirements.txt
-
tox -e py37,py38,py39,py310
-
echo "run python unit tests /w coverage"
package_files
:
package_files
:
stage
:
package
stage
:
package
...
@@ -65,7 +57,7 @@ package_files:
...
@@ -65,7 +57,7 @@ package_files:
paths
:
paths
:
-
dist/*
-
dist/*
script
:
script
:
-
python
-
m
build
# or something similar
-
tox
-
e
build
package_docs
:
package_docs
:
stage
:
package
stage
:
package
...
@@ -95,11 +87,11 @@ publish_on_gitlab:
...
@@ -95,11 +87,11 @@ publish_on_gitlab:
-
if
:
$CI_COMMIT_TAG
-
if
:
$CI_COMMIT_TAG
script
:
script
:
-
echo "run twine for gitlab"
-
echo "run twine for gitlab"
#
- |
-
|
#
TWINE_PASSWORD=${CI_JOB_TOKEN} \
TWINE_PASSWORD=${CI_JOB_TOKEN} \
#
TWINE_USERNAME=gitlab-ci-token \
TWINE_USERNAME=gitlab-ci-token \
#
python -m twine upload \
python -m twine upload \
#
--repository-url ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/pypi dist/*
--repository-url ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/pypi dist/*
publish_on_test_pypi
:
publish_on_test_pypi
:
stage
:
publish
stage
:
publish
...
...
This diff is collapsed.
Click to expand it.
tox.ini
+
1
−
41
View file @
52b61297
...
@@ -16,7 +16,6 @@ deps =
...
@@ -16,7 +16,6 @@ deps =
-r{toxinidir}/tests/requirements.txt
-r{toxinidir}/tests/requirements.txt
commands
=
commands
=
{envpython}
--version
{envpython}
--version
stestr
run
{posargs}
# Use generative name and command prefixes to reuse the same virtualenv
# Use generative name and command prefixes to reuse the same virtualenv
# for all linting jobs.
# for all linting jobs.
...
@@ -29,47 +28,8 @@ commands =
...
@@ -29,47 +28,8 @@ commands =
black:
{envpython}
-m
black
--version
black:
{envpython}
-m
black
--version
black:
{envpython}
-m
black
--check
--diff
.
black:
{envpython}
-m
black
--check
--diff
.
pylint:
{envpython}
-m
pylint
--version
pylint:
{envpython}
-m
pylint
--version
pylint:
{envpython}
-m
pylint
lofar_station_client
pylint:
{envpython}
-m
pylint
map
[testenv:debug]
commands
=
{envpython} -m testtools.run {posargs}
[testenv:coverage]
; stestr does not natively support generating coverage reports use
; `PYTHON=python -m coverage run....` to overcome this.
setenv
=
PYTHON
=
{envpython} -m coverage run --source lofar_station_client --omit='*tests*' --parallel-mode
commands
=
{envpython}
-m
coverage
erase
{envpython}
-m
stestr
run
{posargs}
{envpython}
-m
coverage
combine
{envpython}
-m
coverage
html
-d
cover
--omit
=
'*tests*'
{envpython}
-m
coverage
xml
-o
coverage.xml
{envpython}
-m
coverage
report
--omit
=
'*tests*'
[testenv:build]
[testenv:build]
usedevelop
=
False
usedevelop
=
False
commands
=
{envpython} -m build
commands
=
{envpython} -m build
[testenv:docs]
deps
=
-r{toxinidir}/requirements.txt
-r{toxinidir}/docs/requirements.txt
commands
=
sphinx-build -b html -W docs/source docs/build/html
[testenv:integration]
# Do no install the lofar station client package, force packaged version install
skip_install
=
true
# Intentionally break import paths if not installed from package
changedir
=
{toxinidir}/integration
# Allow bash for wheel file substitution
allowlist_external
=
bash
commands
=
# We need the bash substitutions here
bash
-ec
'pip
install
--force-reinstall
{toxinidir}/dist/*.whl'
{envpython}
-m
stestr
run
--serial
{posargs}
[flake8]
filename
=
*.py
exclude
=
.tox,.egg-info
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment