veloren/.gitlab-ci.yml
Forest Anderson 007a7c7fe5 Cleaned, other work
Former-commit-id: e78e9d44965f86857ca99cac1e26d5406b403c14
2019-04-25 23:41:13 -04:00

170 lines
4.4 KiB
YAML

stages:
- build
- test
- executable
- post-build
# our own git fetch command like https://gitlab.com/gitlab-org/gitlab-runner/blob/master/shells/abstract.go
# speeds up building because we skip the git clean and dont need any gitlab caches
variables:
GIT_STRATEGY: none
before_script:
- cd /cache
- if [ -d .git ]; then
echo "is git dir";
else
git clone $CI_REPOSITORY_URL . ;
fi;
- rm -f .git/index.lock
- rm -f .git/shallow.lock
- rm -f .git/HEAD.lock
- rm -f .git/hocks/post-checkout
- git remote set-url origin $CI_REPOSITORY_URL
- git fetch origin --prune +refs/heads/*:refs/remotes/origin/* +refs/tags/*:refs/tags/*
- git checkout -f -q $CI_COMMIT_SHA
- if [ ! -z "${SOURCE_PROJECT}" -a "${SOURCE_PROJECT}" != " " ]; then
echo "THIS SEEMS TO BE A MERGE PIPELINE FROM ${SOURCE_PROJECT}/${SOURCE_BRANCH}";
git pull "https://gitlab.com/${SOURCE_PROJECT}/veloren.git" "${SOURCE_BRANCH}";
fi;
- git submodule sync --recursive
- git submodule update --remote --recursive
- git status
- if [ -d target ]; then
ls -la target;
fi;
#############
# BUILD
#############
build-voxygen:
stage: build
image: registry.gitlab.com/veloren/veloren-docker-ci
tags:
- docker
script:
- (cd voxygen && cargo build)
allow_failure: false
build-server-cli:
stage: build
image: registry.gitlab.com/veloren/veloren-docker-ci
tags:
- docker
script:
- (cd server-cli && cargo build)
allow_failure: false
#############
# TEST
#############
unittests:
stage: test
image: registry.gitlab.com/veloren/veloren-docker-ci
tags:
- docker
script:
- cargo test
allow_failure: false
benchmarktests:
stage: test
image: registry.gitlab.com/veloren/veloren-docker-ci
tags:
- docker
script:
- cargo bench
allow_failure: true
#############
# EXECUTABLE
#############
nightly-linux-optimized:
stage: executable
image: registry.gitlab.com/veloren/veloren-docker-ci
tags:
- docker
script:
- (cd voxygen && VELOREN_ASSETS=assets cargo build --release)
- (cd server-cli && VELOREN_ASSETS=assets cargo build --release)
- rm -r -f nightly
- mkdir nightly
- cp target/release/veloren-server-cli nightly
- cp target/release/veloren-voxygen nightly
- cp -r assets nightly/
- cp -r voxygen/shaders nightly/
- rm -f nightly-linux-optimized.tar.bz2
- tar -cvjSf nightly-linux-optimized.tar.bz2 nightly
when: on_success
artifacts:
paths:
- nightly-linux-optimized.tar.bz2
expire_in: 2 days
only:
refs:
- master
nightly-windows-optimized:
stage: executable
image: registry.gitlab.com/veloren/veloren-docker-ci
tags:
- docker
script:
- (cd voxygen && VELOREN_ASSETS=assets cargo build --release --target=x86_64-pc-windows-gnu)
- (cd server-cli && VELOREN_ASSETS=assets cargo build --release --target=x86_64-pc-windows-gnu)
- rm -r -f nightly
- mkdir nightly
- cp target/x86_64-pc-windows-gnu/release/veloren-server-cli.exe nightly
- cp target/x86_64-pc-windows-gnu/release/veloren-voxygen.exe nightly
- cp -r assets nightly/
- cp -r voxygen/shaders nightly/
- rm -f nightly-windows-optimized.zip
- zip -r nightly-windows-optimized.zip nightly
when: on_success
artifacts:
paths:
- nightly-windows-optimized.zip
expire_in: 2 days
only:
refs:
- master
#############
# POST-BUILD
#############
clean-code:
stage: post-build
image: registry.gitlab.com/veloren/veloren-docker-ci
tags:
- docker
script:
- rustup component add rustfmt-preview
- cargo fmt --all -- --check
allow_failure: true
coverage:
stage: post-build
image: registry.gitlab.com/veloren/veloren-docker-ci
tags:
- docker
script:
- if cargo install --list | grep -i "cargo-tarpaulin"; then
echo "tarpaulin already installed";
else
RUSTFLAGS="--cfg procmacro2_semver_exempt" cargo install cargo-tarpaulin;
fi
- cargo tarpaulin --skip-clean --all || echo "There is a problem in tarpaulin which sometimes fails"
clippy:
stage: post-build
image: registry.gitlab.com/veloren/veloren-docker-ci
tags:
- docker
script:
- rustup component add clippy-preview --toolchain=nightly
- cargo clippy --all -- -D clippy || echo "This job is disabled, because we are not activly using it now, so we dont want to see yellow failed partly"
allow_failure: true