diff options
author | John Cai <jcai@gitlab.com> | 2023-07-19 06:23:30 +0300 |
---|---|---|
committer | John Cai <jcai@gitlab.com> | 2023-07-19 06:23:30 +0300 |
commit | 3c713dfedbc90e788a2174037682a7a92ef8aa16 (patch) | |
tree | 3f9d5e4ea5f87c068a5776c76c860c529b3446b8 /.gitlab-ci.yml | |
parent | 43d2f4f949f8a986ecad759c5e02bd01a243ed4f (diff) | |
parent | c3b051e62be963de62ee56b9fccc313ee23efc27 (diff) |
Merge branch 'jc/fix-skip-test-for-docs' into 'master'
.gitlab-ci.yml: Test code only
See merge request https://gitlab.com/gitlab-org/gitaly/-/merge_requests/6082
Merged-by: John Cai <jcai@gitlab.com>
Approved-by: Justin Tobler <jtobler@gitlab.com>
Reviewed-by: Justin Tobler <jtobler@gitlab.com>
Diffstat (limited to '.gitlab-ci.yml')
-rw-r--r-- | .gitlab-ci.yml | 62 |
1 files changed, 32 insertions, 30 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 64e13fcb0..36bedac02 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -57,13 +57,6 @@ workflow: - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH - if: '$CI_COMMIT_BRANCH =~ /^[\d-]+-stable$/' -.rules_skip_if_docs: &rules_skip_if_docs - - if: - changes: - - .gitlab/* - - '*.md' - when: never - .cache_deps: cache: &cache_deps_configuration key: @@ -145,11 +138,28 @@ workflow: when: always expire_in: 1 week -.rules_should_test: &rules_should_test +.only_code_changes: &only_code_changes + changes: + - "**/*.go" + - "**/*.proto" + - "**/*.sql" + - Makefile + - .gitlab-ci.yml + - "go.*" + +.rules_should_test_all: &rules_should_test_all - if: $CI_MERGE_REQUEST_IID - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH - if: '$CI_COMMIT_BRANCH =~ /^[\d-]+-stable$/' +.rules_should_test_code: &rules_should_test_code + - if: $CI_MERGE_REQUEST_IID + <<: *only_code_changes + - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH + <<: *only_code_changes + - if: '$CI_COMMIT_BRANCH =~ /^[\d-]+-stable$/' + <<: *only_code_changes + .rules_run_on_merge: &rules_run_on_merge # We only execute these rules in the main Gitaly repository. This is # because jobs which run conditionally when being merged may depend on @@ -195,8 +205,8 @@ build: - GO_VERSION: [ "1.19", "1.20" ] TEST_BOOT_ARGS: "--bundled-git" - GIT_VERSION: "v2.41.0" - rules: - - *rules_skip_if_docs + only: + <<: *only_code_changes build:binaries: needs: [] @@ -220,6 +230,8 @@ build:binaries: parallel: matrix: - GO_VERSION: [ "1.19", "1.20" ] + only: + <<: *only_code_changes test: <<: *test_definition @@ -241,8 +253,7 @@ test: - POSTGRES_VERSION: "11-alpine" TEST_TARGET: [ test, test-with-praefect ] rules: - - *rules_skip_if_docs - - *rules_should_test + - *rules_should_test_code test:pgbouncer: <<: *test_definition @@ -273,8 +284,7 @@ test:pgbouncer: # can reach Postgres. TEST_TARGET: "test-with-praefect" rules: - - *rules_skip_if_docs - - *rules_should_test + - *rules_should_test_code test:nightly: <<: *test_definition @@ -298,8 +308,7 @@ test:praefect_smoke: - ./_build/bin/praefect -config config.praefect.toml sql-ping - ./_build/bin/praefect -config config.praefect.toml sql-migrate rules: - - *rules_skip_if_docs - - *rules_should_test + - *rules_should_test_code test:sha256: @@ -309,8 +318,7 @@ test:sha256: - TEST_TARGET: [ test, test-with-praefect ] TEST_WITH_SHA256: "YesPlease" rules: - - *rules_skip_if_docs - - *rules_should_test + - *rules_should_test_code test:fips: @@ -337,7 +345,6 @@ test:fips: rules: # Automatically run the job when the FIPS label is set. - if: $CI_MERGE_REQUEST_LABELS =~ /FIPS/ - - *rules_skip_if_docs - *rules_run_on_merge test:macos: @@ -389,7 +396,6 @@ test:macos: after_script: - *test_after_script rules: - - *rules_skip_if_docs - *rules_run_on_merge artifacts: <<: *test_artifacts @@ -401,7 +407,7 @@ verify:docs: script: - make lint-docs rules: - - *rules_should_test + - *rules_should_test_all verify: needs: [] @@ -420,8 +426,7 @@ verify: - proto/go/gitalypb/* when: on_failure rules: - - *rules_skip_if_docs - - *rules_should_test + - *rules_should_test_code dbschema: needs: [] @@ -442,8 +447,7 @@ dbschema: - _support/praefect-schema.sql when: on_failure rules: - - *rules_skip_if_docs - - *rules_should_test + - *rules_should_test_code semgrep-sast: needs: [] @@ -453,8 +457,7 @@ semgrep-sast: rules: - if: $SAST_DISABLED when: never - - *rules_skip_if_docs - - *rules_should_test + - *rules_should_test_code license_scanning: needs: [] @@ -462,8 +465,7 @@ license_scanning: rules: - if: $LICENSE_SCANNING_DISABLED when: never - - *rules_skip_if_docs - - *rules_should_test + - *rules_should_test_all variables: LICENSE_FINDER_CLI_OPTS: '--aggregate-paths=.' @@ -473,7 +475,7 @@ secret_detection: rules: - if: $SECRET_DETECTION_DISABLED when: never - - *rules_should_test + - *rules_should_test_all build-proto-gem: needs: [] |