summaryrefslogtreecommitdiff
path: root/.gitlab/ci/setup.gitlab-ci.yml
blob: 74510a0a03ab6839d63c85ccaee0374e4a8f0b32 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# Insurance in case a gem needed by one of our releases gets yanked from
# rubygems.org in the future.
cache gems:
  extends:
    - .default-retry
    - .rails-cache
    - .default-before_script
    - .setup:rules:cache-gems
  stage: test
  needs: ["setup-test-env"]
  variables:
    BUNDLE_INSTALL_FLAGS: --with=production --with=development --with=test --jobs=2 --path=vendor --retry=3 --quiet
    SETUP_DB: "false"
  script:
    - bundle package --all --all-platforms
  artifacts:
    paths:
      - vendor/cache
    expire_in: 31d

.minimal-job:
  extends:
    - .default-retry
  needs: []

dont-interrupt-me:
  extends: .setup:rules:dont-interrupt-me
  stage: sync
  image: alpine:edge
  interruptible: false
  variables:
    GIT_STRATEGY: none
  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-ee-check

verify-tests-yml:
  extends:
    - .setup:rules:verify-tests-yml
  image: ruby:2.7-alpine
  stage: test
  needs: []
  script:
    - source scripts/utils.sh
    - install_tff_gem
    - scripts/verify-tff-mapping

.detect-test-base:
  image: ruby:2.7
  needs: []
  stage: prepare
  script:
    - source ./scripts/utils.sh
    - source ./scripts/rspec_helpers.sh
    - install_gitlab_gem
    - install_tff_gem
    - retrieve_tests_mapping
    - 'if [ -n "$CI_MERGE_REQUEST_IID" ]; then tooling/bin/find_tests ${MATCHED_TESTS_FILE}; fi'
    - 'if [ -n "$CI_MERGE_REQUEST_IID" ]; then echo "test files affected: $(cat $MATCHED_TESTS_FILE)"; fi'
  artifacts:
    expire_in: 7d
    paths:
      - ${MATCHED_TESTS_FILE}

detect-tests:
  extends:
    - .detect-test-base
    - .rails:rules:detect-tests
  variables:
    RSPEC_TESTS_MAPPING_ENABLED: "true"
    MATCHED_TESTS_FILE: tmp/matching_tests.txt

detect-tests as-if-foss:
  extends:
    - .detect-test-base
    - .rails:rules:detect-tests
    - .as-if-foss
  variables:
    MATCHED_TESTS_FILE: tmp/matching_foss_tests.txt
  before_script:
    - '[ "$FOSS_ONLY" = "1" ] && rm -rf ee/ qa/spec/ee/ qa/qa/specs/features/ee/ qa/qa/ee/ qa/qa/ee.rb'