chore: add CI

Signed-off-by: The one with the braid <info@braid.business>
This commit is contained in:
The one with the braid 2024-07-11 11:52:38 +02:00
parent 0863580b23
commit 3b3f58d9df

79
.gitlab-ci.yml Normal file
View file

@ -0,0 +1,79 @@
variables:
FLUTTER_VERSION: 3.22.2
image: registry.gitlab.com/theonewiththebraid/flutter-dockerimages:${FLUTTER_VERSION}-base
stages:
- coverage
- deploy
- publish
workflow:
rules:
- if: $CI_MERGE_REQUEST_IID
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
code_analyze:
stage: coverage
dependencies: []
script:
- dart pub get
- dart format lib test example --set-exit-if-changed
- dart analyze
- dart run import_sorter:main --no-comments --exit-if-changed
dart_test:
stage: coverage
image: dart
dependencies: [
code_analyze
]
script:
- dart pub get
- dart test
code_quality:
stage: coverage
image: dart
before_script:
- dart pub global activate dart_code_metrics
script:
- dart pub global run dart_code_metrics:metrics analyze lib -r gitlab > code-quality-report.json
artifacts:
reports:
codequality: code-quality-report.json
# also create an actual artifact for inspection purposes
paths:
- code-quality-report.json
dry-run:
stage: publish
image: dart
script:
- rm -rf ./docs
- dart pub get
- dart pub publish --dry-run
pub-dev:
stage: publish
image: dart
dependencies: [
dry-run
]
script:
- rm -rf ./docs
- |
if [ -z "${PUB_DEV_CREDENTIALS}" ]; then
echo "Missing PUB_DEV_CREDENTIALS environment variable"
exit 1
fi
mkdir -p ~/.config/dart
cp "${PUB_DEV_CREDENTIALS}" ~/.config/dart/pub-credentials.json
- dart pub get
- dart pub publish --force
rules:
- if: $CI_COMMIT_TAG