extract relevant code in a script in order to remove duplicate coding with docker-ci repo

export VELOREN_ASSETS without pwd to keep caching working
This commit is contained in:
Marcel Märtens 2021-07-14 10:25:29 +02:00
parent 9a2c2b300a
commit 07c044f2e5
13 changed files with 65 additions and 38 deletions

View File

@ -33,11 +33,7 @@ before_script:
- df -h / - df -h /
- free -h - free -h
- cargo --version - cargo --version
- export DISABLE_GIT_LFS_CHECK=true - source ./.gitlab/scripts/env.sh
- export VELOREN_ASSETS="$(pwd)/assets"
- echo "VELOREN_ASSETS=$VELOREN_ASSETS"
- export RUSTFLAGS="-D warnings"
- export SHADERC_LIB_DIR=/shaderc/combined/
- rm -rf target || echo "it seems that sometimes OLD data is left over" - rm -rf target || echo "it seems that sometimes OLD data is left over"
# 8866215 is the user that is used to sync data to the collaboration repos # 8866215 is the user that is used to sync data to the collaboration repos

View File

@ -6,11 +6,8 @@ unittests:
GIT_DEPTH: 9999999999999 GIT_DEPTH: 9999999999999
script: script:
- ln -s /dockercache/target target - ln -s /dockercache/target target
- rm -r target/debug/incremental/veloren_* || echo "all good" # TMP FIX FOR 2021-03-22-nightly - cat ./.gitlab/scripts/unittest.sh
- cargo test --package veloren-i18n --lib test_all_localizations -- --nocapture --ignored - source ./.gitlab/scripts/unittest.sh
- cargo test --package veloren-common-assets asset_tweak::tests --features asset_tweak --lib
- rm -r target/debug/incremental* || echo "all good" # TMP FIX FOR 2021-03-22-nightly
- cargo test
retry: retry:
max: 2 max: 2
@ -23,12 +20,8 @@ benchmarks:
script: script:
- unset DISABLE_GIT_LFS_CHECK - unset DISABLE_GIT_LFS_CHECK
- ln -s /dockercache/target target - ln -s /dockercache/target target
- ls -la target/* - cat ./.gitlab/scripts/benchmark.sh
- rm -r target/debug/incremental/veloren_* || echo "all good" # TMP FIX FOR 2021-03-22-nightly - source ./.gitlab/scripts/benchmark.sh
- rm -r target/release/incremental/veloren_* || echo "all good" # TMP FIX FOR 2021-03-22-nightly
- rm -r target/debug/incremental/* || echo "all good" # TMP FIX FOR 2021-03-22-nightly
- rm -r target/release/incremental/* || echo "all good" # TMP FIX FOR 2021-03-22-nightly
- cargo bench || exit 0 #temp fix
- 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" - 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 $TAGUUID
- echo 'SET veloren.timestamp = "'"$(git show --no-patch --no-notes --pretty='%cd' HEAD)"'";' > upload.sql - echo 'SET veloren.timestamp = "'"$(git show --no-patch --no-notes --pretty='%cd' HEAD)"'";' > upload.sql
@ -48,11 +41,8 @@ coverage:
image: registry.gitlab.com/veloren/veloren-docker-ci/cache/tarpaulin:${CACHE_IMAGE_TAG} image: registry.gitlab.com/veloren/veloren-docker-ci/cache/tarpaulin:${CACHE_IMAGE_TAG}
script: script:
- ln -s /dockercache/target target - ln -s /dockercache/target target
- rm -r target/debug/incremental/veloren_* || echo "all good" # TMP FIX FOR 2021-03-22-nightly - cat ./.gitlab/scripts/coverage.sh
- find ./* -name "Cargo.toml" -exec sed -i 's/, "simd"]/]/g' {} \; - source ./.gitlab/scripts/coverage.sh
- 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: retry:
max: 2 max: 2
@ -61,10 +51,8 @@ coverage:
image: registry.gitlab.com/veloren/veloren-docker-ci/cache/release-linux:${CACHE_IMAGE_TAG} image: registry.gitlab.com/veloren/veloren-docker-ci/cache/release-linux:${CACHE_IMAGE_TAG}
script: script:
- ln -s /dockercache/target target - ln -s /dockercache/target target
- rm -r target/release/incremental/veloren_* || echo "all good" # TMP FIX FOR 2021-03-22-nightly - cat ./.gitlab/scripts/linux.sh
- export VELOREN_USERDATA_STRATEGY=executable - source ./.gitlab/scripts/linux.sh
- cargo build --release -p veloren-voxygen --no-default-features --features default-publish
- cargo build --release -p veloren-server-cli
- cp -r target/release/veloren-server-cli $CI_PROJECT_DIR - cp -r target/release/veloren-server-cli $CI_PROJECT_DIR
- cp -r target/release/veloren-voxygen $CI_PROJECT_DIR - cp -r target/release/veloren-voxygen $CI_PROJECT_DIR
artifacts: artifacts:
@ -78,13 +66,9 @@ coverage:
.twindows: .twindows:
image: registry.gitlab.com/veloren/veloren-docker-ci/cache/release-windows:${CACHE_IMAGE_TAG} image: registry.gitlab.com/veloren/veloren-docker-ci/cache/release-windows:${CACHE_IMAGE_TAG}
script: script:
- update-alternatives --set x86_64-w64-mingw32-gcc /usr/bin/x86_64-w64-mingw32-gcc-posix
- update-alternatives --set x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-posix
- ln -s /dockercache/target target - ln -s /dockercache/target target
- rm -r target/release/incremental/veloren_* || echo "all good" # TMP FIX FOR 2021-03-22-nightly - cat ./.gitlab/scripts/windows.sh
- export VELOREN_USERDATA_STRATEGY=executable - source ./.gitlab/scripts/windows.sh
- cargo build --target=x86_64-pc-windows-gnu --release -p veloren-voxygen --no-default-features --features default-publish
- cargo build --target=x86_64-pc-windows-gnu --release -p veloren-server-cli
- 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-server-cli.exe $CI_PROJECT_DIR
- cp -r target/x86_64-pc-windows-gnu/release/veloren-voxygen.exe $CI_PROJECT_DIR - cp -r target/x86_64-pc-windows-gnu/release/veloren-voxygen.exe $CI_PROJECT_DIR
- cp /usr/lib/gcc/x86_64-w64-mingw32/7.3-posix/libgcc_s_seh-1.dll $CI_PROJECT_DIR - cp /usr/lib/gcc/x86_64-w64-mingw32/7.3-posix/libgcc_s_seh-1.dll $CI_PROJECT_DIR

View File

@ -5,11 +5,8 @@ code-quality:
image: registry.gitlab.com/veloren/veloren-docker-ci/cache/quality:${CACHE_IMAGE_TAG} image: registry.gitlab.com/veloren/veloren-docker-ci/cache/quality:${CACHE_IMAGE_TAG}
script: script:
- ln -s /dockercache/target target - ln -s /dockercache/target target
- rm -r target/debug/incremental/* || echo "all good" # TMP FIX FOR 2021-03-22-nightly - cat ./.gitlab/scripts/code-quality.sh
- cargo clippy --all-targets --locked --features="bin_compression,bin_csv,bin_graphviz,bin_bot,asset_tweak" -- -D warnings - source ./.gitlab/scripts/code-quality.sh
# Ensure that the veloren-voxygen default-publish feature builds as it excludes some default features
- cargo clippy -p veloren-voxygen --locked --no-default-features --features="default-publish" -- -D warnings
- cargo fmt --all -- --check
security: security:
extends: .recompile-branch extends: .recompile-branch
@ -18,4 +15,5 @@ security:
allow_failure: true allow_failure: true
script: script:
- ln -s /dockercache/target target - ln -s /dockercache/target target
- cargo audit - cat ./.gitlab/scripts/security.sh
- source ./.gitlab/scripts/security.sh

4
.gitlab/scripts/benchmark.sh Executable file
View File

@ -0,0 +1,4 @@
#!/bin/bash
rm -r target/release/incremental/veloren_* || echo "all good" # TMP FIX FOR 2021-03-22-nightly
rm -r target/release/incremental/* || echo "all good" # TMP FIX FOR 2021-03-22-nightly
time cargo bench

4
.gitlab/scripts/ci.sh Executable file
View File

@ -0,0 +1,4 @@
#!/bin/bash
./.gitlab/scripts/security.sh
./.gitlab/scripts/code-quality.sh
./.gitlab/scripts/unittest.sh

View File

@ -0,0 +1,6 @@
#!/bin/bash
rm -r target/debug/incremental/* || echo "all good" # TMP FIX FOR 2021-03-22-nightly
time cargo clippy --all-targets --locked --features="bin_compression,bin_csv,bin_graphviz,bin_bot,asset_tweak" -- -D warnings &&
# Ensure that the veloren-voxygen default-publish feature builds as it excludes some default features
time cargo clippy -p veloren-voxygen --locked --no-default-features --features="default-publish" -- -D warnings &&
time cargo fmt --all -- --check

7
.gitlab/scripts/coverage.sh Executable file
View File

@ -0,0 +1,7 @@
#!/bin/bash
echo "modifying files in 5s, ctrl+c to abort" && sleep 5
rm -r target/debug/incremental/veloren_* || echo "all good" # TMP FIX FOR 2021-03-22-nightly
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;
time cargo tarpaulin --skip-clean -v -- --test-threads=2;

6
.gitlab/scripts/env.sh Normal file
View File

@ -0,0 +1,6 @@
#!/bin/bash
# exports default env variables in CI
export DISABLE_GIT_LFS_CHECK=true
export VELOREN_ASSETS="assets"
export RUSTFLAGS="-D warnings"
export SHADERC_LIB_DIR=/shaderc/combined/

6
.gitlab/scripts/linux.sh Executable file
View File

@ -0,0 +1,6 @@
#!/bin/bash
rm -r target/release/incremental/veloren_* || echo "all good" # TMP FIX FOR 2021-03-22-nightly
export VELOREN_USERDATA_STRATEGY=executable
time cargo build --release --no-default-features --features default-publish &&
time cargo build --release -p veloren-server-cli
# eveluate --bin instead, last time i checked (2021-07-14) it was 2 minutes slower on release (but faster on debug)

2
.gitlab/scripts/security.sh Executable file
View File

@ -0,0 +1,2 @@
#!/bin/bash
time cargo audit

7
.gitlab/scripts/unittest.sh Executable file
View File

@ -0,0 +1,7 @@
#!/bin/bash
export VELOREN_ASSETS="$(pwd)/assets"
rm -r target/debug/incremental/veloren_* || echo "all good" # TMP FIX FOR 2021-03-22-nightly
time cargo test --package veloren-i18n --lib test_all_localizations -- --nocapture --ignored &&
time cargo test --package veloren-common-assets asset_tweak::tests --features asset_tweak --lib &&
( rm -r target/debug/incremental* || echo "all good" ) && # TMP FIX FOR 2021-03-22-nightly
time cargo test

7
.gitlab/scripts/windows.sh Executable file
View File

@ -0,0 +1,7 @@
#!/bin/bash
update-alternatives --set x86_64-w64-mingw32-gcc /usr/bin/x86_64-w64-mingw32-gcc-posix
update-alternatives --set x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-posix
rm -r target/release/incremental/veloren_* || echo "all good" # TMP FIX FOR 2021-03-22-nightly
export VELOREN_USERDATA_STRATEGY=executable
time cargo build --target=x86_64-pc-windows-gnu --release --no-default-features --features default-publish &&
time cargo build --target=x86_64-pc-windows-gnu --release -p veloren-server-cli

View File

@ -607,7 +607,7 @@ fn get_max_slope(
.into_boxed_slice() .into_boxed_slice()
} }
//simd alternative // simd alternative
#[cfg(not(feature = "simd"))] #[cfg(not(feature = "simd"))]
#[derive(Copy, Clone)] #[derive(Copy, Clone)]
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]