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 - ln -s /dockercache/veloren/target target
include: include:
- local: .gitlab/CI/recompile.yml
- local: .gitlab/CI/optional-builds.gitlab-ci.yml - local: .gitlab/CI/optional-builds.gitlab-ci.yml
- local: .gitlab/CI/check-compile.gitlab-ci.yml - local: .gitlab/CI/check-compile.gitlab-ci.yml
- local: .gitlab/CI/build-post.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 # Template to only run if actual changes has been made to the code and not just documentation
.tests: &tests .tests: &tests
extends: .recompile
stage: build-post stage: build-post
rules:
- changes:
- "*.{rs,ron,toml}"
when: delayed
start_in: 5 seconds
tags: tags:
- veloren-docker - veloren-docker
@ -41,18 +37,11 @@ localization-status:
- 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
extends: .recompile
stage: build-post stage: build-post
# only:
# refs:
# - /^r[0-9]+\.[0-9]+\.[0-9]+/
# - /^v[0-9]+\.[0-9]+/
# - /^master$/
rules: 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]+/ - 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,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: check:
<<: *only extends: .recompile
stage: check-compile stage: check-compile
tags: tags:
- veloren-docker - veloren-docker
@ -13,7 +7,7 @@ check:
- RUSTFLAGS="-D warnings" cargo check --locked - RUSTFLAGS="-D warnings" cargo check --locked
code-quality: code-quality:
<<: *only extends: .recompile
stage: check-compile stage: check-compile
tags: tags:
- veloren-docker - veloren-docker
@ -22,7 +16,7 @@ code-quality:
- cargo fmt --all -- --check - cargo fmt --all -- --check
security: security:
<<: *only extends: .recompile
stage: check-compile stage: check-compile
allow_failure: true allow_failure: true
tags: 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"