Skip to content

Commit 3d178c9

Browse files
author
Nankai
authored
Update .gitlab-ci.yml
1 parent decb980 commit 3d178c9

File tree

1 file changed

+25
-68
lines changed

1 file changed

+25
-68
lines changed

.gitlab-ci.yml

Lines changed: 25 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ stages: # List of stages for jobs, and their order of execution
22
- analyze
33
- test
44
- coverage
5-
- semantic-version
5+
6+
variables:
7+
GIT_SUBMODULE_STRATEGY: recursive
8+
GIT_SUBMODULE_UPDATE_FLAGS: --jobs 4
69

710
default:
811
image: cirrusci/flutter:latest
@@ -11,39 +14,39 @@ cache:
1114
paths:
1215
- /flutter/bin/cache/dart-sdk
1316

14-
include:
15-
- template: Code-Quality.gitlab-ci.yml
16-
1717
code_quality:
1818
stage: analyze
1919
before_script:
20-
# - git config --global url."https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.com/technixo/flavorizr".insteadOf "git@gitlab.com:technixo/flavorizr.git"
21-
# - git submodule sync && git submodule update --init
22-
- pub global activate dart_code_metrics
20+
- git config --global url."https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.com/technixo/flavorizr".insteadOf "git@gitlab.com:technixo/flavorizr.git"
21+
- git submodule sync && git submodule update --init
2322
- export PATH="$PATH":"$HOME/.pub-cache/bin"
23+
- pub global activate dart_code_metrics
2424
script:
25-
- flutter --version
2625
- flutter analyze
27-
- metrics lib -r codeclimate > gl-code-quality-report.json
26+
- flutter pub global run dart_code_metrics:metrics analyze lib --reporter=json > gl-code-quality-report.json
27+
# - metrics lib -r codeclimate > gl-code-quality-report.json
28+
artifacts:
29+
reports:
30+
codequality: gl-code-quality-report.json
2831
rules:
32+
- if: $CI_COMMIT_BRANCH == "main"
33+
- if: $CI_COMMIT_BRANCH == "master"
2934
- if: $CI_COMMIT_BRANCH == "develop" && $CI_PIPELINE_SOURCE == "push"
30-
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
35+
- if: $CI_COMMIT_BRANCH == "develop" && $CI_PIPELINE_SOURCE == "merge_request_event"
3136
allow_failure: true
3237

33-
artifacts:
34-
paths: [gl-code-quality-report.json]
35-
3638
test-all:
3739
stage: test
38-
# before_script:
39-
# - git config --global url."https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.com/technixo/flavorizr".insteadOf "git@gitlab.com:technixo/flavorizr.git"
40-
# - git submodule sync && git submodule update --init
40+
before_script:
41+
- git config --global url."https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.com/technixo/flavorizr".insteadOf "git@gitlab.com:technixo/flavorizr.git"
42+
- git submodule sync && git submodule update --init
4143
script:
4244
- export PATH="$PATH":"$HOME/.pub-cache/bin"
4345
- pub global activate junitreport
4446
- flutter test --machine --coverage | tojunit -o report.xml
4547
only:
4648
refs:
49+
- main
4750
- master
4851
- develop
4952
artifacts:
@@ -52,21 +55,6 @@ test-all:
5255
reports:
5356
junit: report.xml
5457

55-
test-dev:
56-
stage: test
57-
# before_script:
58-
# - git config --global url."https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.com/technixo/flavorizr".insteadOf "git@gitlab.com:technixo/flavorizr.git"
59-
# - git submodule sync && git submodule update --init
60-
script:
61-
- export PATH="$PATH":"$HOME/.pub-cache/bin"
62-
- pub global activate junitreport
63-
- flutter test --machine | tojunit -o report.xml
64-
rules:
65-
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
66-
artifacts:
67-
reports:
68-
junit: report.xml
69-
7058
coverage: # This job runs in the test stage.
7159
stage: coverage # It only starts when the job in the build stage completes successfully.
7260
script:
@@ -91,44 +79,13 @@ coverage: # This job runs in the test stage.
9179
- chmod +x codecov
9280
- ./codecov -t $CODECOV_TOKEN
9381
- mv coverage/ public/
94-
only:
95-
refs:
96-
- master
97-
- develop
82+
rules:
83+
- if: $CI_COMMIT_BRANCH == "main"
84+
- if: $CI_COMMIT_BRANCH == "master"
85+
- if: $CI_COMMIT_BRANCH == "develop" && $CI_PIPELINE_SOURCE == "push"
86+
- if: $CI_COMMIT_BRANCH == "develop" && $CI_PIPELINE_SOURCE == "merge_request_event"
87+
9888
coverage: '/lines\.*: \d+\.\d+\%/'
9989
artifacts:
10090
paths:
10191
- public
102-
103-
variables:
104-
NPM_TOKEN: ${CI_JOB_TOKEN}
105-
106-
# semantic-version:
107-
# image: node:16
108-
# stage: semantic-version
109-
# before_script:
110-
# - npm ci --cache .npm --prefer-offline
111-
# - |
112-
# {
113-
# echo "@${CI_PROJECT_ROOT_NAMESPACE}:registry=${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/npm/"
114-
# echo "${CI_API_V4_URL#https?}/projects/${CI_PROJECT_ID}/packages/npm/:_authToken=\${CI_JOB_TOKEN}"
115-
# } | tee -a .npmrc
116-
# cache:
117-
# key: ${CI_COMMIT_REF_SLUG}
118-
# paths:
119-
# - .npm/
120-
# only:
121-
# refs:
122-
# - master
123-
# - develop
124-
# after_script:
125-
# - git config --global http.emptyAuth true
126-
# # Semantic Release - Label code (only once)
127-
# - npx -p @semantic-release/changelog -p semantic-release -p @semantic-release/gitlab -p @semantic-release/commit-analyzer -p @semantic-release/release-notes-generator semantic-release
128-
# script:
129-
# - touch CHANGELOG.md
130-
# - npm install @semantic-release/gitlab @semantic-release/changelog
131-
# - npx semantic-release
132-
# artifacts:
133-
# paths:
134-
# - CHANGELOG.md

0 commit comments

Comments
 (0)