trabajo-afectivo/.gitlab/ci/pre.yml

91 lines
2.2 KiB
YAML
Raw Normal View History

# Workaround to enable usage of mixed SSH and Docker GitLab CI runners
.template_pre: &template_pre
stage: pre
extends:
- .tags_docker
- .rules_singletest
before_script:
- source /etc/profile.d/rvm.sh # ensure RVM is loaded
- source /opt/rh/rh-nodejs12/enable # ensure Node.js is available
rubocop:
<<: *template_pre
script:
- bundle install -j $(nproc) --path vendor
- bundle exec rubocop --parallel
shellcheck:
<<: *template_pre
image: koalaman/shellcheck-alpine:stable
before_script:
- echo "Disable default before_script."
script:
- shellcheck -S warning $(find . -name "*.sh" -o -name "functions" | grep -v "/vendor/")
zeitwerk_check:
<<: *template_pre
extends:
- .tags_docker
- .services_postgresql
script:
- bundle install -j $(nproc) --path vendor
- bundle exec ruby .gitlab/configure_environment.rb
- source .gitlab/environment.env
- bundle exec rake zammad:db:init
- bundle exec rails zeitwerk:check
brakeman:
<<: *template_pre
artifacts:
expire_in: 1 week
paths:
- tmp/brakeman-report.html
when: on_failure
script:
- bundle install -j $(nproc) --path vendor
- bundle exec brakeman -o /dev/stdout -o tmp/brakeman-report.html
coffeelint:
<<: *template_pre
script:
- coffeelint --rules ./.coffeelint/rules/* app/
bundle-audit:
<<: *template_pre
script:
- gem install bundler-audit
- bundle-audit update
- bundle-audit --ignore CVE-2015-9284
github:
<<: *template_pre
tags:
- deploy
before_script:
- "" # no RVM present in deploy ENV
script:
- script/build/sync_repo.sh git@github.com:zammad/zammad.git
global_refresh_envs:
extends:
- .tags_docker
- .services_postgresql
stage: pre
# ensure that only one Job runs in the whole project (branches etc.)
resource_group: global_refresh_envs
# allow download via the web UI to restore ENVs in case global cache got deleted (see: `.gitlab-ci.yml`)
artifacts:
expire_in: 1 day
paths:
- fresh.env
rules:
- if: $CI_MERGE_REQUEST_ID
when: never
- if: '$CI_COMMIT_BRANCH =~ /^private/'
when: manual
allow_failure: true
- when: on_success
script:
- bundle exec rake zammad:ci:refresh_envs