-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.gitlab-ci.yml
52 lines (47 loc) · 1.17 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
---
stages:
- image
- check
- test
- publish
image-sandbox:
image: docker:20.10.16
stage: image
script:
- echo $CI_REGISTRY_PASSWORD | docker -D login -u $CI_REGISTRY_USER --password-stdin $CI_REGISTRY
- docker build -t $CI_REGISTRY_IMAGE:latest .
- docker push $CI_REGISTRY_IMAGE:latest
variables:
DOCKER_BUILDKIT: '1'
check-style:
image: $CI_REGISTRY_IMAGE
stage: check
needs: ['image-sandbox']
script:
- flake8 .
- isort -c --diff lotr
- (cd exp/dlrt && isort -c --diff -p optimizer_KLS .)
- (cd exp/lotr && isort -c --diff .)
test:
image: $CI_REGISTRY_IMAGE
stage: test
needs: ['image-sandbox']
script:
- echo $PYTHONPATH
- pytest -s -vv
variables:
PYTHONPATH: $PWD
pypi:
image: $CI_REGISTRY_IMAGE
stage: publish
rules:
- if: '$CI_COMMIT_TAG =~ /v\d+(\.\d+)*/'
needs: ['check-style', 'test']
variables:
PYPI_URL: '${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/pypi'
TWINE_CERT: '${CI_SERVER_TLS_CA_FILE}'
TWINE_PASSWORD: '${CI_JOB_TOKEN}'
TWINE_USERNAME: 'gitlab-ci-token'
script:
- python -m build -nw .
- python -m twine upload --repository-url $PYPI_URL dist/*.whl