Maintenance: Reorganize CI jobs in "pre" stage to reduce overall CI load.

This commit is contained in:
Martin Gruner 2022-02-08 16:05:17 +01:00
parent 3d8398769a
commit ac3e020ef9

View file

@ -22,13 +22,8 @@
- source .gitlab/environment.env - source .gitlab/environment.env
- bundle exec rake zammad:db:init - bundle exec rake zammad:db:init
rubocop: # Must be a separate job because it uses a custom image.
<<: *template_pre "lint: shellcheck":
script:
- bundle install -j $(nproc) --path vendor
- bundle exec rubocop --parallel
shellcheck:
<<: *template_pre <<: *template_pre
image: koalaman/shellcheck-alpine:stable image: koalaman/shellcheck-alpine:stable
before_script: before_script:
@ -36,58 +31,41 @@ shellcheck:
script: script:
- shellcheck -S warning $(find . -name "*.sh" -o -name "functions" | grep -v "/vendor/") - shellcheck -S warning $(find . -name "*.sh" -o -name "functions" | grep -v "/vendor/")
gettext lint: "lint: i18n, rails & security":
<<: *template_pre
before_script:
- echo "Disable default before_script."
script:
- for FILE in i18n/*.pot i18n/*.po; do echo "Checking $FILE"; msgfmt -o /dev/null -c $FILE; done
gettext catalog consistency:
<<: *template_pre_rails <<: *template_pre_rails
extends:
- .tags_docker
- .services_postgresql
script:
- bundle exec rails generate translation_catalog --check
zeitwerk:check:
<<: *template_pre_rails
script:
- bundle exec rails zeitwerk:check
brakeman:
<<: *template_pre
artifacts: artifacts:
expire_in: 1 week expire_in: 1 week
paths: paths:
- tmp/brakeman-report.html - tmp/brakeman-report.html
when: on_failure when: on_failure
script: script:
- bundle install -j $(nproc) --path vendor - echo "Checking .po file syntax..."
- for FILE in i18n/*.pot i18n/*.po; do echo "Checking $FILE"; msgfmt -o /dev/null -c $FILE; done
- echo "Checking .pot catalog consistency..."
- bundle exec rails generate translation_catalog --check
- echo "Brakeman security check..."
- bundle exec brakeman -o /dev/stdout -o tmp/brakeman-report.html - bundle exec brakeman -o /dev/stdout -o tmp/brakeman-report.html
- echo "bundler-audit security check..."
coffeelint:
<<: *template_pre
script:
- coffeelint --rules ./.coffeelint/rules/* app/
stylelint:
<<: *template_pre
before_script:
- source /opt/rh/rh-nodejs*/enable
- yarn install
script:
- yarn lint:css
bundle-audit:
<<: *template_pre
script:
- gem install bundler-audit - gem install bundler-audit
- bundle-audit update - bundle-audit update
- bundle-audit --ignore CVE-2015-9284 - bundle-audit --ignore CVE-2015-9284
- echo "Rails zeitwerk:check autoloader check..."
- bundle exec rails zeitwerk:check
bundle-orphaned: "lint: ruby, js & css":
<<: *template_pre
script:
- echo "Coffeelint check..."
- coffeelint --rules ./.coffeelint/rules/* app/
- echo "Stylelint check..."
- yarn install
- yarn lint:css
- echo "Rubocop check..."
- bundle install -j $(nproc) --path vendor
- bundle exec rubocop --parallel
# Must be a separate job because it may fail and is only executed for develop.
"lint: orphaned ruby gems":
<<: *template_pre_rails <<: *template_pre_rails
allow_failure: true allow_failure: true
rules: rules:
@ -99,7 +77,8 @@ bundle-orphaned:
script: script:
- bundle exec rake zammad:ci:bundle:orphaned 5 - bundle exec rake zammad:ci:bundle:orphaned 5
github: # Executed on a dedicated runner.
"push to github":
<<: *template_pre <<: *template_pre
tags: tags:
- deploy - deploy