change(ci): centralise recompile check

This commit is contained in:
Songtronix 2020-05-15 15:34:52 +02:00
parent 93db252df6
commit ce7eced0b3
4 changed files with 12 additions and 22 deletions

View File

@ -37,6 +37,7 @@ before_script:
- ln -s /dockercache/veloren/target target
include:
- local: .gitlab/CI/recompile.yml
- local: .gitlab/CI/optional-builds.gitlab-ci.yml
- local: .gitlab/CI/check-compile.gitlab-ci.yml
- local: .gitlab/CI/build-post.gitlab-ci.yml

View File

@ -1,11 +1,7 @@
# Template to only run if actual changes has been made to the code and not just documentation
.tests: &tests
extends: .recompile
stage: build-post
rules:
- changes:
- "*.{rs,ron,toml}"
when: delayed
start_in: 5 seconds
tags:
- veloren-docker
@ -41,18 +37,11 @@ localization-status:
- 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
extends: .recompile
stage: build-post
# 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,11 +1,5 @@
# 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
extends: .recompile
stage: check-compile
tags:
- veloren-docker
@ -13,7 +7,7 @@ check:
- RUSTFLAGS="-D warnings" cargo check --locked
code-quality:
<<: *only
extends: .recompile
stage: check-compile
tags:
- veloren-docker
@ -22,7 +16,7 @@ code-quality:
- cargo fmt --all -- --check
security:
<<: *only
extends: .recompile
stage: check-compile
allow_failure: true
tags:

6
.gitlab/CI/recompile.yml Normal file
View File

@ -0,0 +1,6 @@
# Template to only run if actual changes has been made to the code and not just documentation
.recompile:
rules:
- changes:
- "*.{rs,ron,toml,vox,png}"
- "rust-toolchain"