mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
CI improvements
This commit is contained in:
parent
f95561f9df
commit
4f52a88c27
395
.gitlab-ci.yml
395
.gitlab-ci.yml
@ -1,220 +1,217 @@
|
|||||||
stages:
|
image: registry.gitlab.com/veloren/veloren-docker-ci:rework
|
||||||
- optional-builds
|
|
||||||
- check-compile
|
|
||||||
- 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 don't need any gitlab caches.
|
|
||||||
variables:
|
variables:
|
||||||
GIT_STRATEGY: none
|
GIT_STRATEGY: none
|
||||||
|
|
||||||
|
stages:
|
||||||
|
- optional-builds
|
||||||
|
- check-compile
|
||||||
|
- post
|
||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
# Make the directories
|
- mkdir -p veloren
|
||||||
- mkdir -p /cache/veloren
|
- cd veloren
|
||||||
- rm -rf /cache/veloren/bin
|
- git lfs install
|
||||||
- cd /cache/veloren
|
- if [ ! -d ".git" ]; then git clone https://gitlab.com/veloren/veloren.git .; fi
|
||||||
- if [ -d .git ]; then
|
- git clean -f
|
||||||
echo "is git dir";
|
- git lfs fetch
|
||||||
else
|
- git lfs checkout $CI_COMMIT_SHA
|
||||||
git clone $CI_REPOSITORY_URL . ;
|
- source $HOME/.cargo/env
|
||||||
fi;
|
- df -h
|
||||||
- mkdir -p /cache/veloren/bin
|
- free -h
|
||||||
# Remove previous Git files
|
- gcc -v
|
||||||
- rm -f .git/index.lock
|
- cargo --version
|
||||||
- rm -f .git/shallow.lock
|
|
||||||
- rm -f .git/HEAD.lock
|
|
||||||
- rm -f .git/hocks/post-checkout
|
|
||||||
# Do an efficient Git 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;
|
|
||||||
# Prepare Git LFS
|
|
||||||
- git lfs install;
|
|
||||||
- git lfs fetch;
|
|
||||||
- git lfs checkout;
|
|
||||||
# Debug info
|
|
||||||
- git status
|
|
||||||
- rustup -v show
|
|
||||||
# See what's in the target folder?
|
|
||||||
- if [ -d target ]; then
|
|
||||||
ls -la target;
|
|
||||||
fi;
|
|
||||||
# Overwrite toolchain
|
|
||||||
- cp /rust-toolchain /cache/veloren/rust-toolchain
|
|
||||||
|
|
||||||
#############
|
# -- optional build
|
||||||
# Optional build
|
|
||||||
#############
|
|
||||||
|
|
||||||
.optional: &optional
|
.optional-debug: &optional-debug
|
||||||
stage: optional-builds
|
stage: optional-builds
|
||||||
image: registry.gitlab.com/veloren/veloren-docker-ci
|
tags:
|
||||||
tags:
|
- veloren-docker
|
||||||
- veloren-docker
|
except:
|
||||||
except:
|
- schedules
|
||||||
- schedules
|
when: manual
|
||||||
when: manual
|
artifacts:
|
||||||
artifacts:
|
paths:
|
||||||
paths:
|
- veloren/artifact
|
||||||
- ./
|
expire_in: 1 week
|
||||||
expire_in: 1 week
|
|
||||||
|
|
||||||
optional:linux-debug:
|
optional-debug:linux:
|
||||||
<<: *optional
|
<<: *optional-debug
|
||||||
script:
|
cache:
|
||||||
- (cd voxygen && VELOREN_ASSETS=assets cargo build)
|
key: "cache-linux-debug"
|
||||||
- (cd server-cli && VELOREN_ASSETS=assets cargo build)
|
paths:
|
||||||
- cp target/debug/veloren-server-cli $CI_PROJECT_DIR
|
- veloren/
|
||||||
- cp target/debug/veloren-voxygen $CI_PROJECT_DIR
|
script:
|
||||||
- cp -r assets $CI_PROJECT_DIR
|
- 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:windows-debug:
|
optional-debug:windows:
|
||||||
<<: *optional
|
<<: *optional-debug
|
||||||
script:
|
cache:
|
||||||
- (cd voxygen && VELOREN_ASSETS=assets cargo build --target=x86_64-pc-windows-gnu)
|
key: "cache-windows-debug"
|
||||||
- (cd server-cli && VELOREN_ASSETS=assets cargo build --target=x86_64-pc-windows-gnu)
|
paths:
|
||||||
- cp target/x86_64-pc-windows-gnu/debug/veloren-server-cli.exe $CI_PROJECT_DIR
|
- veloren/
|
||||||
- cp target/x86_64-pc-windows-gnu/debug/veloren-voxygen.exe $CI_PROJECT_DIR
|
script:
|
||||||
- cp -r assets $CI_PROJECT_DIR
|
- 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 ..
|
||||||
# Optional release build
|
- 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
|
.optional-release: &optional-release
|
||||||
stage: optional-builds
|
stage: optional-builds
|
||||||
image: registry.gitlab.com/veloren/veloren-docker-ci
|
tags:
|
||||||
tags:
|
- veloren-docker
|
||||||
- veloren-docker
|
except:
|
||||||
except:
|
- schedules
|
||||||
- schedules
|
when: manual
|
||||||
when: manual
|
artifacts:
|
||||||
artifacts:
|
paths:
|
||||||
paths:
|
- veloren/artifact
|
||||||
- ./
|
expire_in: 1 week
|
||||||
expire_in: 1 month
|
|
||||||
|
|
||||||
optional-release:linux-debug:
|
optional-release:linux:
|
||||||
<<: *optional-release
|
<<: *optional-release
|
||||||
script:
|
cache:
|
||||||
- (cd voxygen && VELOREN_ASSETS=assets cargo build --release)
|
key: "cache-linux-release"
|
||||||
- (cd server-cli && VELOREN_ASSETS=assets cargo build --release)
|
paths:
|
||||||
- cp target/debug/veloren-server-cli $CI_PROJECT_DIR
|
- veloren/
|
||||||
- cp target/debug/veloren-voxygen $CI_PROJECT_DIR
|
script:
|
||||||
- cp -r assets $CI_PROJECT_DIR
|
- 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-debug:
|
optional-release:windows:
|
||||||
<<: *optional-release
|
<<: *optional-release
|
||||||
script:
|
cache:
|
||||||
- (cd voxygen && VELOREN_ASSETS=assets cargo build --release --target=x86_64-pc-windows-gnu)
|
key: "cache-windows-release"
|
||||||
- (cd server-cli && VELOREN_ASSETS=assets cargo build --release --target=x86_64-pc-windows-gnu)
|
paths:
|
||||||
- cp target/x86_64-pc-windows-gnu/debug/veloren-server-cli.exe $CI_PROJECT_DIR
|
- veloren/
|
||||||
- cp target/x86_64-pc-windows-gnu/debug/veloren-voxygen.exe $CI_PROJECT_DIR
|
script:
|
||||||
- cp -r assets $CI_PROJECT_DIR
|
- 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-voxygen:
|
# -- check
|
||||||
stage: check-compile
|
|
||||||
image: registry.gitlab.com/veloren/veloren-docker-ci
|
|
||||||
tags:
|
|
||||||
- veloren-docker
|
|
||||||
script:
|
|
||||||
- (cd voxygen && RUSTFLAGS="-D warnings" cargo check)
|
|
||||||
|
|
||||||
check-server-cli:
|
check:
|
||||||
stage: check-compile
|
stage: check-compile
|
||||||
image: registry.gitlab.com/veloren/veloren-docker-ci
|
cache:
|
||||||
tags:
|
key: "cache-linux-debug"
|
||||||
- veloren-docker
|
paths:
|
||||||
script:
|
- veloren/
|
||||||
- (cd server-cli && RUSTFLAGS="-D warnings" cargo check)
|
tags:
|
||||||
|
- veloren-docker
|
||||||
|
script:
|
||||||
|
- RUSTFLAGS="-D warnings" cargo check --verbose
|
||||||
|
|
||||||
#############
|
code-quality:
|
||||||
# POST-BUILD
|
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:
|
unittests:
|
||||||
stage: post-build
|
stage: post
|
||||||
image: registry.gitlab.com/veloren/veloren-docker-ci
|
cache:
|
||||||
tags:
|
key: "cache-linux-debug"
|
||||||
- veloren-docker
|
paths:
|
||||||
script:
|
- veloren/
|
||||||
- cargo test
|
when: delayed
|
||||||
|
start_in: 5 seconds
|
||||||
|
tags:
|
||||||
|
- veloren-docker
|
||||||
|
script:
|
||||||
|
- cargo test
|
||||||
|
|
||||||
benchmarktests:
|
benchmarks:
|
||||||
stage: post-build
|
stage: post
|
||||||
image: registry.gitlab.com/veloren/veloren-docker-ci
|
cache:
|
||||||
tags:
|
key: "cache-linux-release"
|
||||||
- veloren-docker
|
paths:
|
||||||
script:
|
- veloren/
|
||||||
- cargo bench
|
when: delayed
|
||||||
allow_failure: true
|
start_in: 5 seconds
|
||||||
|
tags:
|
||||||
|
- veloren-docker
|
||||||
|
script:
|
||||||
|
- cargo bench
|
||||||
|
allow_failure: true
|
||||||
|
|
||||||
clean-code:
|
linux:
|
||||||
stage: post-build
|
stage: post
|
||||||
image: registry.gitlab.com/veloren/veloren-docker-ci
|
cache:
|
||||||
tags:
|
key: "cache-linux-release"
|
||||||
- veloren-docker
|
paths:
|
||||||
script:
|
- veloren/
|
||||||
- cargo fmt --all -- --check
|
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
|
||||||
|
|
||||||
# # Coverage needs to be disabled until an issue in the Rust compiler is fixed
|
windows:
|
||||||
# # https://github.com/rust-lang/rust/issues/58375
|
stage: post
|
||||||
# coverage:
|
cache:
|
||||||
# stage: post-build
|
key: "cache-windows-release"
|
||||||
# image: registry.gitlab.com/veloren/veloren-docker-ci
|
paths:
|
||||||
# tags:
|
- veloren/
|
||||||
# - veloren-docker
|
when: delayed
|
||||||
# script:
|
start_in: 5 seconds
|
||||||
# - cargo tarpaulin --all
|
only:
|
||||||
# allow_failure: true
|
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 ./artifact
|
||||||
|
- cp -r target/x86_64-pc-windows-gnu/release/veloren-voxygen ./artifact
|
||||||
|
- cp -r assets ./artifact
|
||||||
|
|
||||||
# For now, Clippy will just care about performance improvements as much of the
|
# --
|
||||||
# codebase is not in a place that cleaning warnings will be benificial
|
|
||||||
|
|
||||||
clippy:
|
|
||||||
stage: post-build
|
|
||||||
image: registry.gitlab.com/veloren/veloren-docker-ci
|
|
||||||
tags:
|
|
||||||
- veloren-docker
|
|
||||||
script:
|
|
||||||
- cargo clippy -- -W clippy::all
|
|
||||||
|
|
||||||
.commit: &commit
|
|
||||||
stage: post-build
|
|
||||||
image: registry.gitlab.com/veloren/veloren-docker-ci
|
|
||||||
tags:
|
|
||||||
- veloren-docker
|
|
||||||
except:
|
|
||||||
- schedules
|
|
||||||
only:
|
|
||||||
refs:
|
|
||||||
- master
|
|
||||||
artifacts:
|
|
||||||
paths:
|
|
||||||
- ./
|
|
||||||
expire_in: 1 week
|
|
||||||
|
|
||||||
commit:linux-debug:
|
|
||||||
<<: *commit
|
|
||||||
script:
|
|
||||||
- (cd voxygen && VELOREN_ASSETS=assets cargo build)
|
|
||||||
- (cd server-cli && VELOREN_ASSETS=assets cargo build)
|
|
||||||
- cp target/debug/veloren-server-cli $CI_PROJECT_DIR
|
|
||||||
- cp target/debug/veloren-voxygen $CI_PROJECT_DIR
|
|
||||||
- cp -r assets $CI_PROJECT_DIR
|
|
||||||
|
|
||||||
commit:windows-debug:
|
|
||||||
<<: *commit
|
|
||||||
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)
|
|
||||||
- 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
|
|
||||||
- cp -r assets $CI_PROJECT_DIR
|
|
||||||
|
Loading…
Reference in New Issue
Block a user