diff --git a/.gitlab/CI/build-post.gitlab-ci.yml b/.gitlab/CI/build-post.gitlab-ci.yml index 58cbc79386..8c0635fee2 100644 --- a/.gitlab/CI/build-post.gitlab-ci.yml +++ b/.gitlab/CI/build-post.gitlab-ci.yml @@ -1,32 +1,31 @@ -unittests: +# Template to only run if actual changes has been made to the code and not just documentation +.tests: &tests stage: build-post - when: delayed - start_in: 5 seconds + rules: + - changes: + - "*.{rs,ron,toml}" + when: delayed + start_in: 5 seconds tags: - veloren-docker + +unittests: + <<: *tests script: - cargo test retry: max: 2 coverage: - stage: build-post + <<: *tests allow_failure: true - when: delayed - start_in: 5 seconds - tags: - - veloren-docker script: - cargo tarpaulin -v retry: max: 2 benchmarks: - stage: build-post - when: delayed - start_in: 5 seconds - tags: - - veloren-docker + <<: *tests script: - unset DISABLE_GIT_LFS_CHECK - cargo bench @@ -34,28 +33,26 @@ benchmarks: max: 2 localization-status: + <<: *tests variables: GIT_DEPTH: 0 - stage: build-post - when: delayed - start_in: 5 seconds allow_failure: true - tags: - - veloren-docker script: - cargo test -q test_all_localizations -- --nocapture --ignored # Artifacts - +# TODO: Only build artifacts if actual changes has been made like we do for the tests .artifact: &artifact stage: build-post - when: delayed - start_in: 5 seconds - only: - refs: - - /^r[0-9]+\.[0-9]+\.[0-9]+/ - - /^v[0-9]+\.[0-9]+/ - - /^master$/ + # only: + # refs: + # - /^r[0-9]+\.[0-9]+\.[0-9]+/ + # - /^v[0-9]+\.[0-9]+/ + # - /^master$/ + rules: + - if: $CI_COMMIT_REF_NAME =~ /^master.$/ || $CI_COMMIT_TAG =~ /^r[0-9]+\.[0-9]+\.[0-9]+/ || $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+/ + - changes: + - "*.{rs,ron,toml}" tags: - veloren-docker diff --git a/.gitlab/CI/check-compile.gitlab-ci.yml b/.gitlab/CI/check-compile.gitlab-ci.yml index e2434b6a86..349f8b860f 100644 --- a/.gitlab/CI/check-compile.gitlab-ci.yml +++ b/.gitlab/CI/check-compile.gitlab-ci.yml @@ -1,4 +1,11 @@ +# Template to only run if actual changes has been made to the code and not just documentation +.only: &only + rules: + - changes: + - "*.{rs,ron,toml}" + check: + <<: *only stage: check-compile tags: - veloren-docker @@ -6,6 +13,7 @@ check: - RUSTFLAGS="-D warnings" cargo check --locked code-quality: + <<: *only stage: check-compile tags: - veloren-docker @@ -14,6 +22,7 @@ code-quality: - cargo fmt --all -- --check security: + <<: *only stage: check-compile allow_failure: true tags: