-
Notifications
You must be signed in to change notification settings - Fork 30
/
.travis.yml
54 lines (45 loc) · 2.47 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
os: linux
dist: bionic
language: python
python:
- '3.12'
env:
global:
- BROKER_DB_HOST=localhost
- BROKER_DB_PORT=5435
- ERROR_REPORT_PATH="dataactcore/tmp/"
- ERROR_REPORT_PATH_ESCAPED="dataactcore\/tmp\/"
before_install:
- pip install setuptools==68.1.2
install:
# NOTE: no pip install needed as long as the one of the docker containers started below builds the
# `dataact-broker-backend` image, which has a volume bound to the source dir, and runs pip install to pull down deps
# Use the comment below to skip the travis automatic pip install -r requirements.txt
# - pip --version
before_script:
# Get dependencies to report code coverage to code climate
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
- chmod +x ./cc-test-reporter
- ./cc-test-reporter before-build
- cp dataactcore/config_example.yml dataactcore/config.yml
- cp dataactcore/local_config_example.yml dataactcore/local_config.yml
- cp dataactcore/local_secrets_example.yml dataactcore/local_secrets.yml
- mkdir ${ERROR_REPORT_PATH}
- 'sed -i.bak -E "s/host:.*$/host: ${BROKER_DB_HOST}/" dataactcore/local_config.yml'
- 'sed -i.bak -E "s/port:.*$/port: ${BROKER_DB_PORT}/" dataactcore/local_config.yml'
- 'sed -i.bak -E "s/error_report_path:.*$/error_report_path: ${ERROR_REPORT_PATH_ESCAPED}/" dataactcore/local_config.yml'
# Start a containerized database to use for tests, which also pulls pip packages required for build as the image is built
- docker-compose up -d --quiet-pull dataact-broker-db dataact-broker-init-db
script:
# Comment these out if we need to run in the Docker image
# - docker exec -it dataact-broker-backend /bin/bash -c 'flake8'
# - docker exec -it dataact-broker-backend /bin/bash -c 'pytest tests/unit/* --cov=. --cov-report xml:tests/coverage.xml --junitxml=tests/test-results.xml'
# - docker exec -it dataact-broker-backend /bin/bash -c 'pytest tests/integration/* --cov=. --cov-append --cov-report term --cov-report xml:tests/coverage.xml --junitxml=tests/test-results.xml'
- flake8
- pytest tests/unit --cov=. --cov-report xml:tests/coverage.xml --junitxml=tests/test-results.xml
- pytest tests/integration --cov=. --cov-append --cov-report term --cov-report xml:tests/coverage.xml --junitxml=tests/test-results.xml
after_script:
- docker-compose down
- rm -r ${ERROR_REPORT_PATH}
- mv tests/coverage.xml coverage.xml
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT