debian-mirror-gitlab/.gitlab/ci/setup.gitlab-ci.yml
2022-11-25 23:54:43 +05:30

185 lines
5.1 KiB
YAML

# Insurance in case a gem needed by one of our releases gets yanked from
# rubygems.org in the future.
cache gems:
extends:
- .default-retry
- .ruby-cache
- .default-before_script
- .setup:rules:cache-gems
stage: prepare
needs: []
variables:
BUNDLE_WITHOUT: ""
BUNDLE_WITH: "production:development:test"
SETUP_DB: "false"
script:
- echo -e "\e[0Ksection_start:`date +%s`:bundle-package[collapsed=true]\r\e[0KPackaging gems"
- bundle config set cache_all true
- run_timed_command "bundle package --all-platforms"
- echo -e "\e[0Ksection_end:`date +%s`:bundle-package\r\e[0K"
artifacts:
paths:
- vendor/cache
expire_in: 31d
.minimal-job:
extends:
- .default-retry
needs: []
.absolutely-minimal-job:
extends:
- .minimal-job
image: ${GITLAB_DEPENDENCY_PROXY_ADDRESS}alpine:edge
variables:
GIT_STRATEGY: none
dont-interrupt-me:
extends:
- .absolutely-minimal-job
- .setup:rules:dont-interrupt-me
stage: sync
interruptible: false
script:
- echo "This jobs makes sure this pipeline won't be interrupted! See https://docs.gitlab.com/ee/ci/yaml/#interruptible."
gitlab_git_test:
extends:
- .minimal-job
- .setup:rules:gitlab_git_test
stage: test
script:
- spec/support/prepare-gitlab-git-test-for-commit --check-for-changes
no-ee-check:
extends:
- .minimal-job
- .setup:rules:no-ee-check
stage: test
script:
- scripts/no-dir-check ee
no-jh-check:
extends:
- .minimal-job
- .setup:rules:no-jh-check
stage: test
script:
- scripts/no-dir-check jh
verify-ruby-2.7:
extends:
- .absolutely-minimal-job
- .setup:rules:verify-ruby-2.7
stage: prepare
script:
- echo 'Please remove label ~"pipeline:run-in-ruby3" so we do test against Ruby 2.7 (default version) before merging the merge request'
- exit 1
verify-tests-yml:
extends:
- .setup:rules:verify-tests-yml
image: ${GITLAB_DEPENDENCY_PROXY_ADDRESS}ruby:${RUBY_VERSION}-alpine3.13
stage: test
needs: []
script:
- source scripts/utils.sh
- install_tff_gem
- scripts/verify-tff-mapping
verify-approvals:
extends:
- .minimal-job
- .setup:rules:jh-contribution
script:
- source scripts/utils.sh
- install_gitlab_gem
- tooling/bin/find_app_sec_approval
generate-frontend-fixtures-mapping:
extends:
- .setup:rules:generate-frontend-fixtures-mapping
- .use-pg12
- .rails-cache
needs: ["setup-test-env"]
stage: prepare
before_script:
- !reference [.default-before_script, before_script]
- source ./scripts/rspec_helpers.sh
- run_timed_command "scripts/gitaly-test-spawn"
script:
- generate_frontend_fixtures_mapping
artifacts:
expire_in: 7d
paths:
- ${FRONTEND_FIXTURES_MAPPING_PATH}
detect-tests:
extends: .rails:rules:detect-tests
image: ${GITLAB_DEPENDENCY_PROXY_ADDRESS}ruby:${RUBY_VERSION}
needs: []
stage: prepare
variables:
RSPEC_TESTS_MAPPING_ENABLED: "true"
script:
- source ./scripts/utils.sh
- source ./scripts/rspec_helpers.sh
- install_gitlab_gem
- install_tff_gem
- retrieve_tests_mapping
- retrieve_frontend_fixtures_mapping
- |
if [ -n "$CI_MERGE_REQUEST_IID" ]; then
mkdir -p $(dirname "$RSPEC_CHANGED_FILES_PATH")
tooling/bin/find_changes ${RSPEC_CHANGED_FILES_PATH};
tooling/bin/find_tests ${RSPEC_CHANGED_FILES_PATH} ${RSPEC_MATCHING_TESTS_PATH};
tooling/bin/find_changes ${RSPEC_CHANGED_FILES_PATH} ${RSPEC_MATCHING_TESTS_PATH} ${FRONTEND_FIXTURES_MAPPING_PATH};
filter_rspec_matched_foss_tests ${RSPEC_MATCHING_TESTS_PATH} ${RSPEC_MATCHING_TESTS_FOSS_PATH};
echoinfo "Changed files: $(cat $RSPEC_CHANGED_FILES_PATH)";
echoinfo "Related RSpec tests: $(cat $RSPEC_MATCHING_TESTS_PATH)";
echoinfo "Related FOSS RSpec tests: $(cat $RSPEC_MATCHING_TESTS_FOSS_PATH)";
fi
artifacts:
expire_in: 7d
paths:
- ${RSPEC_CHANGED_FILES_PATH}
- ${RSPEC_MATCHING_TESTS_PATH}
- ${RSPEC_MATCHING_TESTS_FOSS_PATH}
- ${FRONTEND_FIXTURES_MAPPING_PATH}
detect-previous-failed-tests:
extends:
- detect-tests
- .rails:rules:detect-previous-failed-tests
variables:
PREVIOUS_FAILED_TESTS_DIR: tmp/previous_failed_tests/
RSPEC_PG_REGEX: /rspec .+ pg12( .+)?/
RSPEC_EE_PG_REGEX: /rspec-ee .+ pg12( .+)?/
script:
- source ./scripts/utils.sh
- source ./scripts/rspec_helpers.sh
- retrieve_previous_failed_tests ${PREVIOUS_FAILED_TESTS_DIR} "${RSPEC_PG_REGEX}" "${RSPEC_EE_PG_REGEX}"
artifacts:
expire_in: 7d
paths:
- ${PREVIOUS_FAILED_TESTS_DIR}
e2e-test-pipeline-generate:
extends:
- .qa-job-base
- .minimal-job
- .qa:rules:determine-e2e-tests
stage: prepare
variables:
ENV_FILE: $CI_PROJECT_DIR/qa_tests_vars.env
OMNIBUS_PIPELINE_YML: package-and-test-pipeline.yml
REVIEW_PIPELINE_YML: review-app-pipeline.yml
COLORIZED_LOGS: "true"
script:
- bundle exec rake "ci:detect_changes[$ENV_FILE]"
- cd $CI_PROJECT_DIR && scripts/generate-e2e-pipeline
artifacts:
expire_in: 1 day
paths:
- $OMNIBUS_PIPELINE_YML
- $REVIEW_PIPELINE_YML