-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
35 lines (32 loc) · 896 Bytes
/
.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
stages:
- build
- test
variables:
PROJECT_NAME: sdata
build:
stage: build
when: on_success
tags:
- dind
only:
- master
- main
before_script:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
script:
- docker build -t $CI_REGISTRY_IMAGE/$PROJECT_NAME -f Dockerfile .
- docker push $CI_REGISTRY_IMAGE/$PROJECT_NAME:latest
pytest-python-310:
stage: test
tags:
- dind
only:
- merge_requests
before_script:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- docker build -t $CI_REGISTRY_IMAGE/$PROJECT_NAME -f Dockerfile .
script:
- export LOCAL_USER=$(whoami)
- export LOCAL_USER_ID=$(id -u)
- export PYTHON=/$PROJECT_NAME/bin/python
- docker run --rm --volume ${PWD}:/workdir -e PYTHON -e LOCAL_USER_ID -e LOCAL_USER -t $CI_REGISTRY_IMAGE/$PROJECT_NAME:latest bash scripts/pytest.sh