-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
70 lines (64 loc) · 1.9 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
image: docker-registry.wikimedia.org/python3-build-bullseye:latest
# Change pip's cache directory to be inside the project directory since we can
# only cache local items.
variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
# Pip's cache doesn't store the python packages
# https://pip.pypa.io/en/stable/reference/pip_install/#caching
#
# If you want to also cache the installed packages, you have to install
# them in a virtualenv and cache it as well.
cache:
paths:
- .cache/pip
- venv/
- node_modules/
stages: # List of stages for jobs, and their order of execution
- prep
- build
- test
- deploy
venv:
stage: prep
script:
- python3 -V # Print out python version for debugging
- pip3 install virtualenv
- if [ ! -d "./venv" ]
- then
- virtualenv --python=python3 venv
- fi
- source venv/bin/activate
- git submodule update --init --recursive
- pip3 install poetry pytest
- poetry build
npm:
image: docker-registry.wikimedia.org/releng/npm6:0.1.1
stage: build
script:
# From https://stackoverflow.com/q/61625191/1672995
- export NVM_DIR="$HOME/.nvm" && . "$NVM_DIR/nvm.sh" --no-use #load nvm
- eval "[ -f .nvmrc ] && nvm install || nvm install 14" #install node
- node --version
- npm --version
- npm install
- npm run build
- npx grunt
- npx tsc
pytest:
stage: test # It only starts when the job in the build stage completes successfully.
script:
- source venv/bin/activate
- poetry install
- pytest test/
deploy-testing:
stage: deploy
environment: data.releng.team
script:
- cp -af . /home/gitlab-runner/deploy
- cd /home/gitlab-runner/deploy
- virtualenv --python=python3 venv
- source /home/gitlab-runner/deploy.venv/bin/activate
- pip3 install poetry
- poetry install
- cp www/settings_staging.json www/settings.json
- touch /home/gitlab-runner/deploy/