@seniorsistemas/exclusion-process-component 0.0.1-c049d10c-e93a-4d63-9c2a-b17bca40c324 → 0.6.0-44030ff3-2eeb-49f7-8927-0920cc01a805

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (200) hide show
  1. package/.editorconfig +19 -0
  2. package/.gitlab-ci.yml +74 -0
  3. package/.prettierrc +8 -0
  4. package/.senior-ci-extensions.sh +21 -0
  5. package/.vscode/settings.json +6 -0
  6. package/CHANGELOG.md +22 -0
  7. package/README.md +16 -0
  8. package/angular.json +144 -0
  9. package/archive.tar.gz +0 -0
  10. package/e2e/app.e2e-spec.ts +14 -0
  11. package/e2e/app.po.ts +11 -0
  12. package/e2e/tsconfig.e2e.json +14 -0
  13. package/karma.conf.js +53 -0
  14. package/lib/.browserslistrc +5 -0
  15. package/lib/package.json +19 -0
  16. package/{enums/enum-exclusion-process-status.d.ts → lib/src/enums/enum-exclusion-process-status.ts} +1 -1
  17. package/lib/src/exclusion-details/exclusion-details.component.html +84 -0
  18. package/lib/src/exclusion-details/exclusion-details.component.scss +47 -0
  19. package/lib/src/exclusion-details/exclusion-details.component.spec.ts +171 -0
  20. package/lib/src/exclusion-details/exclusion-details.component.ts +235 -0
  21. package/lib/src/exclusion-details/exclusion-details.module.ts +23 -0
  22. package/{exclusion-details/protocols/exclusion-details.d.ts → lib/src/exclusion-details/protocols/exclusion-details.ts} +1 -0
  23. package/{exclusion-details/protocols/show-details-information.d.ts → lib/src/exclusion-details/protocols/show-details-information.ts} +1 -1
  24. package/lib/src/exclusions-list/exclusions-list.component.html +157 -0
  25. package/lib/src/exclusions-list/exclusions-list.component.spec.ts +526 -0
  26. package/lib/src/exclusions-list/exclusions-list.component.ts +335 -0
  27. package/lib/src/exclusions-list/exclusions-list.module.ts +52 -0
  28. package/lib/src/exclusions-list/exclusions-list.routing.ts +89 -0
  29. package/lib/src/exclusions-list/index.ts +2 -0
  30. package/lib/src/logical-delete.module.ts +22 -0
  31. package/{models/exclusion-process-step-group.d.ts → lib/src/models/exclusion-process-step-group.ts} +1 -0
  32. package/{models/exclusion-process-step.d.ts → lib/src/models/exclusion-process-step.ts} +1 -0
  33. package/{models/exclusion-process.d.ts → lib/src/models/exclusion-process.ts} +1 -0
  34. package/{models/list-params.d.ts → lib/src/models/list-params.ts} +1 -0
  35. package/{models/project-config.d.ts → lib/src/models/project-config.ts} +3 -1
  36. package/lib/src/services/filter.service.spec.ts +290 -0
  37. package/lib/src/services/filter.service.ts +109 -0
  38. package/lib/src/services/index.ts +1 -0
  39. package/lib/src/services/logical-delete-config.service.spec.ts +59 -0
  40. package/lib/src/services/logical-delete-config.service.ts +25 -0
  41. package/lib/src/services/logical-delete.service.spec.ts +322 -0
  42. package/lib/src/services/logical-delete.service.ts +122 -0
  43. package/lib/test.ts +14 -0
  44. package/lib/tsconfig.lib.json +19 -0
  45. package/lib/tsconfig.lib.prod.json +6 -0
  46. package/lib/tsconfig.spec.json +12 -0
  47. package/lib/tslint.json +19 -0
  48. package/package.json +59 -18
  49. package/protractor.conf.js +28 -0
  50. package/senior-ci/.devcontainer/Dockerfile +27 -0
  51. package/senior-ci/.devcontainer/devcontainer.json +71 -0
  52. package/senior-ci/.editorconfig +14 -0
  53. package/senior-ci/.gitattributes +5 -0
  54. package/senior-ci/.gitlab-ci.yml +53 -0
  55. package/senior-ci/.pylintrc +562 -0
  56. package/senior-ci/.vscode/launch.json +102 -0
  57. package/senior-ci/CHANGELOG.md +1564 -0
  58. package/senior-ci/CONTRIBUTING.md +31 -0
  59. package/senior-ci/README.md +26 -0
  60. package/senior-ci/ci/ci.sh +74 -0
  61. package/senior-ci/ci/sonar_scanner.py +48 -0
  62. package/senior-ci/common/__init__.py +250 -0
  63. package/senior-ci/common/default-files/pom.xml +10 -0
  64. package/senior-ci/common/docker-helpers.sh +57 -0
  65. package/senior-ci/common/extensions.py +88 -0
  66. package/senior-ci/common/flutter-helpers.sh +3 -0
  67. package/senior-ci/common/getopt_helper.py +168 -0
  68. package/senior-ci/common/graphql_client.py +40 -0
  69. package/senior-ci/common/helm_helpers.py +40 -0
  70. package/senior-ci/common/notification-helpers.sh +15 -0
  71. package/senior-ci/common/npm-helper.sh +4 -0
  72. package/senior-ci/common/parallel-helper.sh +8 -0
  73. package/senior-ci/common/release-helpers.sh +196 -0
  74. package/senior-ci/common/s3cache-helpers.sh +47 -0
  75. package/senior-ci/common/senior-ci-extensions-helpers.sh +15 -0
  76. package/senior-ci/common/sonar_helper.py +203 -0
  77. package/senior-ci/common/validations/buildable_project.py +61 -0
  78. package/senior-ci/common/validations/check_deprecated_primitives.py +49 -0
  79. package/senior-ci/common/validations/check_project_path.py +40 -0
  80. package/senior-ci/common/validations/check_sonar_config_files.py +41 -0
  81. package/senior-ci/common/validations/check_tags.py +41 -0
  82. package/senior-ci/common/validations/validate_changelog.py +151 -0
  83. package/senior-ci/common/validations/validate_issues.py +320 -0
  84. package/senior-ci/docker/build.sh +18 -0
  85. package/senior-ci/docker/config-host.sh +29 -0
  86. package/senior-ci/docker/deploy-service.sh +79 -0
  87. package/senior-ci/docker/push.sh +22 -0
  88. package/senior-ci/frontend/npm/bibliotecas/ci.sh +149 -0
  89. package/senior-ci/frontend/npm/ci.sh +370 -0
  90. package/senior-ci/frontend/npm/release-translations.sh +164 -0
  91. package/senior-ci/helm/deploy.py +56 -0
  92. package/senior-ci/helm/publish.py +41 -0
  93. package/senior-ci/hook/release_notification.sh +88 -0
  94. package/senior-ci/hook/text_notification.sh +10 -0
  95. package/senior-ci/java/bibliotecas/ci.sh +215 -0
  96. package/senior-ci/java/sdl/ci.sh +372 -0
  97. package/senior-ci/java/sdl/scripts/hotfix.sh +78 -0
  98. package/senior-ci/mobile/flutter/apps/__main__.py +5 -0
  99. package/senior-ci/mobile/flutter/apps/ci.py +193 -0
  100. package/senior-ci/mobile/flutter/libs/__main__.py +5 -0
  101. package/senior-ci/mobile/flutter/libs/ci.py +178 -0
  102. package/senior-ci/mobile/flutter/scripts/release.sh +54 -0
  103. package/senior-ci/release-candidate/backend/get_version.sh +64 -0
  104. package/senior-ci/release-candidate/close_branch.sh +113 -0
  105. package/senior-ci/release-candidate/common/create_hotfix.sh +28 -0
  106. package/senior-ci/release-candidate/common/create_release.sh +30 -0
  107. package/senior-ci/release-candidate/create_branch.sh +64 -0
  108. package/senior-ci/release-candidate/frontend/get_version.sh +43 -0
  109. package/senior-ci/requirements-dev.txt +5 -0
  110. package/senior-ci/requirements.txt +5 -0
  111. package/senior-ci/scripts/apply_yamls.py +229 -0
  112. package/senior-ci/scripts/create_sre_issue/__main__.py +7 -0
  113. package/senior-ci/scripts/create_sre_issue/create_sre_issue.py +267 -0
  114. package/senior-ci/scripts/create_sre_issue/helpers.py +166 -0
  115. package/senior-ci/scripts/create_sre_issue/jira_manager.py +37 -0
  116. package/senior-ci/scripts/validate_changelog.sh +3 -0
  117. package/senior-ci/sonar-project.properties +1 -0
  118. package/server.js +5 -0
  119. package/sonar-project.properties +10 -0
  120. package/src/app/app.component.html +43 -0
  121. package/src/app/app.component.scss +36 -0
  122. package/src/app/app.component.ts +56 -0
  123. package/src/app/app.module.ts +64 -0
  124. package/src/app/shared/shared.module.ts +28 -0
  125. package/src/environments/environment.default.ts +3 -0
  126. package/src/environments/environment.prod.ts +6 -0
  127. package/src/environments/environment.ts +7 -0
  128. package/src/favicon.ico +0 -0
  129. package/src/index.html +17 -0
  130. package/src/locale/en-US.json +3 -0
  131. package/src/locale/es-ES.json +3 -0
  132. package/src/locale/pt-BR.json +3 -0
  133. package/src/main.ts +13 -0
  134. package/src/polyfills.ts +58 -0
  135. package/src/styles.scss +11 -0
  136. package/src/tsconfig.app.json +21 -0
  137. package/src/typings.d.ts +15 -0
  138. package/tsconfig.json +39 -0
  139. package/tslint.json +80 -0
  140. package/bundles/seniorsistemas-exclusion-process-component.umd.js +0 -747
  141. package/bundles/seniorsistemas-exclusion-process-component.umd.js.map +0 -1
  142. package/bundles/seniorsistemas-exclusion-process-component.umd.min.js +0 -16
  143. package/bundles/seniorsistemas-exclusion-process-component.umd.min.js.map +0 -1
  144. package/esm2015/enums/enum-exclusion-process-status.js +0 -8
  145. package/esm2015/exclusion-details/exclusion-details.component.js +0 -216
  146. package/esm2015/exclusion-details/exclusion-details.module.js +0 -28
  147. package/esm2015/exclusion-details/index.js +0 -3
  148. package/esm2015/exclusion-details/protocols/exclusion-details.js +0 -1
  149. package/esm2015/exclusion-details/protocols/index.js +0 -2
  150. package/esm2015/exclusion-details/protocols/show-details-information.js +0 -3
  151. package/esm2015/logical-delete.module.js +0 -27
  152. package/esm2015/models/exclusion-process-step-group.js +0 -1
  153. package/esm2015/models/exclusion-process-step.js +0 -1
  154. package/esm2015/models/exclusion-process.js +0 -1
  155. package/esm2015/models/index.js +0 -1
  156. package/esm2015/models/list-params.js +0 -1
  157. package/esm2015/models/list-result.js +0 -1
  158. package/esm2015/models/project-config.js +0 -3
  159. package/esm2015/public-api.js +0 -3
  160. package/esm2015/seniorsistemas-exclusion-process-component.js +0 -9
  161. package/esm2015/services/filter.service.js +0 -104
  162. package/esm2015/services/logical-delete-config.service.js +0 -29
  163. package/esm2015/services/logical-delete.service.js +0 -109
  164. package/esm5/enums/enum-exclusion-process-status.js +0 -8
  165. package/esm5/exclusion-details/exclusion-details.component.js +0 -235
  166. package/esm5/exclusion-details/exclusion-details.module.js +0 -31
  167. package/esm5/exclusion-details/index.js +0 -3
  168. package/esm5/exclusion-details/protocols/exclusion-details.js +0 -1
  169. package/esm5/exclusion-details/protocols/index.js +0 -2
  170. package/esm5/exclusion-details/protocols/show-details-information.js +0 -7
  171. package/esm5/logical-delete.module.js +0 -31
  172. package/esm5/models/exclusion-process-step-group.js +0 -1
  173. package/esm5/models/exclusion-process-step.js +0 -1
  174. package/esm5/models/exclusion-process.js +0 -1
  175. package/esm5/models/index.js +0 -1
  176. package/esm5/models/list-params.js +0 -1
  177. package/esm5/models/list-result.js +0 -1
  178. package/esm5/models/project-config.js +0 -3
  179. package/esm5/public-api.js +0 -3
  180. package/esm5/seniorsistemas-exclusion-process-component.js +0 -9
  181. package/esm5/services/filter.service.js +0 -109
  182. package/esm5/services/logical-delete-config.service.js +0 -30
  183. package/esm5/services/logical-delete.service.js +0 -112
  184. package/exclusion-details/exclusion-details.component.d.ts +0 -49
  185. package/exclusion-details/exclusion-details.module.d.ts +0 -2
  186. package/fesm2015/seniorsistemas-exclusion-process-component.js +0 -495
  187. package/fesm2015/seniorsistemas-exclusion-process-component.js.map +0 -1
  188. package/fesm5/seniorsistemas-exclusion-process-component.js +0 -530
  189. package/fesm5/seniorsistemas-exclusion-process-component.js.map +0 -1
  190. package/logical-delete.module.d.ts +0 -5
  191. package/seniorsistemas-exclusion-process-component.d.ts +0 -8
  192. package/seniorsistemas-exclusion-process-component.metadata.json +0 -1
  193. package/services/filter.service.d.ts +0 -19
  194. package/services/logical-delete-config.service.d.ts +0 -8
  195. package/services/logical-delete.service.d.ts +0 -20
  196. /package/{exclusion-details/index.d.ts → lib/src/exclusion-details/index.ts} +0 -0
  197. /package/{exclusion-details/protocols/index.d.ts → lib/src/exclusion-details/protocols/index.ts} +0 -0
  198. /package/{models/index.d.ts → lib/src/models/index.ts} +0 -0
  199. /package/{models/list-result.d.ts → lib/src/models/list-result.ts} +0 -0
  200. /package/{public-api.d.ts → lib/src/public-api.ts} +0 -0
