2022-08-13 15:12:31 +05:30
|
|
|
# You can copy and paste this template into a new `.gitlab-ci.yml` file.
|
|
|
|
# You should not add this template to an existing `.gitlab-ci.yml` file by using the `include:` keyword.
|
|
|
|
#
|
2021-09-30 23:02:18 +05:30
|
|
|
# To contribute improvements to CI/CD templates, please follow the Development guide at:
|
|
|
|
# https://docs.gitlab.com/ee/development/cicd/templates.html
|
|
|
|
# This specific template is located at:
|
|
|
|
# https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Dart.gitlab-ci.yml
|
|
|
|
|
2022-08-27 11:52:29 +05:30
|
|
|
# https://hub.docker.com/_/dart
|
|
|
|
image: dart:2.17
|
2020-07-28 23:09:34 +05:30
|
|
|
|
|
|
|
variables:
|
2022-08-27 11:52:29 +05:30
|
|
|
# To learn more go to https://dart.dev/tools/dart-test
|
|
|
|
# Or run `dart test --help`
|
2020-07-28 23:09:34 +05:30
|
|
|
PUB_VARS: "--platform vm --timeout 30s --concurrency=6 --test-randomize-ordering-seed=random --reporter=expanded"
|
|
|
|
|
2022-08-27 11:52:29 +05:30
|
|
|
.use-pub-cache-bin:
|
|
|
|
# Define commands that need to be executed before each job.
|
|
|
|
before_script:
|
|
|
|
# Set PUB_CACHE either here or in the CI/CD Settings if you have multiple jobs that use dart commands.
|
|
|
|
# PUB_CACHE is used by the `dart pub` command, it needs to be set so package dependencies are stored at the project-level for CI/CD operations.
|
|
|
|
- export PUB_CACHE=".pub-cache"
|
|
|
|
- export PATH="$PATH:$HOME/$PUB_CACHE/bin"
|
|
|
|
|
|
|
|
# Cache generated files and plugins between builds.
|
|
|
|
.upload-cache:
|
|
|
|
cache:
|
|
|
|
when: 'on_success'
|
|
|
|
paths:
|
|
|
|
- .pub-cache/bin/
|
|
|
|
- .pub-cache/global_packages/
|
|
|
|
- .pub-cache/hosted/
|
|
|
|
- .dart_tool/
|
|
|
|
- .packages
|
|
|
|
|
2020-07-28 23:09:34 +05:30
|
|
|
# Cache downloaded dependencies and plugins between builds.
|
|
|
|
# To keep cache across branches add 'key: "$CI_JOB_NAME"'
|
2022-08-27 11:52:29 +05:30
|
|
|
.download-cache:
|
|
|
|
cache:
|
|
|
|
paths:
|
|
|
|
- .dart_tool/
|
|
|
|
- .packages
|
|
|
|
policy: pull
|
|
|
|
|
|
|
|
install-dependencies:
|
|
|
|
stage: .pre
|
|
|
|
extends:
|
|
|
|
- .use-pub-cache-bin
|
|
|
|
- .upload-cache
|
|
|
|
script:
|
|
|
|
- dart pub get --no-precompile
|
|
|
|
|
|
|
|
build:
|
|
|
|
stage: build
|
|
|
|
needs:
|
|
|
|
- install-dependencies
|
|
|
|
extends:
|
|
|
|
- .use-pub-cache-bin
|
|
|
|
- .upload-cache
|
|
|
|
script:
|
|
|
|
- dart pub get --offline --precompile
|
2020-07-28 23:09:34 +05:30
|
|
|
|
2022-08-27 11:52:29 +05:30
|
|
|
unit-test:
|
|
|
|
stage: test
|
|
|
|
needs:
|
|
|
|
- build
|
|
|
|
extends:
|
|
|
|
- .use-pub-cache-bin
|
|
|
|
- .download-cache
|
|
|
|
script:
|
|
|
|
- dart test $PUB_VARS
|
|
|
|
|
|
|
|
lint-test:
|
|
|
|
stage: test
|
|
|
|
needs:
|
|
|
|
- install-dependencies
|
|
|
|
extends:
|
|
|
|
- .use-pub-cache-bin
|
|
|
|
- .download-cache
|
|
|
|
script:
|
|
|
|
- dart analyze .
|
2020-07-28 23:09:34 +05:30
|
|
|
|
2022-08-27 11:52:29 +05:30
|
|
|
format-test:
|
2020-07-28 23:09:34 +05:30
|
|
|
stage: test
|
2022-08-27 11:52:29 +05:30
|
|
|
needs:
|
|
|
|
- install-dependencies
|
|
|
|
extends:
|
|
|
|
- .use-pub-cache-bin
|
|
|
|
- .download-cache
|
2020-07-28 23:09:34 +05:30
|
|
|
script:
|
2022-08-27 11:52:29 +05:30
|
|
|
- dart format --set-exit-if-changed bin/ lib/ test/
|