/
.travis.yml
57 lines (47 loc) · 1.27 KB
/
.travis.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
sudo: required
dist: focal
language: python
python:
- "3.8"
services:
- docker
env:
- PYTHONDONTWRITEBYTECODE=1 # Hopefully prevents flaky tests
cache:
pip: true
directories:
- .venv
# Prepare environment
install:
- pip install -U poetry
- poetry config virtualenvs.in-project true
- poetry install
# Run tests and build images
script:
# Unit tests
- poetry run coverage run --include "saatja/*" -m pytest
# Docker builds
- docker build . -t lietu/saatja:latest
- if [[ "$TRAVIS_TAG" != "" ]]; then docker tag lietu/saatja:latest "lietu/saatja:$TRAVIS_TAG"; fi
# Put coverage report in location expected by codecov
- if [[ "$TRAVIS_PYTHON_VERSION" == "3.8" ]]; then
poetry run coverage xml -i;
mkdir coverage-reports;
mkdir -p coverage-reports;
mv coverage.xml coverage-reports/coverage-python.xml;
fi
# Publish code coverage report and Docker images
after_success:
- codecov
- docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
- docker push lietu/saatja:latest
- if [[ "$TRAVIS_TAG" != "" ]]; then docker push "lietu/saatja:$TRAVIS_TAG"; fi
# Deploy OpenAPI docs to GitHub Pages
deploy:
provider: pages
skip-cleanup: true
local-dir: openapi
github-token: $GITHUB_TOKEN
keep_history: true
on:
branch: master