diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e641013221..1661fb6ef6 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -3,72 +3,60 @@ # - target/ stages: + - pre-build - build # - test # - deploy # - post-run -rust-nightly: - stage: build - image: ubuntu:latest - variables: - GIT_SUBMODULE_STRATEGY: none - before_script: - - apt-get update - - apt-get install curl gcc git -y - - git submodule sync --recursive - - git submodule update --remote --recursive + +# 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: + - 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 update --init --recursive + - git status + - if [ -d target ]; then + ls -la target; + fi; + +clean-code: + stage: pre-build script: - - curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain nightly - - source /root/.cargo/env - - cargo build --target-dir="/cache" - - cargo test --verbose + - rustup component add rustfmt-preview + - cargo fmt --all -- --check + allow_failure: true + +build-voxygen: + stage: build + image: registry.gitlab.com/veloren/veloren-docker-ci + script: + - (cd voxygen && cargo build --target-dir="/cache") allow_failure: false -# # 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: -# - 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 update --init --recursive -# - git status -# - if [ -d target ]; then -# ls -la target; -# fi; -# # - git submodule update --init --recursive - -# clean-code: -# stage: build -# script: -# - rustup component add rustfmt-preview -# - cargo fmt --all -- --check -# allow_failure: true - -# build-voxygen: -# stage: build -# script: -# - (cd voxygen && cargo build) - -# build-server-cli: -# stage: build -# script: -# - (cd server-cli && cargo build) +build-server-cli: + stage: build + image: registry.gitlab.com/veloren/veloren-docker-ci + script: + - (cd server-cli && cargo build --target-dir="/cache") + allow_failure: false # unittests: # stage: test