veloren/.gitlab-ci.yml

221 lines
5.9 KiB
YAML
Raw Normal View History

stages:
- build
- test
- post-build
- executable
# 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:
- mkdir -p /cache/veloren
- cd /cache/veloren
- 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 --init --recursive --depth 20
- 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)
build-server-cli:
stage: build
image: registry.gitlab.com/veloren/veloren-docker-ci
tags:
- docker
script:
- (cd server-cli && cargo build)
#############
# TEST
#############
unittests:
stage: test
image: registry.gitlab.com/veloren/veloren-docker-ci
tags:
- docker
script:
- cargo test
benchmarktests:
stage: test
image: registry.gitlab.com/veloren/veloren-docker-ci
tags:
- docker
script:
- cargo bench
allow_failure: true
#############
# POST-BUILD
#############
clean-code:
stage: post-build
image: registry.gitlab.com/veloren/veloren-docker-ci
tags:
- docker
script:
- cargo fmt --all -- --check
allow_failure: true
coverage:
stage: post-build
image: registry.gitlab.com/veloren/veloren-docker-ci
tags:
- docker
script:
- cargo tarpaulin --skip-clean --all || echo "There is a problem in tarpaulin which sometimes fails"
allow_failure: true
clippy:
stage: post-build
image: registry.gitlab.com/veloren/veloren-docker-ci
tags:
- docker
script:
- 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
#############
# Commit build
#############
commit-linux-debug:
stage: executable
image: registry.gitlab.com/veloren/veloren-docker-ci
tags:
- docker
script:
- (cd voxygen && VELOREN_ASSETS=assets cargo build)
- (cd server-cli && VELOREN_ASSETS=assets cargo build)
- rm -r -f commit-build
- mkdir commit-build
- cp target/debug/veloren-server-cli commit-build
- cp target/debug/veloren-voxygen commit-build
- cp -r assets commit-build/
- cp -r voxygen/shaders commit-build/
- rm -f commit-linux-debug.tar.bz2
- tar -cvjSf commit-linux-debug.tar.bz2 commit-build
- cp commit-linux-debug.tar.bz2 $CI_PROJECT_DIR
artifacts:
paths:
- commit-linux-debug.tar.bz2
expire_in: 1 week
except:
- schedules
only:
refs:
- master
- add-docker-gitlab-ci
commit-windows-debug:
stage: executable
image: registry.gitlab.com/veloren/veloren-docker-ci
tags:
- docker
script:
- (cd voxygen && VELOREN_ASSETS=assets cargo build --target=x86_64-pc-windows-gnu)
- (cd server-cli && VELOREN_ASSETS=assets cargo build --target=x86_64-pc-windows-gnu)
- rm -r -f commit-build
- mkdir commit-build
- cp target/x86_64-pc-windows-gnu/debug/veloren-server-cli.exe commit-build
- cp target/x86_64-pc-windows-gnu/debug/veloren-voxygen.exe commit-build
- cp -r assets commit-build/
- cp -r voxygen/shaders commit-build/
- rm -f commit-windows-debug.zip
- zip -r commit-windows-debug.zip commit-build
- cp commit-windows-debug.zip $CI_PROJECT_DIR
artifacts:
paths:
- commit-windows-debug.zip
expire_in: 1 week
except:
- schedules
only:
refs:
- master
- add-docker-gitlab-ci
#############
# NIGHTLY
#############
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-build
- mkdir nightly-build
- cp target/release/veloren-server-cli nightly-build
- cp target/release/veloren-voxygen nightly-build
- cp -r assets nightly-build/
- cp -r voxygen/shaders nightly-build/
- rm -f nightly-linux-optimized.tar.bz2
- tar -cvjSf nightly-linux-optimized.tar.bz2 nightly-build
- cp nightly-linux-optimized.zip $CI_PROJECT_DIR
artifacts:
paths:
- nightly-linux-optimized.tar.bz2
expire_in: 2 days
only:
- schedules
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-build
- mkdir nightly-build
- cp target/x86_64-pc-windows-gnu/release/veloren-server-cli.exe nightly-build
- cp target/x86_64-pc-windows-gnu/release/veloren-voxygen.exe nightly-build
- cp -r assets nightly-build/
- cp -r voxygen/shaders nightly-build/
- rm -f nightly-windows-optimized.zip
- zip -r nightly-windows-optimized.zip nightly-build
- cp nightly-windows-optimized.zip $CI_PROJECT_DIR
artifacts:
paths:
- nightly-windows-optimized.zip
expire_in: 2 days
only:
- schedules