Saltstack Official Salt Formula
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

.gitlab-ci.yml 6.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. # -*- coding: utf-8 -*-
  2. # vim: ft=yaml
  3. ---
  4. ###############################################################################
  5. # Define all YAML node anchors
  6. ###############################################################################
  7. .node_anchors:
  8. # `only` (also used for `except` where applicable)
  9. only_branch_master_parent_repo: &only_branch_master_parent_repo
  10. - 'master@saltstack-formulas/salt-formula'
  11. # `stage`
  12. stage_lint: &stage_lint 'lint'
  13. stage_release: &stage_release 'release'
  14. stage_test: &stage_test 'test'
  15. # `image`
  16. image_commitlint: &image_commitlint 'myii/ssf-commitlint:11'
  17. image_dindruby: &image_dindruby 'myii/ssf-dind-ruby:2.7.1-r3'
  18. image_precommit: &image_precommit
  19. name: 'myii/ssf-pre-commit:2.9.2'
  20. entrypoint: ['/bin/bash', '-c']
  21. image_semantic-release: &image_semanticrelease 'myii/ssf-semantic-release:15.14'
  22. # `services`
  23. services_docker_dind: &services_docker_dind
  24. - 'docker:dind'
  25. # `variables`
  26. # https://forum.gitlab.com/t/gitlab-com-ci-caching-rubygems/5627/3
  27. # https://bundler.io/v1.16/bundle_config.html
  28. variables_bundler: &variables_bundler
  29. BUNDLE_CACHE_PATH: '${CI_PROJECT_DIR}/.cache/bundler'
  30. BUNDLE_WITHOUT: 'production'
  31. # `cache`
  32. cache_bundler: &cache_bundler
  33. key: '${CI_JOB_STAGE}'
  34. paths:
  35. - '${BUNDLE_CACHE_PATH}'
  36. ###############################################################################
  37. # Define stages and global variables
  38. ###############################################################################
  39. stages:
  40. - *stage_lint
  41. - *stage_test
  42. - *stage_release
  43. variables:
  44. DOCKER_DRIVER: 'overlay2'
  45. ###############################################################################
  46. # `lint` stage: `commitlint` & `pre-commit`
  47. ###############################################################################
  48. commitlint:
  49. stage: *stage_lint
  50. image: *image_commitlint
  51. script:
  52. # Add `upstream` remote to get access to `upstream/master`
  53. - 'git remote add upstream ${CI_PROJECT_URL}.git'
  54. - 'git fetch --all'
  55. # Set default commit hashes for `--from` and `--to`
  56. - 'export COMMITLINT_FROM="$(git merge-base upstream/master HEAD)"'
  57. - 'export COMMITLINT_TO="${CI_COMMIT_SHA}"'
  58. # `coqbot` adds a merge commit to test PRs on top of the latest commit in
  59. # the repo; amend this merge commit message to avoid failure
  60. - |
  61. if [ "${GITLAB_USER_LOGIN}" = "coqbot" ] \
  62. && [ "${CI_COMMIT_BRANCH}" != "master" ]; then
  63. git commit --amend -m \
  64. 'chore: reword coqbot merge commit message for commitlint'
  65. export COMMITLINT_TO=HEAD
  66. fi
  67. # Run `commitlint`
  68. - 'commitlint --from "${COMMITLINT_FROM}"
  69. --to "${COMMITLINT_TO}"
  70. --verbose'
  71. pre-commit:
  72. stage: *stage_lint
  73. image: *image_precommit
  74. # https://pre-commit.com/#gitlab-ci-example
  75. variables:
  76. PRE_COMMIT_HOME: '${CI_PROJECT_DIR}/.cache/pre-commit'
  77. cache:
  78. key: '${CI_JOB_NAME}'
  79. paths:
  80. - '${PRE_COMMIT_HOME}'
  81. script:
  82. - 'pre-commit run --all-files --color always --verbose'
  83. ###############################################################################
  84. # Define `test` template
  85. ###############################################################################
  86. .test_instance:
  87. stage: *stage_test
  88. image: *image_dindruby
  89. services: *services_docker_dind
  90. variables: *variables_bundler
  91. cache: *cache_bundler
  92. before_script:
  93. # TODO: This should work from the env vars above automatically
  94. - 'bundle config set path "${BUNDLE_CACHE_PATH}"'
  95. - 'bundle config set without "${BUNDLE_WITHOUT}"'
  96. - 'bundle install'
  97. script:
  98. # Alternative value to consider: `${CI_JOB_NAME}`
  99. - 'bin/kitchen verify "${DOCKER_ENV_CI_JOB_NAME}"'
  100. ###############################################################################
  101. # `test` stage: each instance below uses the `test` template above
  102. ###############################################################################
  103. ## Define the rest of the matrix based on Kitchen testing
  104. # Make sure the instances listed below match up with
  105. # the `platforms` defined in `kitchen.yml`
  106. v3001-py3-debian-10-3001-py3: {extends: '.test_instance'}
  107. # v3001-py3-debian-9-3001-py3: {extends: '.test_instance'}
  108. v3001-py3-ubuntu-2004-3001-py3: {extends: '.test_instance'}
  109. # v3001-py3-ubuntu-1804-3001-py3: {extends: '.test_instance'}
  110. v3001-py3-centos-8-3001-py3: {extends: '.test_instance'}
  111. # v3001-py3-centos-7-3001-py3: {extends: '.test_instance'}
  112. v3001-py3-fedora-32-3001-py3: {extends: '.test_instance'}
  113. # v3001-py3-fedora-31-3001-py3: {extends: '.test_instance'}
  114. # v3001-py3-opensuse-leap-152-3001-py3: {extends: '.test_instance'}
  115. # v3001-py3-amazonlinux-2-3001-py3: {extends: '.test_instance'}
  116. v3001-py3-oraclelinux-8-3001-py3: {extends: '.test_instance'}
  117. # v3001-py3-oraclelinux-7-3001-py3: {extends: '.test_instance'}
  118. v3001-py3-gentoo-stage3-latest-3001-py3: {extends: '.test_instance'}
  119. v3001-py3-gentoo-stage3-systemd-3001-py3: {extends: '.test_instance'}
  120. # v3000-py3-debian-10-3000-3-py3: {extends: '.test_instance'}
  121. # v3000-py3-debian-9-3000-3-py3: {extends: '.test_instance'}
  122. # v3000-py3-ubuntu-1804-3000-3-py3: {extends: '.test_instance'}
  123. # v3000-py3-centos-8-3000-3-py3: {extends: '.test_instance'}
  124. # v3000-py3-centos-7-3000-3-py3: {extends: '.test_instance'}
  125. v3000-py3-opensuse-leap-152-3000-3-py3: {extends: '.test_instance'}
  126. v3000-py3-amazonlinux-2-3000-3-py3: {extends: '.test_instance'}
  127. # v3000-py3-oraclelinux-8-3000-3-py3: {extends: '.test_instance'}
  128. v3000-py3-oraclelinux-7-3000-3-py3: {extends: '.test_instance'}
  129. v3000-py2-ubuntu-1804-3000-3-py2: {extends: '.test_instance'}
  130. # v3000-py2-ubuntu-1604-3000-3-py2: {extends: '.test_instance'}
  131. # v3000-py3-gentoo-stage3-latest-3000-3-py3: {extends: '.test_instance'}
  132. # v3000-py3-gentoo-stage3-systemd-3000-3-py3: {extends: '.test_instance'}
  133. ###############################################################################
  134. # `release` stage: `semantic-release`
  135. ###############################################################################
  136. semantic-release:
  137. only: *only_branch_master_parent_repo
  138. stage: *stage_release
  139. image: *image_semanticrelease
  140. variables:
  141. MAINTAINER_TOKEN: '${GH_TOKEN}'
  142. script:
  143. # Update `AUTHORS.md`
  144. - '${HOME}/go/bin/maintainer contributor'
  145. # Run `semantic-release`
  146. - 'semantic-release'