debian-mirror-gitlab/.gitlab/ci/setup.gitlab-ci.yml

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

193 lines
5.6 KiB
YAML
Raw Normal View History

2019-07-31 22:56:46 +05:30
# Insurance in case a gem needed by one of our releases gets yanked from
# rubygems.org in the future.
cache gems:
2019-12-04 20:38:33 +05:30
extends:
- .default-retry
2022-10-11 01:57:18 +05:30
- .ruby-cache
2019-12-04 20:38:33 +05:30
- .default-before_script
2020-03-13 15:44:24 +05:30
- .setup:rules:cache-gems
2022-10-11 01:57:18 +05:30
stage: prepare
needs: []
2019-12-04 20:38:33 +05:30
variables:
2022-10-11 01:57:18 +05:30
BUNDLE_WITHOUT: ""
BUNDLE_WITH: "production:development:test"
2019-12-04 20:38:33 +05:30
SETUP_DB: "false"
2019-07-31 22:56:46 +05:30
script:
2022-10-11 01:57:18 +05:30
- 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"
2019-07-31 22:56:46 +05:30
artifacts:
paths:
- vendor/cache
2020-05-24 23:13:21 +05:30
expire_in: 31d
2019-07-31 22:56:46 +05:30
2023-03-17 16:20:25 +05:30
.predictive-job:
2019-09-30 21:07:59 +05:30
extends:
2019-12-04 20:38:33 +05:30
- .default-retry
2020-04-08 14:13:33 +05:30
needs: []
2019-12-04 20:38:33 +05:30
2023-03-17 16:20:25 +05:30
.absolutely-predictive-job:
2022-08-13 15:12:31 +05:30
extends:
2023-03-17 16:20:25 +05:30
- .predictive-job
2022-11-25 23:54:43 +05:30
image: ${GITLAB_DEPENDENCY_PROXY_ADDRESS}alpine:edge
2020-04-22 19:07:51 +05:30
variables:
GIT_STRATEGY: none
2022-08-13 15:12:31 +05:30
dont-interrupt-me:
extends:
2023-03-17 16:20:25 +05:30
- .absolutely-predictive-job
2022-08-13 15:12:31 +05:30
- .setup:rules:dont-interrupt-me
stage: sync
interruptible: false
2020-04-22 19:07:51 +05:30
script:
- echo "This jobs makes sure this pipeline won't be interrupted! See https://docs.gitlab.com/ee/ci/yaml/#interruptible."
2019-12-04 20:38:33 +05:30
gitlab_git_test:
2020-03-13 15:44:24 +05:30
extends:
2023-03-17 16:20:25 +05:30
- .predictive-job
2020-03-13 15:44:24 +05:30
- .setup:rules:gitlab_git_test
2020-04-08 14:13:33 +05:30
stage: test
2019-07-31 22:56:46 +05:30
script:
- spec/support/prepare-gitlab-git-test-for-commit --check-for-changes
2021-12-11 22:18:48 +05:30
no-ee-check:
2020-03-13 15:44:24 +05:30
extends:
2023-03-17 16:20:25 +05:30
- .predictive-job
2021-12-11 22:18:48 +05:30
- .setup:rules:no-ee-check
2020-04-08 14:13:33 +05:30
stage: test
2019-07-31 22:56:46 +05:30
script:
2021-12-11 22:18:48 +05:30
- scripts/no-dir-check ee
no-jh-check:
extends:
2023-03-17 16:20:25 +05:30
- .predictive-job
2021-12-11 22:18:48 +05:30
- .setup:rules:no-jh-check
stage: test
script:
- scripts/no-dir-check jh
2020-11-24 15:15:51 +05:30
2023-03-17 16:20:25 +05:30
verify-ruby-3.0:
2022-08-13 15:12:31 +05:30
extends:
2023-03-17 16:20:25 +05:30
- .absolutely-predictive-job
- .setup:rules:verify-ruby-3.0
2022-08-13 15:12:31 +05:30
stage: prepare
script:
2023-03-17 16:20:25 +05:30
- echo 'Please remove label ~"pipeline:run-in-ruby2" so we do test against Ruby 3.0 (default version) before merging the merge request'
2022-08-13 15:12:31 +05:30
- exit 1
2020-11-24 15:15:51 +05:30
verify-tests-yml:
extends:
- .setup:rules:verify-tests-yml
2022-11-25 23:54:43 +05:30
image: ${GITLAB_DEPENDENCY_PROXY_ADDRESS}ruby:${RUBY_VERSION}-alpine3.13
2020-11-24 15:15:51 +05:30
stage: test
needs: []
script:
- source scripts/utils.sh
- install_tff_gem
- scripts/verify-tff-mapping
2022-06-21 17:19:12 +05:30
verify-approvals:
extends:
2023-03-17 16:20:25 +05:30
- .predictive-job
2022-06-21 17:19:12 +05:30
- .setup:rules:jh-contribution
script:
- source scripts/utils.sh
- install_gitlab_gem
- tooling/bin/find_app_sec_approval
2022-01-26 12:08:38 +05:30
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}
2022-10-11 01:57:18 +05:30
detect-tests:
extends: .rails:rules:detect-tests
2023-03-17 16:20:25 +05:30
image: ${GITLAB_DEPENDENCY_PROXY_ADDRESS}ruby:${RUBY_VERSION}-slim
2020-11-24 15:15:51 +05:30
needs: []
stage: prepare
2022-10-11 01:57:18 +05:30
variables:
RSPEC_TESTS_MAPPING_ENABLED: "true"
2023-03-17 16:20:25 +05:30
before_script:
- apt-get update && apt-get install -y curl # Not present in ruby-slim, so we add it manually
2020-11-24 15:15:51 +05:30
script:
2021-02-22 17:27:13 +05:30
- source ./scripts/utils.sh
- source ./scripts/rspec_helpers.sh
2020-11-24 15:15:51 +05:30
- install_gitlab_gem
- install_tff_gem
2023-04-23 21:23:45 +05:30
- install_activesupport_gem
2021-02-22 17:27:13 +05:30
- retrieve_tests_mapping
2022-01-26 12:08:38 +05:30
- retrieve_frontend_fixtures_mapping
2021-11-11 11:23:49 +05:30
- |
if [ -n "$CI_MERGE_REQUEST_IID" ]; then
2022-10-11 01:57:18 +05:30
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};
2023-04-23 21:23:45 +05:30
tooling/bin/js_to_system_specs_mappings ${RSPEC_CHANGED_FILES_PATH} ${RSPEC_MATCHING_TESTS_PATH};
2022-10-11 01:57:18 +05:30
tooling/bin/find_changes ${RSPEC_CHANGED_FILES_PATH} ${RSPEC_MATCHING_TESTS_PATH} ${FRONTEND_FIXTURES_MAPPING_PATH};
2022-11-25 23:54:43 +05:30
filter_rspec_matched_foss_tests ${RSPEC_MATCHING_TESTS_PATH} ${RSPEC_MATCHING_TESTS_FOSS_PATH};
2023-04-23 21:23:45 +05:30
filter_rspec_matched_ee_tests ${RSPEC_MATCHING_TESTS_PATH} ${RSPEC_MATCHING_TESTS_EE_PATH};
2023-03-17 16:20:25 +05:30
tooling/bin/view_to_js_mappings ${RSPEC_CHANGED_FILES_PATH} ${RSPEC_MATCHING_JS_FILES_PATH};
2022-11-25 23:54:43 +05:30
echoinfo "Changed files: $(cat $RSPEC_CHANGED_FILES_PATH)";
echoinfo "Related FOSS RSpec tests: $(cat $RSPEC_MATCHING_TESTS_FOSS_PATH)";
2023-04-23 21:23:45 +05:30
echoinfo "Related EE RSpec tests: $(cat $RSPEC_MATCHING_TESTS_EE_PATH)";
2023-03-17 16:20:25 +05:30
echoinfo "Related JS files: $(cat $RSPEC_MATCHING_JS_FILES_PATH)";
2021-11-11 11:23:49 +05:30
fi
2020-11-24 15:15:51 +05:30
artifacts:
expire_in: 7d
paths:
2023-03-17 16:20:25 +05:30
- ${FRONTEND_FIXTURES_MAPPING_PATH}
2022-10-11 01:57:18 +05:30
- ${RSPEC_CHANGED_FILES_PATH}
2023-03-17 16:20:25 +05:30
- ${RSPEC_MATCHING_JS_FILES_PATH}
- ${RSPEC_MATCHING_TESTS_PATH}
2023-04-23 21:23:45 +05:30
- ${RSPEC_MATCHING_TESTS_FOSS_PATH}
- ${RSPEC_MATCHING_TESTS_EE_PATH}
2020-11-24 15:15:51 +05:30
2021-12-11 22:18:48 +05:30
detect-previous-failed-tests:
extends:
2022-10-11 01:57:18 +05:30
- detect-tests
2021-12-11 22:18:48 +05:30
- .rails:rules:detect-previous-failed-tests
variables:
PREVIOUS_FAILED_TESTS_DIR: tmp/previous_failed_tests/
script:
- source ./scripts/utils.sh
- source ./scripts/rspec_helpers.sh
2023-04-23 21:23:45 +05:30
- retrieve_failed_tests "${PREVIOUS_FAILED_TESTS_DIR}" "oneline" "previous"
2021-12-11 22:18:48 +05:30
artifacts:
expire_in: 7d
paths:
- ${PREVIOUS_FAILED_TESTS_DIR}
2022-10-11 01:57:18 +05:30
e2e-test-pipeline-generate:
extends:
- .qa-job-base
2023-03-17 16:20:25 +05:30
- .predictive-job
2022-10-11 01:57:18 +05:30
- .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