change(ci): document and add retries + fmt

This commit is contained in:
Songtronix 2020-05-14 18:12:22 +02:00
parent 07d7d17182
commit b6135f60ed
5 changed files with 192 additions and 191 deletions

View File

@ -1,33 +1,43 @@
stages: stages:
- optional-builds - optional-builds
- check-compile - check-compile
- build-post - build-post
- publish - publish
variables: variables:
GIT_STRATEGY: fetch # Note: this is deprecated!
GIT_DEPTH: 3 # https://docs.gitlab.com/ee/ci/yaml/#git-strategy
GIT_CLEAN_FLAGS: -f # However in gitlab web ui it's set to fetch so it should be fine ¯\_(ツ)_/¯
GIT_STRATEGY: fetch
# Note: this is deprecated!
# ttps://docs.gitlab.com/ee/ci/yaml/#shallow-cloning
GIT_DEPTH: 3
GIT_CLEAN_FLAGS: -f
default: default:
image: registry.gitlab.com/veloren/veloren-docker-ci:latest image: registry.gitlab.com/veloren/veloren-docker-ci:latest
# https://docs.gitlab.com/ee/ci/pipelines/settings.html#auto-cancel-pending-pipelines # https://docs.gitlab.com/ee/ci/pipelines/settings.html#auto-cancel-pending-pipelines
interruptible: true interruptible: true
# Retry automatically incase the runner times out or there's a runner failure
retry:
max: 2
when:
- runner_system_failure
- stuck_or_timeout_failure
before_script: before_script:
- source $HOME/.cargo/env - source $HOME/.cargo/env
- df -h / - df -h /
- free -h - free -h
- cargo --version - cargo --version
- export DISABLE_GIT_LFS_CHECK=true - export DISABLE_GIT_LFS_CHECK=true
- export VELOREN_ASSETS="$(pwd)/assets" - export VELOREN_ASSETS="$(pwd)/assets"
- echo "VELOREN_ASSETS=$VELOREN_ASSETS" - echo "VELOREN_ASSETS=$VELOREN_ASSETS"
- rm -r target || echo "target doesnt exist, which is fine" - rm -r target || echo "target doesnt exist, which is fine"
- ln -s /dockercache/veloren/target target - ln -s /dockercache/veloren/target target
include: include:
- local: .gitlab/CI/optional-builds.gitlab-ci.yml - local: .gitlab/CI/optional-builds.gitlab-ci.yml
- local: .gitlab/CI/check-compile.gitlab-ci.yml - local: .gitlab/CI/check-compile.gitlab-ci.yml
- local: .gitlab/CI/build-post.gitlab-ci.yml - local: .gitlab/CI/build-post.gitlab-ci.yml
- local: .gitlab/CI/publish.gitlab-ci.yml - local: .gitlab/CI/publish.gitlab-ci.yml

View File

