diff options
author | John Cai <jcai@gitlab.com> | 2023-06-29 23:29:40 +0300 |
---|---|---|
committer | John Cai <jcai@gitlab.com> | 2023-07-06 23:54:20 +0300 |
commit | c3073c54fe1dd5e01f3a47a13632470cad9cb70b (patch) | |
tree | 41dc2c4400c47d5ab246b4e81bc09a134a2fcfa7 /.gitlab-ci.yml | |
parent | d27fb64eee848afe82b8582e49cd800081d1b1d6 (diff) |
.gitlab-ci.yml: Skip tests for non code changes
We don't need the full pipeline to run for things in the .gitlab/
folder, nor any documentation in .md files. Create a rule to skip tests
if we detect such files.
Diffstat (limited to '.gitlab-ci.yml')
-rw-r--r-- | .gitlab-ci.yml | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e5fd79e81..02d6550dd 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -56,6 +56,13 @@ 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: @@ -187,6 +194,8 @@ build: - GO_VERSION: [ "1.19", "1.20" ] TEST_BOOT_ARGS: "--bundled-git" - GIT_VERSION: "v2.41.0" + rules: + - *rules_skip_if_docs build:binaries: needs: [] @@ -231,6 +240,7 @@ test: - POSTGRES_VERSION: "11-alpine" TEST_TARGET: [ test, test-with-praefect ] rules: + - *rules_skip_if_docs - *rules_should_test test:pgbouncer: @@ -262,6 +272,7 @@ test:pgbouncer: # can reach Postgres. TEST_TARGET: "test-with-praefect" rules: + - *rules_skip_if_docs - *rules_should_test test:nightly: @@ -286,8 +297,10 @@ 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 + test:sha256: <<: *test_definition parallel: @@ -295,8 +308,10 @@ test:sha256: - TEST_TARGET: [ test, test-with-praefect ] TEST_WITH_SHA256: "YesPlease" rules: + - *rules_skip_if_docs - *rules_should_test + test:fips: <<: *test_definition image: registry.gitlab.com/gitlab-org/gitlab-build-images/ubi-${UBI_VERSION}-golang-${GO_VERSION}-rust-${RUST_VERSION}:git-2.36 @@ -321,6 +336,7 @@ 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: @@ -372,6 +388,7 @@ test:macos: after_script: - *test_after_script rules: + - *rules_skip_if_docs - *rules_run_on_merge artifacts: <<: *test_artifacts @@ -402,6 +419,7 @@ verify: - proto/go/gitalypb/* when: on_failure rules: + - *rules_skip_if_docs - *rules_should_test dbschema: @@ -423,6 +441,7 @@ dbschema: - _support/praefect-schema.sql when: on_failure rules: + - *rules_skip_if_docs - *rules_should_test semgrep-sast: @@ -433,6 +452,7 @@ semgrep-sast: rules: - if: $SAST_DISABLED when: never + - *rules_skip_if_docs - *rules_should_test license_scanning: @@ -441,6 +461,7 @@ license_scanning: rules: - if: $LICENSE_SCANNING_DISABLED when: never + - *rules_skip_if_docs - *rules_should_test variables: LICENSE_FINDER_CLI_OPTS: '--aggregate-paths=.' |