Saltstack Official Syslog-NG Formula
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

155 行
6.3KB

  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/syslog-ng-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. default-debian-10-master-py3: {extends: '.test_instance'}
  107. # default-ubuntu-1804-master-py3: {extends: '.test_instance'}
  108. # default-centos-8-master-py3: {extends: '.test_instance'}
  109. # default-fedora-31-master-py3: {extends: '.test_instance'}
  110. # default-opensuse-leap-151-master-py3: {extends: '.test_instance'}
  111. # default-amazonlinux-2-master-py3: {extends: '.test_instance'}
  112. # default-debian-10-2019-2-py3: {extends: '.test_instance'}
  113. # default-debian-9-2019-2-py3: {extends: '.test_instance'}
  114. default-ubuntu-1804-2019-2-py3: {extends: '.test_instance'}
  115. # default-centos-8-2019-2-py3: {extends: '.test_instance'}
  116. # default-fedora-31-2019-2-py3: {extends: '.test_instance'}
  117. default-opensuse-leap-151-2019-2-py3: {extends: '.test_instance'}
  118. # default-centos-7-2019-2-py2: {extends: '.test_instance'}
  119. default-amazonlinux-2-2019-2-py3: {extends: '.test_instance'}
  120. # default-arch-base-latest-2019-2-py2: {extends: '.test_instance'}
  121. default-fedora-30-2018-3-py3: {extends: '.test_instance'}
  122. # default-debian-9-2018-3-py2: {extends: '.test_instance'}
  123. # default-ubuntu-1604-2018-3-py2: {extends: '.test_instance'}
  124. # default-centos-7-2018-3-py2: {extends: '.test_instance'}
  125. # default-opensuse-leap-151-2018-3-py2: {extends: '.test_instance'}
  126. # default-amazonlinux-1-2018-3-py2: {extends: '.test_instance'}
  127. default-arch-base-latest-2018-3-py2: {extends: '.test_instance'}
  128. # default-debian-8-2017-7-py2: {extends: '.test_instance'}
  129. # default-ubuntu-1604-2017-7-py2: {extends: '.test_instance'}
  130. # default-centos-6-2017-7-py2: {extends: '.test_instance'}
  131. # default-fedora-30-2017-7-py2: {extends: '.test_instance'}
  132. # default-opensuse-leap-151-2017-7-py2: {extends: '.test_instance'}
  133. # default-amazonlinux-1-2017-7-py2: {extends: '.test_instance'}
  134. # default-arch-base-latest-2017-7-py2: {extends: '.test_instance'}
  135. ###############################################################################
  136. # `release` stage: `semantic-release`
  137. ###############################################################################
  138. semantic-release:
  139. only: *only_branch_master_parent_repo
  140. stage: *stage_release
  141. image: *image_semanticrelease
  142. variables:
  143. MAINTAINER_TOKEN: '${GH_TOKEN}'
  144. script:
  145. # Update `AUTHORS.md`
  146. - '${HOME}/go/bin/maintainer contributor'
  147. # Run `semantic-release`
  148. - 'semantic-release'