@ -1,114 +1,105 @@
unittests: unittests:
stage: build-post stage: build-post
when: delayed when: delayed
start_in: 5 seconds start_in: 5 seconds
tags: tags:
- veloren-docker - veloren-docker
script: script:
- echo "Workaround, cargo tests fails due some rust files are already deleted, so we just stack cargo test. if its the os error, it wont appear on them all, if its a real error, it will retry and then fail" - cargo test
- cargo test || ( sleep 10 && cargo test ) || ( sleep 10 && cargo test ) || cargo test || cargo test || cargo test || cargo test || cargo test || cargo test || cargo test || cargo test || cargo test || cargo test retry:
max: 2
coverage: coverage:
stage: build-post stage: build-post
allow_failure: true allow_failure: true
when: delayed when: delayed
start_in: 5 seconds start_in: 5 seconds
tags: tags:
- veloren-docker - veloren-docker
script: script:
- echo "Workaround, tarpaulin fails due some rust files are already deleted, so we just stack tarpaulin. if its the os error, it wont appear on them all, if its a real error, it will retry and then fail" - cargo tarpaulin -v
- cargo tarpaulin -v || ( sleep 10 && cargo tarpaulin -v ) || ( sleep 10 && cargo tarpaulin -v ) || cargo tarpaulin -v || cargo tarpaulin -v || cargo tarpaulin -v || cargo tarpaulin -v || cargo tarpaulin -v || cargo tarpaulin -v || cargo tarpaulin -v || cargo tarpaulin -v retry:
max: 2
benchmarks: benchmarks:
stage: build-post stage: build-post
when: delayed when: delayed
start_in: 5 seconds start_in: 5 seconds
tags: tags:
- veloren-docker - veloren-docker
script: script:
- unset DISABLE_GIT_LFS_CHECK - unset DISABLE_GIT_LFS_CHECK
- cargo bench - cargo bench
retry:
max: 2
localization-status: localization-status:
variables: variables:
GIT_DEPTH: 0 GIT_DEPTH: 0
stage: build-post stage: build-post
when: delayed when: delayed
start_in: 5 seconds start_in: 5 seconds
allow_failure: true allow_failure: true
tags: tags:
- veloren-docker - veloren-docker
script: script:
- cargo test -q test_all_localizations -- --nocapture --ignored - cargo test -q test_all_localizations -- --nocapture --ignored
# Artifacts
.artifact: &artifact
stage: build-post
when: delayed
start_in: 5 seconds
only:
refs:
- /^r[0-9]+\.[0-9]+\.[0-9]+/
- /^v[0-9]+\.[0-9]+/
- /^master$/
tags:
- veloren-docker
linux: linux:
stage: build-post <<: *artifact
when: delayed script:
start_in: 5 seconds - cargo build --release
only: - cp -r target/release/veloren-server-cli $CI_PROJECT_DIR
refs: - cp -r target/release/veloren-voxygen $CI_PROJECT_DIR
- /^r[0-9]+\.[0-9]+\.[0-9]+/ - strip --strip-all veloren-server-cli
- /^v[0-9]+\.[0-9]+/ - strip --strip-all veloren-voxygen
- /^master$/ artifacts:
tags: paths:
- veloren-docker - veloren-server-cli
script: - veloren-voxygen
- cargo build --release - assets/
- cp -r target/release/veloren-server-cli $CI_PROJECT_DIR - LICENSE
- cp -r target/release/veloren-voxygen $CI_PROJECT_DIR expire_in: 1 week
- strip --strip-all veloren-server-cli
- strip --strip-all veloren-voxygen
artifacts:
paths:
- veloren-server-cli
- veloren-voxygen
- assets/
- LICENSE
expire_in: 1 week
windows: windows:
stage: build-post <<: *artifact
when: delayed script:
start_in: 5 seconds - cargo build --target=x86_64-pc-windows-gnu --release
only: - cp -r target/x86_64-pc-windows-gnu/release/veloren-server-cli.exe $CI_PROJECT_DIR
refs: - cp -r target/x86_64-pc-windows-gnu/release/veloren-voxygen.exe $CI_PROJECT_DIR
- /^r[0-9]+\.[0-9]+\.[0-9]+/ artifacts:
- /^v[0-9]+\.[0-9]+/ paths:
- /^master$/ - veloren-server-cli.exe
tags: - veloren-voxygen.exe
- veloren-docker - assets/
script: - LICENSE
- cargo build --target=x86_64-pc-windows-gnu --release expire_in: 1 week
- 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
macos: macos:
stage: build-post <<: *artifact
when: delayed script:
start_in: 5 seconds - 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
only: - cp -r target/x86_64-apple-darwin/release/veloren-server-cli $CI_PROJECT_DIR
refs: - cp -r target/x86_64-apple-darwin/release/veloren-voxygen $CI_PROJECT_DIR
- /^r[0-9]+\.[0-9]+\.[0-9]+/ artifacts:
- /^v[0-9]+\.[0-9]+/ paths:
- /^master$/ - veloren-server-cli
tags: - veloren-voxygen
- veloren-docker - assets/
script: - LICENSE
- 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 expire_in: 1 week
- cp -r target/x86_64-apple-darwin/release/veloren-server-cli $CI_PROJECT_DIR allow_failure: true
- 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
allow_failure: true

