change(ci): only run jobs if necessary

This commit is contained in:
Songtronix 2020-05-14 18:27:35 +02:00
parent b6135f60ed
commit 93db252df6
2 changed files with 32 additions and 26 deletions

View File

@ -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 stage: build-post
rules:
- changes:
- "*.{rs,ron,toml}"
when: delayed when: delayed
start_in: 5 seconds start_in: 5 seconds
tags: tags:
- veloren-docker - veloren-docker
unittests:
<<: *tests
script: script:
- cargo test - cargo test
retry: retry:
max: 2 max: 2
coverage: coverage:
stage: build-post <<: *tests
allow_failure: true allow_failure: true
when: delayed
start_in: 5 seconds
tags:
- veloren-docker
script: script:
- cargo tarpaulin -v - cargo tarpaulin -v
retry: retry:
max: 2 max: 2
benchmarks: benchmarks:
stage: build-post <<: *tests
when: delayed
start_in: 5 seconds
tags:
- veloren-docker
script: script:
- unset DISABLE_GIT_LFS_CHECK - unset DISABLE_GIT_LFS_CHECK
- cargo bench - cargo bench
@ -34,28 +33,26 @@ benchmarks:
max: 2 max: 2
localization-status: localization-status:
<<: *tests
variables: variables:
GIT_DEPTH: 0 GIT_DEPTH: 0
stage: build-post
when: delayed
start_in: 5 seconds
allow_failure: true allow_failure: true
tags:
- veloren-docker
script: script:
- cargo test -q test_all_localizations -- --nocapture --ignored - cargo test -q test_all_localizations -- --nocapture --ignored
# Artifacts # Artifacts
# TODO: Only build artifacts if actual changes has been made like we do for the tests
.artifact: &artifact .artifact: &artifact
stage: build-post stage: build-post
when: delayed # only:
start_in: 5 seconds # refs:
only: # - /^r[0-9]+\.[0-9]+\.[0-9]+/
refs: # - /^v[0-9]+\.[0-9]+/
- /^r[0-9]+\.[0-9]+\.[0-9]+/ # - /^master$/
- /^v[0-9]+\.[0-9]+/ rules:
- /^master$/ - 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: tags:
- veloren-docker - veloren-docker

View File

@ -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: check:
<<: *only
stage: check-compile stage: check-compile
tags: tags:
- veloren-docker - veloren-docker
@ -6,6 +13,7 @@ check:
- RUSTFLAGS="-D warnings" cargo check --locked - RUSTFLAGS="-D warnings" cargo check --locked
code-quality: code-quality:
<<: *only
stage: check-compile stage: check-compile
tags: tags:
- veloren-docker - veloren-docker
@ -14,6 +22,7 @@ code-quality:
- cargo fmt --all -- --check - cargo fmt --all -- --check
security: security:
<<: *only
stage: check-compile stage: check-compile
allow_failure: true allow_failure: true
tags: tags: