lint.yml 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. # Workaround to enable usage of mixed SSH and Docker GitLab CI runners
  2. .template_lint:
  3. stage: lint
  4. extends:
  5. - .job_rules_default
  6. .template_lint_rails:
  7. extends:
  8. - .template_lint
  9. services:
  10. - !reference [.services, postgresql]
  11. before_script:
  12. - !reference [.scripts, source_rvm]
  13. - !reference [.scripts, bundle_install]
  14. - !reference [.scripts, configure_environment]
  15. - !reference [.scripts, zammad_db_init]
  16. # Must be a separate job because it uses a custom image.
  17. 'lint: shellcheck':
  18. extends:
  19. - .template_lint
  20. image: koalaman/shellcheck-alpine:stable
  21. cache: []
  22. before_script: []
  23. script:
  24. - shellcheck -S warning $(find . -name "*.sh" -o -name "functions" | egrep -v "/vendor|node_modules/")
  25. - shellcheck -S error script/init.d/*
  26. after_script: []
  27. 'lint: i18n & rails':
  28. extends:
  29. - .template_lint_rails
  30. cache: !reference [.cache, read_only_full]
  31. artifacts:
  32. expire_in: 1 week
  33. paths:
  34. - tmp/brakeman-report.html
  35. when: on_failure
  36. script:
  37. - !reference [.scripts, yarn_install]
  38. - echo "Checking .po file syntax..."
  39. - for FILE in i18n/*.pot i18n/*.po; do echo "Checking $FILE"; msgfmt -o /dev/null -c $FILE; done
  40. - echo "Checking .pot catalog consistency..."
  41. - bundle exec rails generate translation_catalog --check
  42. - echo "Brakeman security check..."
  43. - bundle exec brakeman -o /dev/stdout -o tmp/brakeman-report.html
  44. - echo "Rails zeitwerk:check autoloader check..."
  45. - bundle exec rails zeitwerk:check
  46. - .gitlab/check_graphql_api_consistency.sh
  47. 'lint: ruby & security':
  48. extends:
  49. - .template_lint
  50. before_script:
  51. - !reference [.scripts, source_rvm]
  52. - !reference [.scripts, bundle_install]
  53. script:
  54. - echo "Rubocop check..."
  55. - bundle exec .rubocop/validate_todos.rb
  56. - bundle exec rubocop --parallel
  57. - echo "bundler-audit security check..."
  58. - gem install bundler-audit
  59. - bundle-audit update
  60. - bundle-audit --ignore CVE-2015-9284
  61. - echo "Checking if chat assets need a rebuild..."
  62. - echo "Please see public/assets/chat/README.md for build instructions."
  63. - cp public/assets/chat/chat.js tmp/chat.js
  64. - yarn install --cwd public/assets/chat
  65. - (cd public/assets/chat && npx gulp build)
  66. - cmp public/assets/chat/chat.js tmp/chat.js
  67. 'lint: js & css':
  68. extends:
  69. - .template_lint
  70. cache: !reference [.cache, read_only_nodejs]
  71. before_script: []
  72. script:
  73. - echo "Coffeelint check..."
  74. - coffeelint --rules ./.coffeelint/rules/* app/
  75. - echo "Stylelint check..."
  76. - !reference [.scripts, yarn_install]
  77. - yarn lint:css
  78. - echo "ESLint check..."
  79. - yarn storybook:install
  80. - yarn lint
  81. - echo "Storybook test build..."
  82. - yarn storybook:build
  83. # Must be a separate job because it may fail and is only executed manually.
  84. 'lint: orphaned ruby gems':
  85. extends:
  86. - .template_lint_rails
  87. allow_failure: true
  88. rules:
  89. - if: $CI_MERGE_REQUEST_ID
  90. when: never
  91. - when: manual
  92. script:
  93. - bundle exec rake zammad:ci:bundle:orphaned 5
  94. 'refresh global envs':
  95. services:
  96. - !reference [.services, postgresql]
  97. stage: lint
  98. # ensure that only one Job runs in the whole project (branches etc.)
  99. resource_group: global_refresh_envs
  100. # allow download via the web UI to restore ENVs in case global cache got deleted (see: `.gitlab-ci.yml`)
  101. artifacts:
  102. expire_in: 1 week
  103. paths:
  104. - fresh.env
  105. rules:
  106. - if: $CI_MERGE_REQUEST_ID
  107. when: never
  108. - if: '$CI_COMMIT_BRANCH =~ /^private/'
  109. when: manual
  110. allow_failure: true
  111. - when: on_success
  112. script:
  113. - bundle exec rake zammad:ci:refresh_envs