View File

@ -1,22 +1,22 @@
check: check:
stage: check-compile stage: check-compile
tags: tags:
- veloren-docker - veloren-docker
script: script:
- RUSTFLAGS="-D warnings" cargo check --locked - RUSTFLAGS="-D warnings" cargo check --locked
code-quality: code-quality:
stage: check-compile stage: check-compile
tags: tags:
- veloren-docker - veloren-docker
script: script:
- cargo clippy -- --warn clippy::all - cargo clippy -- --warn clippy::all
- cargo fmt --all -- --check - cargo fmt --all -- --check
security: security:
stage: check-compile stage: check-compile
allow_failure: true allow_failure: true
tags: tags:
- veloren-docker - veloren-docker
script: script:
- cargo audit - cargo audit

View File

@ -1,37 +1,37 @@
.optional-release: &optional-release .optional-release: &optional-release
stage: optional-builds stage: optional-builds
tags: tags:
- veloren-docker - veloren-docker
except: except:
- schedules - schedules
when: manual when: manual
optional-release:linux: optional-release:linux:
<<: *optional-release <<: *optional-release
script: script:
- cargo build --verbose --release - cargo build --verbose --release
- cp target/release/veloren-server-cli $CI_PROJECT_DIR - cp target/release/veloren-server-cli $CI_PROJECT_DIR
- cp target/release/veloren-voxygen $CI_PROJECT_DIR - cp target/release/veloren-voxygen $CI_PROJECT_DIR
- strip --strip-all veloren-server-cli - strip --strip-all veloren-server-cli
- strip --strip-all veloren-voxygen - strip --strip-all veloren-voxygen
artifacts: artifacts:
paths: paths:
- veloren-server-cli - veloren-server-cli
- veloren-voxygen - veloren-voxygen
- assets/ - assets/
- LICENSE - LICENSE
expire_in: 1 week expire_in: 1 week
optional-release:windows: optional-release:windows:
<<: *optional-release <<: *optional-release
script: script:
- cargo build --verbose --target=x86_64-pc-windows-gnu --release - cargo build --verbose --target=x86_64-pc-windows-gnu --release
- cp target/x86_64-pc-windows-gnu/release/veloren-server-cli.exe $CI_PROJECT_DIR - cp target/x86_64-pc-windows-gnu/release/veloren-server-cli.exe $CI_PROJECT_DIR
- cp target/x86_64-pc-windows-gnu/release/veloren-voxygen.exe $CI_PROJECT_DIR - cp target/x86_64-pc-windows-gnu/release/veloren-voxygen.exe $CI_PROJECT_DIR
artifacts: artifacts:
paths: paths:
- veloren-server-cli.exe - veloren-server-cli.exe
- veloren-voxygen.exe - veloren-voxygen.exe
- assets/ - assets/
- LICENSE - LICENSE
expire_in: 1 week expire_in: 1 week

View File

@ -1,21 +1,21 @@
docker: docker:
stage: publish stage: publish
when: delayed when: delayed
start_in: 5 seconds start_in: 5 seconds
image: image:
name: gcr.io/kaniko-project/executor:debug name: gcr.io/kaniko-project/executor:debug
entrypoint: [""] entrypoint: [""]
dependencies: dependencies:
- linux - linux
before_script: before_script:
- ls "$CI_PROJECT_DIR/server-cli/" - ls "$CI_PROJECT_DIR/server-cli/"
only: only:
refs: refs:
- /^r[0-9]+\.[0-9]+\.[0-9]+/ - /^r[0-9]+\.[0-9]+\.[0-9]+/
- /^v[0-9]+\.[0-9]+/ - /^v[0-9]+\.[0-9]+/
- /^master$/ - /^master$/
tags: tags:
- veloren-docker - veloren-docker
script: script:
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json - echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
- /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/server-cli/Dockerfile --destination "${CI_REGISTRY_IMAGE}:${CI_COMMIT_REF_NAME}-server" - /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/server-cli/Dockerfile --destination "${CI_REGISTRY_IMAGE}:${CI_COMMIT_REF_NAME}-server"