Skip to content

Commit 5380d84

Browse files
greenrobotgreenrobot-team
authored andcommitted
Add basic GitLab CI config.
1 parent d4b3cb2 commit 5380d84

File tree

1 file changed

+65
-0
lines changed

1 file changed

+65
-0
lines changed

.gitlab-ci.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
stages:
2+
- analyze
3+
- test
4+
5+
variables:
6+
# Note: use specific tags as docker images may not always be pulled due to "if-not-present" pull policy.
7+
# Thus, do not use tags like latest/beta, but check https://hub.docker.com/_/dart?tab=tags for latest.
8+
DART_VERSION: '2.16.1'
9+
10+
# Make PUB_CACHE cacheable in GitLab;
11+
# see also https://gitlab.com/gitlab-org/gitlab/-/merge_requests/77791/diffs and
12+
# https://dikman.medium.com/optimising-flutter-ci-by-caching-packages-8a1d537e0b23
13+
# Requires extending job to set DART_VERSION variable.
14+
.cache:
15+
before_script:
16+
- export PUB_CACHE="$CI_PROJECT_DIR/.pub-cache" # https://dart.dev/tools/pub/environment-variables
17+
- export PATH="$PATH":"$PUB_CACHE/bin"
18+
cache:
19+
paths:
20+
- $CI_PROJECT_DIR/.pub-cache/bin/
21+
- $CI_PROJECT_DIR/.pub-cache/global_packages/
22+
- $CI_PROJECT_DIR/.pub-cache/hosted/
23+
key: "linux-x64-dart-$DART_VERSION-pub-cache"
24+
25+
# Analyzes Dart passes all lints rules and is formatted correctly (required to publish to pub.dev).
26+
analyze:
27+
extends: .cache
28+
stage: analyze
29+
tags: [ x64, linux, docker ]
30+
image: dart:$DART_VERSION
31+
script:
32+
- cd objectbox
33+
- dart run build_runner build
34+
- dart analyze
35+
- cd ..
36+
- dart format --set-exit-if-changed --fix .
37+
38+
# Runs generator integration tests, e.g. ensures generator works as expected.
39+
test-generator:linux:x64:
40+
extends: .cache
41+
stage: test
42+
tags: [ x64, linux, docker ]
43+
image: dart:$DART_VERSION
44+
script:
45+
- ./install.sh
46+
- ./generator/test.sh
47+
48+
.test:
49+
extends: .cache
50+
stage: test
51+
script:
52+
- ./install.sh
53+
- cd objectbox
54+
- dart pub get
55+
- dart run build_runner build
56+
57+
test-lib:linux:x64:
58+
extends: .test
59+
tags: [ x64, linux, docker ]
60+
image: dart:$DART_VERSION
61+
parallel:
62+
matrix:
63+
# Note: use specific tags as docker images may not always be pulled due to "if-not-present" pull policy.
64+
# Thus, do not use tags like latest/beta, but check https://hub.docker.com/_/dart?tab=tags for latest.
65+
- DART_VERSION: [ '2.16.1', '2.16.0', '2.15.1', '2.15.0', '2.14.4', '2.13.4' ]

0 commit comments

Comments
 (0)