diff --git a/.github/workflows/artifacts.yml b/.github/workflows/artifacts.yml deleted file mode 100644 index e5d6afb795..0000000000 --- a/.github/workflows/artifacts.yml +++ /dev/null @@ -1,60 +0,0 @@ -# This workflow will create artifacts for all merges into master -# It will include linux, macos binaries with assets and an msi installer. - -name: Artifacts - -on: - schedule: - - cron: '0 0 * * *' - -jobs: - release-macos: - runs-on: [macos-latest] - steps: - # LFS Checkout from Gitlab - - name: Gitlab LFS Checkout - run: | - mkdir -p $RUNNER_WORKSPACE/veloren - git init $RUNNER_WORKSPACE/veloren - cd $RUNNER_WORKSPACE/veloren - git remote add origin https://gitlab.com/veloren/veloren.git/ - git -c protocol.version=2 fetch --no-tags --prune --progress --no-recurse-submodules --depth=1 origin +$GITHUB_SHA:refs/remotes/origin/$(echo $GITHUB_REF | cut -c 12-) - git checkout --progress --force -B $(echo $GITHUB_REF | cut -c 12-) refs/remotes/origin/$(echo $GITHUB_REF | cut -c 12-) - git log -1 - # Prepare toolchain - - name: Pull toolchain - uses: actions-rs/toolchain@v1 - with: - profile: minimal - # Cache - - name: Cache cargo registry - uses: actions/cache@v1 - with: - path: ~/.cargo/registry - key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} - - name: Cache cargo index - uses: actions/cache@v1 - with: - path: ~/.cargo/git - key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }} - - name: Cache cargo build - uses: actions/cache@v1 - with: - path: target - key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }} - # Build & Package airshipper - - name: Build - run: cargo build - - name: Package - run: | - mkdir -p artifact/ - mkdir -p artifact/assets - cp -r assets/ artifact/assets/ - cp target/debug/veloren-server-cli artifact/ - cp target/debug/veloren-voxygen artifact/ - # Upload artifact - - name: Upload artifact - uses: actions/upload-artifact@v1 - with: - name: airshipper-macos - path: artifact/ diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 203c56a70b..8214728971 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,236 +1,45 @@ -image: registry.gitlab.com/veloren/veloren-docker-ci:latest +stages: + - optional-builds + - check-compile + - build-post + - publish variables: - GIT_STRATEGY: fetch - GIT_DEPTH: 3 - GIT_CLEAN_FLAGS: -f + # Note: this is deprecated! + # https://docs.gitlab.com/ee/ci/yaml/#git-strategy + # 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 -stages: - - optional-builds - - check-compile - - build-post - - publish +default: + image: registry.gitlab.com/veloren/veloren-docker-ci:latest + # https://docs.gitlab.com/ee/ci/pipelines/settings.html#auto-cancel-pending-pipelines + 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: - - source $HOME/.cargo/env - - df -h / - - free -h - - cargo --version - - export DISABLE_GIT_LFS_CHECK=true - - export VELOREN_ASSETS="$(pwd)/assets" - - echo "VELOREN_ASSETS=$VELOREN_ASSETS" - - rm -r target || echo "target doesnt exist, which is fine" - - ln -s /dockercache/veloren/target target + - source $HOME/.cargo/env + - df -h / + - free -h + - cargo --version + - export DISABLE_GIT_LFS_CHECK=true + - export VELOREN_ASSETS="$(pwd)/assets" + - echo "VELOREN_ASSETS=$VELOREN_ASSETS" + - rm -r target || echo "target doesnt exist, which is fine" + - ln -s /dockercache/veloren/target target -# -- optional build - -.optional-release: &optional-release - stage: optional-builds - tags: - - veloren-docker - except: - - schedules - when: manual - -optional-release:linux: - <<: *optional-release - script: - - cargo build --verbose --release - - cp target/release/veloren-server-cli $CI_PROJECT_DIR - - cp target/release/veloren-voxygen $CI_PROJECT_DIR - - strip --strip-all veloren-server-cli - - strip --strip-all veloren-voxygen - artifacts: - paths: - - veloren-server-cli - - veloren-voxygen - - assets/ - - LICENSE - expire_in: 1 week - -optional-release:windows: - <<: *optional-release - script: - - 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-voxygen.exe $CI_PROJECT_DIR - artifacts: - paths: - - veloren-server-cli.exe - - veloren-voxygen.exe - - assets/ - - LICENSE - expire_in: 1 week - -# -- - -# -- check - -check: - stage: check-compile - tags: - - veloren-docker - script: - - RUSTFLAGS="-D warnings" cargo check --locked - -code-quality: - stage: check-compile - tags: - - veloren-docker - script: - - cargo clippy -- --warn clippy::all - - cargo fmt --all -- --check - -security: - stage: check-compile - allow_failure: true - tags: - - veloren-docker - script: - - cargo audit - -# -- - -# -- build-post - -unittests: - stage: build-post - when: delayed - start_in: 5 seconds - tags: - - veloren-docker - 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 || ( 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 - -coverage: - stage: build-post - allow_failure: true - when: delayed - start_in: 5 seconds - tags: - - veloren-docker - 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 || ( 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 - -benchmarks: - stage: build-post - when: delayed - start_in: 5 seconds - tags: - - veloren-docker - script: - - unset DISABLE_GIT_LFS_CHECK - - cargo bench - -localization-status: - variables: - GIT_DEPTH: 0 - stage: build-post - when: delayed - start_in: 5 seconds - allow_failure: true - tags: - - veloren-docker - script: - - cargo test -q test_all_localizations -- --nocapture --ignored - -linux: - 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 - script: - - cargo build --release - - cp -r target/release/veloren-server-cli $CI_PROJECT_DIR - - cp -r target/release/veloren-voxygen $CI_PROJECT_DIR - - 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: - 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 - script: - - 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 - -macos: - 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 - script: - - 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 - allow_failure: true -# -- - -# -- publish - -docker: - stage: publish - when: delayed - start_in: 5 seconds - image: - name: gcr.io/kaniko-project/executor:debug - entrypoint: [""] - dependencies: - - linux - before_script: - - ls "$CI_PROJECT_DIR/server-cli/" - only: - refs: - - /^r[0-9]+\.[0-9]+\.[0-9]+/ - - /^v[0-9]+\.[0-9]+/ - - /^master$/ - tags: - - veloren-docker - script: - - 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" - -# -- +include: + - local: .gitlab/CI/recompile.yml + - local: .gitlab/CI/release.yml + - local: .gitlab/CI/optional-builds.gitlab-ci.yml + - local: .gitlab/CI/check-compile.gitlab-ci.yml + - local: .gitlab/CI/build-post.gitlab-ci.yml + - local: .gitlab/CI/publish.gitlab-ci.yml diff --git a/.gitlab/CI/build-post.gitlab-ci.yml b/.gitlab/CI/build-post.gitlab-ci.yml new file mode 100644 index 0000000000..96525669c9 --- /dev/null +++ b/.gitlab/CI/build-post.gitlab-ci.yml @@ -0,0 +1,89 @@ +.tests: &tests + extends: .recompile + stage: build-post + tags: + - veloren-docker + +unittests: + <<: *tests + script: + - cargo test + retry: + max: 2 + +coverage: + <<: *tests + allow_failure: true + script: + - cargo tarpaulin -v + retry: + max: 2 + +benchmarks: + <<: *tests + script: + - unset DISABLE_GIT_LFS_CHECK + - cargo bench + retry: + max: 2 + +localization-status: + <<: *tests + variables: + GIT_DEPTH: 0 + allow_failure: true + script: + - cargo test -q test_all_localizations -- --nocapture --ignored + +# Artifacts +.artifact: &artifact + extends: .recompile + extends: .release + stage: build-post + tags: + - veloren-docker + +linux: + <<: *artifact + script: + - cargo build --release + - cp -r target/release/veloren-server-cli $CI_PROJECT_DIR + - cp -r target/release/veloren-voxygen $CI_PROJECT_DIR + - 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: + <<: *artifact + script: + - 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 + +macos: + <<: *artifact + script: + - 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 + allow_failure: true diff --git a/.gitlab/CI/check-compile.gitlab-ci.yml b/.gitlab/CI/check-compile.gitlab-ci.yml new file mode 100644 index 0000000000..f5f73b928c --- /dev/null +++ b/.gitlab/CI/check-compile.gitlab-ci.yml @@ -0,0 +1,25 @@ +check: + extends: .recompile + stage: check-compile + tags: + - veloren-docker + script: + - RUSTFLAGS="-D warnings" cargo check --locked + +code-quality: + extends: .recompile + stage: check-compile + tags: + - veloren-docker + script: + - cargo clippy -- --warn clippy::all + - cargo fmt --all -- --check + +security: + extends: .recompile + stage: check-compile + allow_failure: true + tags: + - veloren-docker + script: + - cargo audit diff --git a/.gitlab/CI/optional-builds.gitlab-ci.yml b/.gitlab/CI/optional-builds.gitlab-ci.yml new file mode 100644 index 0000000000..9525f0e353 --- /dev/null +++ b/.gitlab/CI/optional-builds.gitlab-ci.yml @@ -0,0 +1,51 @@ +.optional-release: &optional-release + stage: optional-builds + tags: + - veloren-docker + except: + - schedules + when: manual + +optional-release:linux: + <<: *optional-release + script: + - cargo build --verbose --release + - cp target/release/veloren-server-cli $CI_PROJECT_DIR + - cp target/release/veloren-voxygen $CI_PROJECT_DIR + - strip --strip-all veloren-server-cli + - strip --strip-all veloren-voxygen + artifacts: + paths: + - veloren-server-cli + - veloren-voxygen + - assets/ + - LICENSE + expire_in: 1 week + +optional-release:windows: + <<: *optional-release + script: + - 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-voxygen.exe $CI_PROJECT_DIR + artifacts: + paths: + - veloren-server-cli.exe + - veloren-voxygen.exe + - assets/ + - LICENSE + expire_in: 1 week + +optional-release:macos: + <<: *optional-release + script: + - 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 diff --git a/.gitlab/CI/publish.gitlab-ci.yml b/.gitlab/CI/publish.gitlab-ci.yml new file mode 100644 index 0000000000..e170bfa7cd --- /dev/null +++ b/.gitlab/CI/publish.gitlab-ci.yml @@ -0,0 +1,17 @@ +# Publishes veloren-server-cli to the gitlab container registry +# https://gitlab.com/veloren/veloren/container_registry +docker: + stage: publish + extends: .release + image: + name: gcr.io/kaniko-project/executor:debug + entrypoint: [""] + dependencies: + - linux + before_script: + - ls "$CI_PROJECT_DIR/server-cli/" + tags: + - veloren-docker + script: + - 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" diff --git a/.gitlab/CI/recompile.yml b/.gitlab/CI/recompile.yml new file mode 100644 index 0000000000..86d1e08783 --- /dev/null +++ b/.gitlab/CI/recompile.yml @@ -0,0 +1,8 @@ +# Template to only run if actual changes has been made to the code and not just documentation +.recompile: + rules: + - changes: + - "*.{rs,ron,toml,vox,png}" + - "rust-toolchain" + - ".gitlab-ci.yml" + - "*.gitlab-ci.yml" diff --git a/.gitlab/CI/release.yml b/.gitlab/CI/release.yml new file mode 100644 index 0000000000..e1f61a850c --- /dev/null +++ b/.gitlab/CI/release.yml @@ -0,0 +1,4 @@ +# Template to only run if pushes to master or a tag happened +.release: + rules: + - if: $CI_COMMIT_REF_NAME =~ /^master.$/ || $CI_COMMIT_REF_NAME =~ /^r[0-9]+\.[0-9]+\.[0-9]+/ || $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+/ diff --git a/.gitlab/CODEOWNERS b/.gitlab/CODEOWNERS deleted file mode 100644 index c1aa0c58d8..0000000000 --- a/.gitlab/CODEOWNERS +++ /dev/null @@ -1,28 +0,0 @@ -# Defines people who should approve to certain parts of the codebase - -/assets/ @assetsandvisualdesign @frontend -/chat-cli/ @frontend -/client/ @backend @networking -/common/ @backend @networking -/server/ @backend @networking -/server-cli/ @frontend -#/voxygen/ @someone -/voxygen/anim/ @animation -/voxygen/audio/ @audio -#/voxygen/hud/ @someone -#/voxygen/menu / @someone -#/voxygen/mesh/ @someone -/voxygen/render/ @rendering -#/voxygen/scene/ @someone -#/voxygen/ui/ @someone -/world/ @worldgen - -# All files related to documentation or game unrelated content needs to be approved by the meta group -*.md @meta -*.nix @meta -.gitignore @meta -.gitattributes @meta -.gitlab-ci.yml @meta -rust-toolchain @meta -LICENSE @meta -.cargo/ @meta \ No newline at end of file diff --git a/.gitlab/issue_templates/Bug.md b/.gitlab/issue_templates/Bug.md new file mode 100644 index 0000000000..a4906f02be --- /dev/null +++ b/.gitlab/issue_templates/Bug.md @@ -0,0 +1,41 @@ + + +### Summary + +(Summarize the bug encountered concisely) + +### Steps to reproduce + +(How one can reproduce the issue - this is very important) + +### Relevant logs and/or screenshots + +
+Logs and/or screenshots of the issue +
+
+(Paste any relevant logs - please use code blocks (```) to format console output,
+logs, and code as it's tough to read otherwise.)
+
+
+
+ +#### System details + +(Include important system details like OS and incase it's a graphical issue the gpu) + +#### Veloren version + +(What version the bug happened e.g. Nightly, Stable 0.X.0, master) + +/label ~ status::needs investigation ~type::bug