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
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

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:
<<: *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: