forked from kresusapp/kresus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
93 lines (87 loc) · 3.17 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
83
84
85
86
87
88
89
90
91
92
93
# Note: We use --silent argument on yarn invocations to keep the output simple
# and readable through email notifications.
image: node:12
cache:
key: 'node-modules-kresus'
paths:
- node_modules/
- yarn.lock
stages:
- lint # Check code syntax and coding style
- build # Try to build Kresus code
- test # Run unit tests
# Lint and check last commit in a dedicated task
lint:
stage: lint
before_script:
# Reset the status of the cache.
- rm -fr ./node_modules yarn.lock
- yarn install
script:
# JS code lint.
- yarn run --silent check:lint-full
# Domain specific checks.
- yarn run --silent check:banks
- yarn run --silent check:locales
- yarn run --silent check:config
# Build the server and client code in dev and production
build:
stage: build
before_script:
- yarn install
script:
# Check everything builds correctly
- yarn run --silent build:ci
cache:
policy: pull
# Run tests
test:
stage: test
before_script:
- yarn install
- update-alternatives --install /usr/bin/python python $(which python3) 1
# Install weboob
- apt-get update && apt-get install -y python3-pip python3-lxml python3-dev python3-yaml locales
- echo "en_US UTF-8" > /etc/locale.gen
- locale-gen C.UTF-8 && update-locale C.UTF-8
- export LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8
- mkdir ./weboob
# Fix for outdated pip and setuptools.
- pip3 install --upgrade requests
- pip3 install weboob --target=./weboob
- pip3 install pylint
script:
# Lint Python code
- KRESUS_WEBOOB_DIR=./weboob yarn run --silent check:python
# Run the CI test suite without weboob installed
- yarn run --silent check:test
# Run the CI test suite again with weboob installed
- KRESUS_WEBOOB_DIR=./weboob yarn run --silent check:test
cache:
policy: pull
# Also ensure all the commits in the MR individually pass the tests and checks.
# This is done in this testing stage to fail as soon as possible the CI if there is an
# error in the last commit.
lint_history:
stage: test
before_script:
# Install JS deps
- yarn install
# Give it a Git identity for the rebase to work
- git config --global user.email "[email protected]"
- git config --global user.name "Gitlab CI"
# Abort any rebase in progress
- git rebase --abort 2> /dev/null || true
# Abort any merge in progress
- git merge --abort 2> /dev/null || true
# Install weboob
- update-alternatives --install /usr/bin/python python $(which python3) 1
- apt-get update && apt-get install -y python3-pip python3-lxml python3-dev python3-yaml locales
- echo "en_US UTF-8" > /etc/locale.gen
- locale-gen C.UTF-8 && update-locale C.UTF-8
- export LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8
- mkdir ./weboob
- pip3 install requests
- pip3 install weboob --target=./weboob
script:
- yarn run --silent check:full-history