veloren/.gitlab/CI/build.gitlab-ci.yml

121 lines
3.7 KiB
YAML

unittests:
extends: .recompile-branch
stage: build
variables:
GIT_DEPTH: 9999999999999
script:
- ln -s /dockercache/cache-all target
- cargo test --package veloren-voxygen --lib test_all_localizations -- --nocapture --ignored
- cargo test
retry:
max: 2
benchmarks:
extends: .recompile-branch
stage: build
tags:
- veloren-benchmark
script:
- unset DISABLE_GIT_LFS_CHECK
- ln -s /dockercache/cache-all target
- cargo bench
- TAGUUID="Z$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 16 | head -n 1)" || echo "ignore this returncode, dont ask me why, it works"
- echo $TAGUUID
- echo 'SET veloren.timestamp = "'"$(git show --no-patch --no-notes --pretty='%cd' HEAD)"'";' > upload.sql
- echo "SET veloren.branch = \$${TAGUUID}\$${CI_COMMIT_REF_NAME}\$${TAGUUID}\$;" >> upload.sql
- echo "SET veloren.sha = \$${TAGUUID}\$${CI_COMMIT_SHA}\$${TAGUUID}\$;" >> upload.sql
- find . -wholename "*new/*.csv" -exec echo '\copy benchmarks ("group", "function", "value", throughput_num, throughput_type, sample_measured_value, unit, iteration_count) from '"'{}' csv header" >> upload.sql \;
- cat upload.sql
- PGPASSWORD="${CIDBPASSWORD}" PGSSLROOTCERT="./.gitlab/ci-db.crt" psql "sslmode=verify-ca host=auth.veloren.net dbname=benchmarks" -U bsdrftsejrhdrjhgd -f upload.sql;
retry:
max: 2
# Coverage is needed on master for the README.md badge to work
# tmp remove simd as it doesnt work with tarpaulin: https://github.com/rust-lang/rust/issues/77529
coverage:
extends: .recompile
stage: build
script:
- ln -s /dockercache/cache-tarpaulin target
- find ./* -name "Cargo.toml" -exec sed -i 's/, "simd"]/]/g' {} \;
- find ./* -name "Cargo.toml" -exec sed -i 's/"simd"]/]/g' {} \;
- sed -i 's/vek /#vek /g' ./Cargo.toml;
- cargo tarpaulin -v -- --test-threads=2
retry:
max: 2
#linux, windows, macos builds here as template
.tlinux:
script:
- ln -s /dockercache/cache-release-linux target
- VELOREN_USERDATA_STRATEGY=executable cargo build --release
- cp -r target/release/veloren-server-cli $CI_PROJECT_DIR
- cp -r target/release/veloren-voxygen $CI_PROJECT_DIR
artifacts:
paths:
- veloren-server-cli
- veloren-voxygen
- assets/
- LICENSE
expire_in: 1 week
.twindows:
script:
- ln -s /dockercache/cache-release-windows target
- VELOREN_USERDATA_STRATEGY=executable cargo build --target=x86_64-pc-windows-gnu --release
- 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
.tmacos:
script:
- ln -s /dockercache/cache-release-macos target
- VELOREN_USERDATA_STRATEGY=executable PATH="/dockercache/osxcross/target/bin:$PATH" COREAUDIO_SDK_PATH=/dockercache/osxcross/target/SDK/MacOSX10.13.sdk CC=o64-clang CXX=o64-clang++ cargo build --target x86_64-apple-darwin --release
- cp -r target/x86_64-apple-darwin/release/veloren-server-cli $CI_PROJECT_DIR
- cp -r target/x86_64-apple-darwin/release/veloren-voxygen $CI_PROJECT_DIR
artifacts:
paths:
- veloren-server-cli
- veloren-voxygen
- assets/
- LICENSE
expire_in: 1 week
# build on release or master
linux:
extends:
- .tlinux
- .release
windows:
extends:
- .twindows
- .release
macos:
extends:
- .tmacos
- .release
# if NOT release or master, allow optional builds
opt-linux:
extends:
- .tlinux
- .optional-release
opt-windows:
extends:
- .twindows
- .optional-release
opt-macos:
extends:
- .tmacos
- .optional-release