-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path.gitlab-ci.yml
82 lines (76 loc) · 2.57 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
image: 'debian:bullseye'
before_script:
- apt-get update
# Runtime dependencies
- apt-get -y install python3-django
- apt-get -y install python3-requests python3-django-jsonfield python3-django-captcha python3-debian python3-debianbts python3-apt python3-yaml python3-bs4 python3-pyinotify python3-gpg python3-django-debug-toolbar
# Test dependencies
- apt-get -y install python3-coverage python3-selenium python3-responses chromium-driver python3-pip postgresql postgresql-client python3-psycopg2
# Dependencies to build docs
- apt-get -y install make python3-sphinx python3-sphinx-rtd-theme
- export LANG=C
flake8:
script:
- pip3 install --upgrade flake8 # Ensure we have the latest version
- python3 -m flake8 django_email_accounts/ functional_tests/ distro_tracker/
except:
- schedules
unit-tests:
script:
- service postgresql start || true
- su - postgres -c "createuser -d root"
- python3 -m coverage erase
- python3 -m coverage run -p ./manage.py test django_email_accounts distro_tracker
- USE_PG=1 python3 -m coverage run -p ./manage.py test django_email_accounts distro_tracker
- python3 -m coverage combine
- python3 -m coverage report | sed -e 's/^TOTAL /TOTAL COVERAGE/'
- service postgresql stop || true
coverage: '/TOTAL COVERAGE.* (\d+(?:\.\d+)?%)/'
artifacts:
paths:
- .coverage
when: always
expire_in: 6h
except:
- schedules
functional-tests:
# We have to run the tests as user nobody as chromium will not run as root
script:
- chown nobody data # Grant write rights to user nobody
- runuser -u nobody python3 ./manage.py test functional_tests
after_script:
- chown root data
except:
- schedules
pages:
stage: deploy
dependencies: # To retrieve .coverage artifact
- unit-tests
script:
- make -C docs html
- mv docs/_build/html/ public/
- python3 -m coverage html -d public/coverage
when: always
artifacts:
paths:
- public
only:
refs:
- master
variables:
# Build the documentation only in the official repository, not in forks
- $CI_PROJECT_PATH == "qa/distro-tracker"
except:
- schedules
sample-database:
only:
- schedules
script:
- cp distro_tracker/project/settings/local.py.sample-debian-dev distro_tracker/project/settings/local.py
- python3 manage.py migrate
- python3 manage.py loaddata distro_tracker/core/fixtures/sample-database-repositories.xml
- python3 manage.py tracker_update_repositories
artifacts:
paths:
- data/distro-tracker.sqlite
expire_in: 1 weeks