-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
124 lines (108 loc) · 3.28 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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
<<<<<<< HEAD
stages:
- web_validate
- app_test
- app_build
- server_test
build_debug:
image: "cirrusci/flutter:2.0.0"
stage: app_build
before_script:
- cd road_monitoring_system/
- export PATH="$PATH":"$HOME/.pub-cache/bin"
script:
- flutter pub get
- flutter build apk --debug --split-per-abi
artifacts:
paths:
- build/app/outputs/apk/debug/*.apk
build_release:
image: "cirrusci/flutter:2.0.0"
stage: app_build
before_script:
- cd road_monitoring_system/
- export PATH="$PATH":"$HOME/.pub-cache/bin"
script:
- flutter pub get
- flutter build apk --release --build-number=$CI_PIPELINE_ID
artifacts:
paths:
- build/app/outputs/apk/release/*.apk
code_quality:
image: "cirrusci/flutter:2.0.0"
stage: app_test
before_script:
- cd road_monitoring_system/
- export PATH="$PATH":"$HOME/.pub-cache/bin"
- pub global activate dart_code_metrics
script:
- metrics lib -r codeclimate > code-quality-report.json
artifacts:
paths:
- bin/cache/artifacts/flutter/
reports:
codequality: code-quality-report.json
test:
image: "cirrusci/flutter:2.0.0"
stage: app_test
before_script:
- cd road_monitoring_system/
- export PATH="$PATH":"$HOME/.pub-cache/bin"
- pub global activate junitreport
script:
- flutter test --coverage
# - lcov --summary coverage/lcov.info
- genhtml coverage/lcov.info --output=coverage
# coverage: '/lines\.*: \d+\.\d+\%/'
artifacts:
name: coverage
paths:
- bin/cache/artifacts/flutter/
reports:
junit: coverage.xml
web_validate:
stage: web_validate
image: node:latest
# Validate that the repository contains a package.json and extract a few values from it.
before_script:
- cd website/road_monitoring_system/
- |
if [[ ! -f package.json ]]; then
echo "No package.json found! A package.json file is required to publish a package to GitLab's NPM registry."
echo 'For more information, see https://docs.gitlab.com/ee/user/packages/npm_registry/#creating-a-project'
exit 1
fi
- NPM_PACKAGE_NAME=$(node -p "require('./package.json').name")
- NPM_PACKAGE_VERSION=$(node -p "require('./package.json').version")
- yarn install
# Validate that the package name is properly scoped to the project's root namespace.
# For more information, see https://docs.gitlab.com/ee/user/packages/npm_registry/#package-naming-convention
script:
- npm run build
test_server:
# To config services postgres
stage: test_server
variables:
POSTGRES_HOST: "db"
POSTGRES_DB: "postgres"
POSTGRES_USER: "postgres"
POSTGRES_PASSWORD: "postgres"
DATABASE_URL: "postgresql://postgres@db:5432/$POSTGRES_DB"
# Pick PostgreSQL service to be used on all builds.
# Only needed when using a docker container to run your tests in.
services:
- name: postgres:13
alias: db
# This folder is cached between builds
cache:
paths:
- ~/.cache/pip/
before_script:
- python -V # Print out python version for debugging
- apt-get update -q
- cd src/back
- pip install -r requirements.txt
script:
- python manage.py makemigrations
- python manage.py migrate
- python manage.py test --settings myServer.settings