@@ -0,0 +1,78 @@
1
+ #!/bin/bash
2
+ set -e # Exit at first error
3
+
4
+
5
+ set_version() {
6
+ if [ "$CIFRIENDLY" != "true" ]; then
7
+ sed -i "s/generator.app.version=.*/generator.app.version=${VERSION}/" sdl.properties
8
+ fi
9
+
10
+ mvn versions:set --batch-mode --errors -DgenerateBackupPoms=false -DnewVersion=$VERSION
11
+ mvn versions:set --batch-mode --errors -DgenerateBackupPoms=false -DnewVersion=$VERSION --file $OUTPUT
12
+ }
13
+
14
+
15
+ determine_properties() {
16
+ OUTPUT=$(grep "^generator.java.output\+[[:space:]]*\+=" sdl.properties | cut -d "=" -f 2 | tr -d '[[:space:]]')
17
+ : ${OUTPUT:=java}
18
+ CIFRIENDLY=$(grep "^generator.java.ciFriendlyVersion\+[[:space:]]*\+=" sdl.properties | head -1 | cut -d "=" -f 2 | tr -d '[[:space:]]')
19
+ : ${CIFRIENDLY:=false}
20
+
21
+ echo "[CI] - OUTPUT=$OUTPUT"
22
+ }
23
+
24
+
25
+ echo "[CI] Realizando release: hotfix. Versão - $VERSION"
26
+ echo "[CI] Completando o repositorio para executar o processo"
27
+
28
+ IS_SHALLOW=$(git rev-parse --is-shallow-repository)
29
+ if $IS_SHALLOW; then
30
+ git fetch --unshallow
31
+ fi
32
+ git fetch --all
33
+
34
+ # A variável $VERSION deve vir da configuração de pipeline
35
+ VERSION_HYPHEN=$(echo "v$VERSION" | sed "s/\.\([[:digit:]]\)/-\1/g")
36
+ DATE=$(date +%d\/%m\/%Y)
37
+
38
+ echo "[CI] Atualizando placeholders {version} ($VERSION) e {date} ($DATE) no CHANGELOG.md"
39
+ [[ $(grep --count "{version}" CHANGELOG.md) -ne 1 ]] && echo "Placeholder {version} not defined in CHANGELOG.md" && exit 1
40
+ [[ $(grep --count "{date}" CHANGELOG.md) -ne 1 ]] && echo "Placeholder {date} not defined in CHANGELOG.md" && exit 1
41
+ [[ $(grep --fixed-strings --count "# $VERSION" CHANGELOG.md) -ne 0 ]] && echo "Version $VERSION already defined in CHANGELOG.md" && exit 1
42
+
43
+ sed -i 's/{version}/'"$VERSION"'/' CHANGELOG.md
44
+ sed -i 's!{date}!'"$DATE"'!' CHANGELOG.md
45
+
46
+ determine_properties
47
+
48
+ mvn $PARALLEL clean generate-sources --batch-mode --errors --update-snapshots
49
+ set_version
50
+ git commit -a -m "Criando versão $VERSION" -m "[auto release]"
51
+
52
+ git fetch --all
53
+
54
+ echo "[CI] Criando a tag $VERSION_HYPHEN"
55
+ git tag --force --annotate $VERSION_HYPHEN -m "Liberação versão $VERSION"
56
+
57
+ # Removendo merge da tag pra branch develop
58
+ # echo "[CI] Realizando o merge da tag $VERSION_HYPHEN para a develop"
59
+ # git checkout develop
60
+ # git reset --hard origin/develop
61
+ # MERGE_MESSAGE=$(echo $(git rev-parse $VERSION_HYPHEN)$'\t\t'"tag '$VERSION_HYPHEN'" | git fmt-merge-msg)
62
+ # git merge $VERSION_HYPHEN --no-ff -m "$MERGE_MESSAGE" -m "[auto release]"
63
+ # git branch -D $CI_COMMIT_REF_SLUG
64
+
65
+ CI_REPOSITORY_URL_FOR_PUSH=$(echo "$CI_REPOSITORY_URL" | sed -e "s|.*@\(.*\)|git@\1|" -e "s|/|:|" )
66
+ git remote set-url --push origin "$CI_REPOSITORY_URL_FOR_PUSH"
67
+
68
+ echo "[CI] Todas as tags "
69
+
70
+ git tag
71
+
72
+ echo "[CI] Pushing tag to server "
73
+
74
+ git push --all --follow-tags
75
+
76
+ git push origin --tags
77
+
78
+ echo "[CI] Criação da release versão $VERSION realizado com sucesso. Execute o job 'package' para publicar esta versão no Docker Hub."
@@ -0,0 +1,5 @@
1
+ import sys
2
+ from ci import FlutterAppsCI
3
+
4
+ flutter_apps_ci = FlutterAppsCI(sys.argv[1:])
5
+ flutter_apps_ci.exec_ci()
@@ -0,0 +1,193 @@
1
+ """Scripts for Flutter CI"""
2
+
3
+ import getopt
4
+ import sys
5
+ from enum import Enum
6
+
7
+ from colorama import Fore
8
+
9
+ sys.path.append("./senior-ci")
10
+
11
+ from common import (
12
+ ExitCode,
13
+ exec_command,
14
+ exec_command_and_return,
15
+ exit_message,
16
+ get_env_variable_required,
17
+ print_message,
18
+ )
19
+ from common.extensions import Extensions
20
+ from common.sonar_helper import SonarHelper, SonarScannerType
21
+ from common.validations.buildable_project import BuildableProject
22
+ from common.validations.validate_issues import ProjectIssuesStatus
23
+
24
+
25
+ class Platform(Enum):
26
+ ANDROID = 1
27
+ IOS = 2
28
+
29
+
30
+ class FlutterAppsCI:
31
+ def __init__(self, argv):
32
+ try:
33
+ self.opts, self.args = getopt.getopt(
34
+ argv, "vbr:x", ["android", "ios", "flavor=", "target=", "apk"]
35
+ )
36
+ except getopt.GetoptError as err:
37
+ exit_message(err)
38
+
39
+ self.platform = None
40
+ self.flavor = None
41
+ self.target = None
42
+ self.build_apk = False
43
+ self._validade_options()
44
+ self._configure_platform()
45
+ self._configure_flavor()
46
+ self.buildable_project = BuildableProject()
47
+
48
+ def exec_ci(self):
49
+ for opt, arg in self.opts:
50
+ if opt == "-v":
51
+ self._validation()
52
+ elif opt == "-b":
53
+ self._build()
54
+ elif opt == "-r":
55
+ self._release(arg)
56
+ elif opt == "-x":
57
+ self._exec_sonar()
58
+ else:
59
+ exit_message("É preciso informar a opção referente a ação escolhida")
60
+
61
+ def _validation(self):
62
+ print_message("Executando validação de código")
63
+
64
+ extensions = Extensions()
65
+ extensions.before_build()
66
+
67
+ print_message("Executando validação do changelog")
68
+
69
+ command_result_changelog = exec_command_and_return(
70
+ "bash senior-ci/scripts/validate_changelog.sh"
71
+ )
72
+
73
+ if command_result_changelog.exit_code == ExitCode.ERROR:
74
+ exit_message("Validação de changelog finalizada com erro. Verifique")
75
+
76
+ print_message("Executando análise estática")
77
+
78
+ command_result_analyze = exec_command_and_return(
79
+ "fvm flutter analyze --no-pub --current-package --congratulate --preamble "
80
+ "--no-fatal-infos --no-fatal-warnings --suppress-analytics --write=analyzer-output.txt"
81
+ )
82
+
83
+ if command_result_analyze.exit_code == ExitCode.ERROR:
84
+ exit_message(
85
+ "Análise estática finalizada com erro. Testes não serão executados."
86
+ )
87
+
88
+ self._exec_tests()
89
+
90
+ extensions.after_build()
91
+
92
+ print(" ")
93
+ print_message(
94
+ "Verificação de código, execução de testes e analise estática finalizados com sucesso.",
95
+ Fore.GREEN,
96
+ )
97
+ print(" ")
98
+
99
+ def _build(self):
100
+ print_message("Executando build")
101
+ pipeline_id = get_env_variable_required("CI_PIPELINE_ID")
102
+
103
+ if not self.platform:
104
+ exit_message("É preciso informar a plataforma que deseja realizar o build.")
105
+
106
+ exec_command("fvm flutter clean")
107
+
108
+ string_build = "fvm flutter build"
109
+ if self.platform == Platform.ANDROID:
110
+ string_build += " apk" if self.build_apk else " appbundle"
111
+ else:
112
+ string_build += " ios"
113
+ string_build += f" --release --build-number={pipeline_id}"
114
+ if self.flavor and self.target:
115
+ string_build += f" --flavor={self.flavor} --target={self.target}"
116
+
117
+ if self.platform == Platform.ANDROID:
118
+ # Busca a Keystore das variáveis de ambiente e salva em um arquivo.
119
+ exec_command(
120
+ "cat $SCI_ANDROID_KEYSTORE_JKS | base64 --decode > ./android/upload-keystore.jks"
121
+ )
122
+
123
+ # Executa build
124
+ command_result = exec_command_and_return(string_build)
125
+
126
+ if command_result.exit_code == ExitCode.SUCCESS:
127
+ print(" ")
128
+ print_message("Build finalizado com sucesso.", Fore.GREEN)
129
+ print(" ")
130
+ else:
131
+ exit_message("Build finalizado com erro, verifique.")
132
+
133
+ @staticmethod
134
+ def _release(versioning_release):
135
+ exec_command(
136
+ f"bash senior-ci/mobile/flutter/scripts/release.sh -r {versioning_release}"
137
+ )
138
+
139
+ @staticmethod
140
+ def _exec_tests():
141
+ print_message("Executando testes")
142
+
143
+ command_result_test = exec_command_and_return(
144
+ "fvm flutter test --no-pub --reporter=expanded --coverage --suppress-analytics"
145
+ )
146
+
147
+ if command_result_test.exit_code == ExitCode.ERROR:
148
+ exit_message("Testes finalizados com erro, verifique.")
149
+
150
+ def _exec_sonar(self):
151
+
152
+ if not self.buildable_project.skip_build():
153
+
154
+ self._exec_tests()
155
+
156
+ sonar_helper = SonarHelper(sonar_scanner_type=SonarScannerType.FLUTTER)
157
+
158
+ sonar_helper.scanner_analyze()
159
+
160
+ def _validade_options(self):
161
+ len_opts = len(self.opts)
162
+
163
+ if len_opts == 0:
164
+ exit_message("É preciso informar as opções.")
165
+
166
+ def _configure_platform(self):
167
+ str_opts = str(self.opts)
168
+ if "android" in str_opts and "ios" in str_opts:
169
+ exit_message("Somente uma definição de plataforma é necessária.")
170
+ elif "android" in str_opts:
171
+ self.platform = Platform.ANDROID
172
+ self.opts.remove(tuple(("--android", "")))
173
+ elif "ios" in str_opts:
174
+ self.platform = Platform.IOS
175
+ self.opts.remove(tuple(("--ios", "")))
176
+ if "apk" in str_opts:
177
+ self.build_apk = True
178
+ self.opts.remove(tuple(("--apk", "")))
179
+
180
+ def _configure_flavor(self):
181
+ for opt, arg in self.opts:
182
+ if opt == "--flavor":
183
+ self.flavor = arg
184
+ if opt == "--target":
185
+ self.target = arg
186
+
187
+ if self.flavor and not self.target:
188
+ exit_message("Quando informado o flavor é necessário informar o target.")
189
+ elif not self.flavor and self.target:
190
+ exit_message("Quando informado o target é necessário informar o flavor.")
191
+ elif self.flavor and self.target:
192
+ self.opts.remove(tuple(("--flavor", self.flavor)))
193
+ self.opts.remove(tuple(("--target", self.target)))
@@ -0,0 +1,5 @@
1
+ import sys
2
+ from ci import FlutterLibsCI
3
+
4
+ flutter_libs_ci = FlutterLibsCI(sys.argv[1:])
5
+ flutter_libs_ci.exec_ci()
@@ -0,0 +1,178 @@
1
+ """Scripts for Flutter Libs CI"""
2
+
3
+ import getopt
4
+ import sys
5
+
6
+ from colorama import Fore
7
+
8
+ sys.path.append("./senior-ci")
9
+
10
+ from common import (
11
+ ExitCode,
12
+ exec_command,
13
+ exec_command_and_return,
14
+ exit_message,
15
+ print_message,
16
+ )
17
+ from common.extensions import Extensions
18
+ from common.sonar_helper import SonarHelper, SonarScannerType
19
+ from common.validations.buildable_project import BuildableProject
20
+ from common.validations.validate_issues import ProjectIssuesStatus
21
+
22
+
23
+ class FlutterLibsCI:
24
+ def __init__(self, argv):
25
+ try:
26
+ self.opts, self.args = getopt.getopt(argv, "vpr:x")
27
+ except getopt.GetoptError as err:
28
+ exit_message(err)
29
+
30
+ self._validade_options()
31
+ self.buildable_project = BuildableProject()
32
+
33
+ def exec_ci(self):
34
+ for opt, arg in self.opts:
35
+ if opt == "-v":
36
+ self._validation()
37
+ elif opt == "-p":
38
+ self._publish_pubdev()
39
+ elif opt == "-r":
40
+ self._release(arg)
41
+ elif opt == "-x":
42
+ self._exec_sonar()
43
+ else:
44
+ exit_message("É preciso informar a opção referente a ação escolhida")
45
+
46
+ def _validation(self):
47
+ extensions = Extensions()
48
+ extensions.before_build()
49
+
50
+ self._exec_dart_analyze()
51
+ self._exec_flutter_analyze()
52
+ self._exec_tests()
53
+
54
+ extensions.after_build()
55
+
56
+ def _publish_pubdev(self):
57
+ print(" ")
58
+ print_message(
59
+ "Iniciando a publicação da nova versão da biblioteca",
60
+ Fore.YELLOW,
61
+ )
62
+ print(" ")
63
+
64
+ self._config_runtime_pubignore()
65
+
66
+ exec_command("cat $SCI_PUB_DEV_CREDENTIALS > ~/.pub-cache/credentials.json")
67
+
68
+ exec_command("fvm dart pub publish --force")
69
+
70
+ print(" ")
71
+ print_message(
72
+ "Publicação da biblioteca finalizada.",
73
+ Fore.GREEN,
74
+ )
75
+
76
+ def _exec_dart_analyze(self):
77
+ print_message(
78
+ "Iniciando a execução da validação da biblioteca",
79
+ Fore.YELLOW,
80
+ )
81
+ print(" ")
82
+
83
+ self._config_runtime_pubignore()
84
+
85
+ command_result_analyze = exec_command_and_return(
86
+ "fvm dart pub publish --dry-run"
87
+ )
88
+
89
+ if command_result_analyze.exit_code == ExitCode.SUCCESS:
90
+ print(" ")
91
+ print_message(
92
+ "Validação da biblioteca finalizada com sucesso.",
93
+ Fore.GREEN,
94
+ )
95
+ else:
96
+ print(" ")
97
+ exit_message("Validação da biblioteca finalizada com erro.")
98
+
99
+ @staticmethod
100
+ def _exec_flutter_analyze():
101
+ print(" ")
102
+ print_message(
103
+ "Iniciando a execução da análise estática",
104
+ Fore.YELLOW,
105
+ )
106
+ print(" ")
107
+
108
+ command_result_analyze = exec_command_and_return(
109
+ "fvm flutter analyze --no-pub --current-package --congratulate --preamble "
110
+ "--no-fatal-infos --no-fatal-warnings --suppress-analytics --write=analyzer-output.txt"
111
+ )
112
+
113
+ if command_result_analyze.exit_code == ExitCode.SUCCESS:
114
+ print(" ")
115
+ print_message(
116
+ "Análise estática finalizada com sucesso.",
117
+ Fore.GREEN,
118
+ )
119
+ else:
120
+ print(" ")
121
+ exit_message("Análise estática finalizada com erro.")
122
+
123
+ @staticmethod
124
+ def _exec_tests():
125
+ print(" ")
126
+ print_message(
127
+ "Iniciando a execução dos testes unitários",
128
+ Fore.YELLOW,
129
+ )
130
+ print(" ")
131
+
132
+ command_result_test = exec_command_and_return(
133
+ "fvm flutter test --no-pub --reporter=expanded --coverage --suppress-analytics"
134
+ )
135
+
136
+ if command_result_test.exit_code == ExitCode.SUCCESS:
137
+ print(" ")
138
+ print_message(
139
+ "Execução dos testes finalizada com sucesso.",
140
+ Fore.GREEN,
141
+ )
142
+ else:
143
+ print(" ")
144
+ exit_message("Execução dos testes finalizada com erro.")
145
+
146
+ @staticmethod
147
+ def _release(versioning_release):
148
+ exec_command(
149
+ f"bash senior-ci/mobile/flutter/scripts/release.sh -r {versioning_release}"
150
+ )
151
+
152
+ def _exec_sonar(self):
153
+
154
+ if not self.buildable_project.skip_build():
155
+
156
+ self._exec_tests()
157
+
158
+ sonar_helper = SonarHelper(sonar_scanner_type=SonarScannerType.FLUTTER)
159
+
160
+ sonar_helper.scanner_analyze()
161
+
162
+ def _validade_options(self):
163
+ len_opts = len(self.opts)
164
+
165
+ if len_opts == 0:
166
+ exit_message("É preciso informar as opções.")
167
+
168
+ @staticmethod
169
+ def _config_runtime_pubignore():
170
+
171
+ exec_command("touch .pubignore")
172
+
173
+ gitignore_file = open(".gitignore", "r", encoding="utf-8")
174
+ pubignore_file = open(".pubignore", "a", encoding="utf-8")
175
+
176
+ gitignore_str = gitignore_file.read()
177
+
178
+ pubignore_file.write(f"\n{gitignore_str}\nsenior-ci/")
@@ -0,0 +1,54 @@
1
+ #!/bin/bash
2
+
3
+ set -e # Exit at first error
4
+
5
+ echo "----------------------------------------------------------------------------------"
6
+ echo "[CI] Variáveis:"
7
+ echo "[CI] - SCI_VERSION_TAG_FRONTEND=$SCI_VERSION_TAG_FRONTEND"
8
+ echo "[CI] - BRANCH/TAG: $CI_COMMIT_REF_SLUG"
9
+ echo "[CI] - NOME DO PROJETO: $CI_PROJECT_NAME"
10
+ echo "[CI] - ID DO PROJETO: $CI_PROJECT_ID"
11
+ echo "----------------------------------------------------------------------------------"
12
+
13
+ # Import release helpers
14
+ . ./senior-ci/common/release-helpers.sh
15
+
16
+ # Import Flutter helpers
17
+ . ./senior-ci/common/flutter-helpers.sh
18
+
19
+ # Import notification helpers
20
+ . ./senior-ci/common/notification-helpers.sh
21
+
22
+ # Senior CI Extensions
23
+ . ./senior-ci/common/senior-ci-extensions-helpers.sh
24
+
25
+ getopts "r" op;
26
+ case "$op" in
27
+
28
+ r) echo "[CI] Realizando release: $2"
29
+ unshallow_repo
30
+
31
+ get_next_version $2
32
+
33
+ call_extension "before_release"
34
+
35
+ create_release_branch
36
+
37
+ sed -i "s/^version.*/version: $VERSION/g" pubspec.yaml
38
+
39
+ call_extension "before_change_changelog"
40
+
41
+ update_changelog
42
+
43
+ call_extension "after_change_changelog"
44
+
45
+ create_release_tag
46
+
47
+ call_extension "after_release"
48
+
49
+ echo "[CI] Criação da release versão $VERSION realizado com sucesso. Execute o job 'package' para publicar esta versão."
50
+
51
+ notify_release_teams_channel
52
+ ;;
53
+
54
+ esac
@@ -0,0 +1,64 @@
1
+ #!/bin/bash
2
+ MAVEN_CLI_OPTS="--batch-mode --errors --update-snapshots --fail-at-end --no-transfer-progress"
3
+
4
+ determine_properties() {
5
+ OUTPUT=$(grep "^generator.java.output\+[[:space:]]*\+=" sdl.properties | cut -d "=" -f 2 | tr -d '[[:space:]]')
6
+ : ${OUTPUT:=java}
7
+ CIFRIENDLY=$(grep "^generator.java.ciFriendlyVersion\+[[:space:]]*\+=" sdl.properties | head -1 | cut -d "=" -f 2 | tr -d '[[:space:]]')
8
+ : ${CIFRIENDLY:=false}
9
+
10
+ echo "[CI] - OUTPUT=$OUTPUT"
11
+ }
12
+
13
+ set_version() {
14
+ if [ "$CIFRIENDLY" != "true" ]; then
15
+ sed -i "s/generator.app.version=.*/generator.app.version=${VERSION}/" sdl.properties
16
+ fi
17
+
18
+ mvn $MAVEN_CLI_OPTS versions:set -DgenerateBackupPoms=false -DnewVersion=$VERSION
19
+ mvn $MAVEN_CLI_OPTS versions:set -DgenerateBackupPoms=false -DnewVersion=$VERSION --file $OUTPUT/pom.xml
20
+ }
21
+
22
+ change_version() {
23
+ determine_properties
24
+
25
+ mvn $MAVEN_CLI_OPTS clean generate-sources
26
+
27
+ set_version
28
+ }
29
+
30
+ HEAD="$(git show -s --pretty=%d HEAD)"
31
+
32
+ echo $HEAD
33
+
34
+ VERSION="$(echo "$HEAD" | cut -d ',' -f2 | sed "s/-\([[:digit:]]\)/\.\1/g" | sed "s/[^[:digit:].]//g")"
35
+
36
+ echo "head version: $VERSION"
37
+
38
+ SDL_PROPERTIES="sdl.properties"
39
+
40
+ if [[ -z "${VERSION}" && -f "$SDL_PROPERTIES" ]]; then
41
+ VERSION=$(cat $SDL_PROPERTIES | grep "generator.app.version=" | head -1 | cut -d "=" -f 2 | sed "s/[{, }, \", ',[:space:]]//g";)
42
+ fi
43
+
44
+ echo "sdl.properties version: $VERSION"
45
+
46
+ if [ "$1" == "major" -o "$1" == "minor" -o "$1" == "patch" ]; then
47
+ get_next_version $1
48
+ fi
49
+
50
+ echo "senior-ci version: $VERSION"
51
+
52
+ VERSION_HYPHEN=$(echo "v$VERSION" | sed "s/\.\([[:digit:]]\)/-\1/g")
53
+
54
+ git ls-remote --heads origin | grep -E "refs/heads/hotfix/${VERSION_HYPHEN}/$" >/dev/null
55
+
56
+ if [[ "$?" -eq "0" ]]; then
57
+ echo "[CI] Já tem um hotfix para gerar a versão $VERSION, iremos considerrar a próxima"
58
+
59
+ get_next_version $1 $VERSION
60
+
61
+ VERSION_HYPHEN = $(echo "v$VERSION" | sed "s/\.\([[:digit:]]\)/-\1/g");
62
+ fi
63
+
64
+ echo -e "[CI] Version $VERSION_HYPHEN will be created\n"
@@ -0,0 +1,113 @@
1
+ #!/bin/bash
2
+
3
+ usage()
4
+ {
5
+ printf "\nWelcome,"
6
+ printf "\nThis script is used with the propouse of optimize the version generation in your project\n"
7
+
8
+ printf "\nHow to Use:"
9
+ printf "\n\nA first parameter:"
10
+ printf "\nUse '-r' to close a release branch"
11
+ printf "\nUse '-h' to close a hotfix branch"
12
+ printf "\n\nAnd a second parameter:"
13
+ printf "\nUse '--front' to close a frontend repository"
14
+ printf "\nUse '--back' to close a backend repository"
15
+ printf "\n"
16
+ }
17
+
18
+ invalid()
19
+ {
20
+ printf "\n $1 Option or Argument is invalid.\n"
21
+ }
22
+
23
+ case $1 in
24
+ -r)
25
+ BRANCH="release"
26
+ ;;
27
+ -h)
28
+ BRANCH="hotfix"
29
+ ;;
30
+ *)
31
+ invalid $1;
32
+ usage;
33
+ ;;
34
+ esac
35
+
36
+ case $2 in
37
+ --back)
38
+ REPO=back
39
+ ;;
40
+ --front)
41
+ REPO=front
42
+ ;;
43
+ *)
44
+ invalid $2;
45
+ usage;
46
+ exit 1
47
+ ;;
48
+ esac
49
+
50
+ # Senior CI Extensions
51
+ . senior-ci/common/senior-ci-extensions-helpers.sh
52
+
53
+ # Import release helpers
54
+ . senior-ci/common/release-helpers.sh
55
+
56
+ # Import notification helpers
57
+ . senior-ci/common/notification-helpers.sh
58
+
59
+ get_version_release_candidate
60
+
61
+ git checkout $BRANCH/$VERSION_HYPHEN
62
+ git reset --hard origin/$BRANCH/$VERSION_HYPHEN
63
+
64
+ call_extension "before_change_changelog"
65
+
66
+ update_changelog_date
67
+
68
+ delete_empty_info_changelog
69
+
70
+ call_extension "after_change_changelog"
71
+
72
+ git commit -a -m "[CI] Fechando versão $VERSION" -m "[auto release]"
73
+
74
+ echo "[CI] Realizando o merge do branch $BRANCH/$VERSION_HYPHEN para a master"
75
+ git checkout master
76
+ git reset --hard origin/master
77
+ MERGE_MESSAGE=$(echo $(git rev-parse $BRANCH/$VERSION_HYPHEN)$'\t\t'"branch '$BRANCH/$VERSION_HYPHEN'" | git fmt-merge-msg)
78
+ git merge $BRANCH/$VERSION_HYPHEN --no-ff -m "$MERGE_MESSAGE" -m "[auto release]" -X theirs --allow-unrelated-histories
79
+
80
+ echo "[CI] Criando a tag $VERSION_HYPHEN"
81
+ git tag --force --annotate $VERSION_HYPHEN -m "Liberação da versão $VERSION"
82
+
83
+ echo "[CI] Realizando o merge da tag $VERSION_HYPHEN para a develop"
84
+ git checkout develop
85
+ git reset --hard origin/develop
86
+ MERGE_MESSAGE=$(echo $(git rev-parse $VERSION_HYPHEN)$'\t\t'"tag '$VERSION_HYPHEN'" | git fmt-merge-msg)
87
+ git merge $VERSION_HYPHEN --no-ff -m "$MERGE_MESSAGE" -m "[auto release]" --allow-unrelated-histories
88
+
89
+ # Replace temp placeholder for no conflits
90
+ sed -i 's/{versionTemp}/{version}/' CHANGELOG.md
91
+ sed -i 's/{dateTemp}/{date}/' CHANGELOG.md
92
+
93
+ git commit -a -m "[CI] Update Changelog" -m "[auto release]"
94
+
95
+ echo "[CI] Merges concluídos. Excluindo branch $BRANCH/$VERSION_HYPHEN"
96
+ git branch -D $BRANCH/$VERSION_HYPHEN
97
+
98
+ push_branch_changes
99
+
100
+ git push --delete origin $BRANCH/$VERSION_HYPHEN
101
+ git push --all --follow-tags
102
+
103
+ echo "[CI] Processo de GitFlow concluído."
104
+
105
+ send_to_gitlab_cloud
106
+
107
+ call_extension "after_release"
108
+
109
+ echo "[CI] Criação da versão $VERSION realizado com sucesso. Execute o job 'package' para publicar esta versão no AWS S3."
110
+
111
+ notify_release_teams_channel
112
+
113
+ exit