2022-04-15 02:47:27 +00:00
|
|
|
stages:
|
|
|
|
- build
|
2022-04-15 18:39:51 +00:00
|
|
|
- test
|
2022-04-15 02:47:27 +00:00
|
|
|
|
|
|
|
buiild job:
|
|
|
|
stage: build
|
2022-04-15 03:31:48 +00:00
|
|
|
image: python:3-buster
|
2022-04-15 02:47:27 +00:00
|
|
|
script:
|
|
|
|
- export PYTHONPATH=.
|
|
|
|
- export FLASK_APP=period
|
2022-04-15 03:10:52 +00:00
|
|
|
- apt-get update -qy
|
2022-04-15 02:47:27 +00:00
|
|
|
- apt-get install -y python3-dev python3-pip
|
2022-04-15 03:27:13 +00:00
|
|
|
- pip3 install --upgrade pip
|
2022-04-15 03:25:48 +00:00
|
|
|
- pip3 install --upgrade setuptools
|
2022-04-15 03:24:16 +00:00
|
|
|
- pip3 install Flask gunicorn pytest pytest-cov
|
2022-04-15 18:07:35 +00:00
|
|
|
- pip3 install pendulum
|
2022-04-15 18:51:02 +00:00
|
|
|
- echo "DOCKER_IMAGE_NAME_TAG_WITH_DIGEST=${DOCKER_IMAGE_TAG_REF}@$(cat /digest-file)" > out.env
|
|
|
|
- cat out.env
|
|
|
|
artifacts:
|
2022-04-15 18:52:22 +00:00
|
|
|
reports:
|
|
|
|
dotenv: out.env
|
2022-04-15 18:51:02 +00:00
|
|
|
|
|
|
|
|
2022-04-15 18:39:51 +00:00
|
|
|
|
|
|
|
test job:
|
|
|
|
stage: test
|
2022-04-15 18:51:02 +00:00
|
|
|
needs:
|
2022-04-15 18:52:22 +00:00
|
|
|
- build
|
|
|
|
image: ${DOCKER_IMAGE_NAME_TAG_WITH_DIGEST}
|
|
|
|
before_script:
|
|
|
|
- echo "${DOCKER_IMAGE_NAME_TAG_WITH_DIGEST}"
|
2022-04-15 18:39:51 +00:00
|
|
|
script:
|
|
|
|
- export PYTHONPATH=.
|
|
|
|
- export FLASK_APP=period
|
|
|
|
- apt-get update -qy
|
|
|
|
- apt-get install -y python3-dev python3-pip
|
|
|
|
- pip3 install --upgrade pip
|
|
|
|
- pip3 install --upgrade setuptools
|
|
|
|
- pip3 install Flask gunicorn pytest pytest-cov
|
|
|
|
- pip3 install pendulum
|
2022-04-15 18:44:32 +00:00
|
|
|
- pytest tests --cov --cov-report term --cov-report html --junitxml=report.xml
|
|
|
|
artifacts:
|
|
|
|
when: always
|
|
|
|
reports:
|
2022-04-15 18:45:04 +00:00
|
|
|
junit: report.xml
|