veloren/.gitlab-ci.yml
2019-10-08 14:39:52 +02:00

218 lines
5.6 KiB
YAML

image: registry.gitlab.com/veloren/veloren-docker-ci:latest
variables:
GIT_STRATEGY: none
stages:
- optional-builds
- check-compile
- post
before_script:
- mkdir -p veloren
- cd veloren
- git lfs install
- if [ ! -d ".git" ]; then git clone https://gitlab.com/veloren/veloren.git .; fi
- git clean -f
- git lfs fetch
- git lfs checkout $CI_COMMIT_SHA
- source $HOME/.cargo/env
- df -h
- free -h
- gcc -v
- cargo --version
# -- optional build
.optional-debug: &optional-debug
stage: optional-builds
tags:
- veloren-docker
except:
- schedules
when: manual
artifacts:
paths:
- veloren/artifact/*
expire_in: 1 week
optional-debug:linux:
<<: *optional-debug
cache:
key: "cache-linux-debug"
paths:
- veloren/
script:
- mkdir artifact
- 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 ./artifact
- cp target/debug/veloren-voxygen ./artifact
- cp -r assets ./artifact
optional-debug:windows:
<<: *optional-debug
cache:
key: "cache-windows-debug"
paths:
- veloren/
script:
- mkdir artifact
- 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 ./artifact
- cp target/x86_64-pc-windows-gnu/debug/veloren-voxygen.exe ./artifact
- cp -r assets ./artifact
.optional-release: &optional-release
stage: optional-builds
tags:
- veloren-docker
except:
- schedules
when: manual
artifacts:
paths:
- veloren/artifact/*
expire_in: 1 week
optional-release:linux:
<<: *optional-release
cache:
key: "cache-linux-release"
paths:
- veloren/
script:
- mkdir artifact
- 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 ./artifact
- cp target/release/veloren-voxygen ./artifact
- cp -r assets ./artifact
optional-release:windows:
<<: *optional-release
cache:
key: "cache-windows-release"
paths:
- veloren/
script:
- mkdir artifact
- 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 ./artifact
- cp target/x86_64-pc-windows-gnu/release/veloren-voxygen.exe ./artifact
- cp -r assets ./artifact
# --
# -- check
check:
stage: check-compile
cache:
key: "cache-linux-debug"
paths:
- veloren/
tags:
- veloren-docker
script:
- RUSTFLAGS="-D warnings" cargo check --verbose
code-quality:
stage: check-compile
cache:
key: "cache-linux-debug"
paths:
- veloren/
tags:
- veloren-docker
script:
- cargo clippy -- --warn clippy::all
- cargo fmt --all -- --check
# --
# -- post build
unittests:
stage: post
cache:
key: "cache-linux-debug"
paths:
- veloren/
when: delayed
start_in: 5 seconds
tags:
- veloren-docker
script:
- cargo test
benchmarks:
stage: post
cache:
key: "cache-linux-release"
paths:
- veloren/
when: delayed
start_in: 5 seconds
tags:
- veloren-docker
script:
- cargo bench
allow_failure: true
linux:
stage: post
cache:
key: "cache-linux-release"
paths:
- veloren/
when: delayed
start_in: 5 seconds
only:
refs:
- /^r[0-9]+\.[0-9]+\.[0-9]+/
- /^v[0-9]+\.[0-9]+\.[0-9]+/
- /^master$/
artifacts:
paths:
- veloren/artifact/*
tags:
- veloren-docker
script:
- mkdir artifact
- 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 ./artifact
- cp -r target/release/veloren-voxygen ./artifact
- cp -r assets ./artifact
windows:
stage: post
cache:
key: "cache-windows-release"
paths:
- veloren/
when: delayed
start_in: 5 seconds
only:
refs:
- /^r[0-9]+\.[0-9]+\.[0-9]+/
- /^v[0-9]+\.[0-9]+\.[0-9]+/
- /^master$/
artifacts:
paths:
- veloren/artifact/*
tags:
- veloren-docker
script:
- mkdir artifact
- 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 ./artifact
- cp -r target/x86_64-pc-windows-gnu/release/veloren-voxygen.exe ./artifact
- cp -r assets ./artifact
# --