veloren/.gitlab-ci.yml
Marcel Märtens b08f11cfa4 switch to new caching inside docker, described at: https://gitlab.com/veloren/veloren-docker-ci/merge_requests/8
we need to ln target to /dockercache/veloren/target in order for the cace to take affect, the old caching info is no longer needed inside .gitlab-ci.yml
2019-11-18 12:11:54 +01:00

209 lines
5.8 KiB
YAML

image: registry.gitlab.com/veloren/veloren-docker-ci:latest
variables:
GIT_STRATEGY: fetch
GIT_DEPTH: 3
GIT_CLEAN_FLAGS: -f
stages:
- optional-builds
- check-compile
- post
before_script:
- date
- source $HOME/.cargo/env
- df -h
- free -h
- gcc -v
- cargo --version
- export DISABLE_GIT_LFS_CHECK=true
- rm -r target || echo "target doesnt exist, which is fine"
- ln -s /dockercache/veloren/target target
- date
# -- optional build
.optional-debug: &optional-debug
stage: optional-builds
tags:
- veloren-docker
except:
- schedules
when: manual
optional-debug:linux:
<<: *optional-debug
script:
- cd voxygen && VELOREN_ASSETS=assets cargo build --verbose && cd ..
- cd server-cli && VELOREN_ASSETS=assets cargo build --verbose && cd ..
- cp target/debug/veloren-server-cli $CI_PROJECT_DIR
- cp target/debug/veloren-voxygen $CI_PROJECT_DIR
- strip --strip-all veloren-server-cli
- strip --strip-all veloren-voxygen
artifacts:
paths:
- veloren-server-cli
- veloren-voxygen
- assets/
- LICENSE
expire_in: 1 week
optional-debug:windows:
<<: *optional-debug
script:
- cd voxygen && VELOREN_ASSETS=assets cargo build --verbose --target=x86_64-pc-windows-gnu && cd ..
- cd server-cli && VELOREN_ASSETS=assets cargo build --verbose --target=x86_64-pc-windows-gnu && cd ..
- cp target/x86_64-pc-windows-gnu/debug/veloren-server-cli.exe $CI_PROJECT_DIR
- cp target/x86_64-pc-windows-gnu/debug/veloren-voxygen.exe $CI_PROJECT_DIR
artifacts:
paths:
- veloren-server-cli.exe
- veloren-voxygen.exe
- assets/
- LICENSE
expire_in: 1 week
.optional-release: &optional-release
stage: optional-builds
tags:
- veloren-docker
except:
- schedules
when: manual
optional-release:linux:
<<: *optional-release
script:
- cd voxygen && VELOREN_ASSETS=assets cargo build --verbose --release && cd ..
- cd server-cli && VELOREN_ASSETS=assets cargo build --verbose --release && cd ..
- cp target/release/veloren-server-cli $CI_PROJECT_DIR
- cp target/release/veloren-voxygen $CI_PROJECT_DIR
- strip --strip-all veloren-server-cli
- strip --strip-all veloren-voxygen
artifacts:
paths:
- veloren-server-cli
- veloren-voxygen
- assets/
- LICENSE
expire_in: 1 week
optional-release:windows:
<<: *optional-release
script:
- cd voxygen && VELOREN_ASSETS=assets cargo build --verbose --target=x86_64-pc-windows-gnu --release && cd ..
- cd server-cli && VELOREN_ASSETS=assets cargo build --verbose --target=x86_64-pc-windows-gnu --release && cd ..
- cp target/x86_64-pc-windows-gnu/release/veloren-server-cli.exe $CI_PROJECT_DIR
- cp target/x86_64-pc-windows-gnu/release/veloren-voxygen.exe $CI_PROJECT_DIR
artifacts:
paths:
- veloren-server-cli.exe
- veloren-voxygen.exe
- assets/
- LICENSE
expire_in: 1 week
# --
# -- check
check:
stage: check-compile
tags:
- veloren-docker
script:
- RUSTFLAGS="-D warnings" cargo check --verbose
code-quality:
stage: check-compile
tags:
- veloren-docker
script:
- cargo clippy -- --warn clippy::all
- cargo fmt --all -- --check
security:
stage: check-compile
allow_failure: true
tags:
- veloren-docker
script:
- cargo audit
# --
# -- post build
unittests:
stage: post
when: delayed
start_in: 5 seconds
tags:
- veloren-docker
script:
- echo "Workaround, cargo tests fails due some rust files are already deleted, so we just stack cargo test. if its the os error, it wont appear on them all, if its a real error, it will retry and then fail"
- cargo test || cargo test || cargo test || cargo test
benchmarks:
stage: post
when: delayed
start_in: 5 seconds
tags:
- veloren-docker
script:
- cargo bench
allow_failure: true
linux:
stage: post
when: delayed
start_in: 5 seconds
only:
refs:
- /^r[0-9]+\.[0-9]+\.[0-9]+/
- /^v[0-9]+\.[0-9]+\.[0-9]+/
- /^master$/
tags:
- veloren-docker
script:
- cd voxygen && VELOREN_ASSETS=assets cargo build --release && cd ..
- cd server-cli && VELOREN_ASSETS=assets cargo build --release && cd ..
- cp -r target/release/veloren-server-cli $CI_PROJECT_DIR
- cp -r target/release/veloren-voxygen $CI_PROJECT_DIR
- strip --strip-all veloren-server-cli
- strip --strip-all veloren-voxygen
artifacts:
paths:
- veloren-server-cli
- veloren-voxygen
- assets/
- LICENSE
expire_in: 1 week
windows:
stage: post
when: delayed
start_in: 5 seconds
only:
refs:
- /^r[0-9]+\.[0-9]+\.[0-9]+/
- /^v[0-9]+\.[0-9]+\.[0-9]+/
- /^master$/
tags:
- veloren-docker
script:
- cd voxygen && VELOREN_ASSETS=assets cargo build --target=x86_64-pc-windows-gnu --release && cd ..
- cd server-cli && VELOREN_ASSETS=assets cargo build --target=x86_64-pc-windows-gnu --release && cd ..
- cp -r target/x86_64-pc-windows-gnu/release/veloren-server-cli.exe $CI_PROJECT_DIR
- cp -r target/x86_64-pc-windows-gnu/release/veloren-voxygen.exe $CI_PROJECT_DIR
artifacts:
paths:
- veloren-server-cli.exe
- veloren-voxygen.exe
- assets/
- LICENSE
expire_in: 1 week
# --