forked from objectbox/objectbox-dart
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
75 lines (69 loc) · 2.49 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
stages:
- analyze
- test
variables:
# Note: use specific tags as docker images may not always be pulled due to "if-not-present" pull policy.
# Thus, do not use tags like latest/beta, but check https://hub.docker.com/_/dart?tab=tags for latest.
DART_VERSION: '2.18.5'
# Make PUB_CACHE cacheable in GitLab;
# see also https://gitlab.com/gitlab-org/gitlab/-/merge_requests/77791/diffs and
# https://dikman.medium.com/optimising-flutter-ci-by-caching-packages-8a1d537e0b23
# Requires extending job to set DART_VERSION variable.
.cache:
before_script:
- export PUB_CACHE="$CI_PROJECT_DIR/.pub-cache" # https://dart.dev/tools/pub/environment-variables
- export PATH="$PATH":"$PUB_CACHE/bin"
cache:
paths:
- $CI_PROJECT_DIR/.pub-cache/bin/
- $CI_PROJECT_DIR/.pub-cache/global_packages/
- $CI_PROJECT_DIR/.pub-cache/hosted/
key: "linux-x64-dart-$DART_VERSION-pub-cache"
# Analyzes Dart passes all lints rules and is formatted correctly (required to publish to pub.dev).
analyze:
extends: .cache
stage: analyze
tags: [ x64, linux, docker ]
image: dart:$DART_VERSION
script:
- cd objectbox
- dart run build_runner build
- dart analyze
- cd ..
- dart format --set-exit-if-changed --fix .
# Runs generator unit and integration tests, e.g. ensures generator works as expected.
test-generator:linux:x64:
extends: .cache
stage: test
tags: [ x64, linux, docker ]
image: dart:$DART_VERSION
script:
- ./install.sh
- ./generator/test.sh
- cd generator
- dart pub get
- dart test
.test:
extends: .cache
stage: test
script:
- ./install.sh
- cd objectbox
- dart pub get
- dart run build_runner build
# Run only one test suite (== test file) at a time.
# Print log for every completed test.
# Together, this will produce sequential log output, making it easier to attribute native logs.
- dart test --concurrency=1 --reporter expanded
test-lib:linux:x64:
extends: .test
tags: [ x64, linux, docker ]
image: dart:$DART_VERSION
needs: ["test-generator:linux:x64"] # Wait for generator test
parallel:
matrix:
# Note: use specific versions instead of latest/beta tags as Docker images may not always be
# pulled due to "if-not-present" pull policy. Check https://hub.docker.com/_/dart?tab=tags.
# Always include lowest supported version (see sdk key in objectbox and generator
# pubspec.yaml, but may be higher due to dependencies).
- DART_VERSION: [ '2.17.6', '2.18.5' ]