From e5e5947a160ec98081112e016e60f5e326efae70 Mon Sep 17 00:00:00 2001 From: timvisee Date: Wed, 25 Jan 2023 20:31:22 +0100 Subject: [PATCH 1/8] Remove macOS builds from GitLab CI, instruct to compile in README --- .gitlab-ci.yml | 45 --------------------------------------------- README.md | 3 ++- 2 files changed, 2 insertions(+), 46 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 50e3016..a7e9854 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -51,18 +51,6 @@ before_script: - cargo check --no-default-features --features lobby --verbose check: <<: *check-base -check-macos: - tags: - - macos - only: - - master - - /^v(\d+\.)*\d+$/ - before_script: - - rustup default stable - - | - rustc --version - cargo --version - <<: *check-base check-windows: stage: check tags: @@ -183,31 +171,6 @@ build-aarch64-linux-gnu: - lazymc-$TARGET expire_in: 1 month -# Build using Rust stable on macOS -build-macos: - stage: build - tags: - - macos - only: - - master - - /^v(\d+\.)*\d+$/ - needs: [] - variables: - TARGET: x86_64-apple-darwin - before_script: - - rustup default stable - - | - rustc --version - cargo --version - script: - - cargo build --target=$TARGET --release --locked --verbose - - mv target/$TARGET/release/lazymc ./lazymc-$TARGET - artifacts: - name: lazymc-x86_64-macos - paths: - - lazymc-$TARGET - expire_in: 1 month - # Build using Rust stable on Windows build-x86_64-windows: stage: build @@ -264,7 +227,6 @@ release-gitlab-generic-package: - build-x86_64-linux-musl - build-armv7-linux-gnu - build-aarch64-linux-gnu - - build-macos - build-x86_64-windows only: - /^v(\d+\.)*\d+$/ @@ -273,7 +235,6 @@ release-gitlab-generic-package: LINUX_MUSL_BIN: "lazymc-x86_64-unknown-linux-musl" LINUX_ARMV7_GNU_BIN: "lazymc-armv7-unknown-linux-gnueabihf" LINUX_AARCH64_GNU_BIN: "lazymc-aarch64-unknown-linux-gnu" - MACOS_BIN: "lazymc-x86_64-apple-darwin" WINDOWS_BIN: "lazymc-x86_64-pc-windows-msvc.exe" before_script: [] script: @@ -290,8 +251,6 @@ release-gitlab-generic-package: curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file ${LINUX_ARMV7_GNU_BIN} ${PACKAGE_REGISTRY_URL}/${LINUX_ARMV7_GNU_BIN} - | curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file ${LINUX_AARCH64_GNU_BIN} ${PACKAGE_REGISTRY_URL}/${LINUX_AARCH64_GNU_BIN} - - | - curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file ${MACOS_BIN} ${PACKAGE_REGISTRY_URL}/${MACOS_BIN} - | curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file ${WINDOWS_BIN} ${PACKAGE_REGISTRY_URL}/${WINDOWS_BIN} @@ -306,7 +265,6 @@ release-gitlab-release: LINUX_MUSL_BIN: "lazymc-x86_64-unknown-linux-musl" LINUX_ARMV7_GNU_BIN: "lazymc-armv7-unknown-linux-gnueabihf" LINUX_AARCH64_GNU_BIN: "lazymc-aarch64-unknown-linux-gnu" - MACOS_BIN: "lazymc-x86_64-apple-darwin" WINDOWS_BIN: "lazymc-x86_64-pc-windows-msvc.exe" before_script: [] script: @@ -321,7 +279,6 @@ release-gitlab-release: --assets-link "{\"name\":\"${LINUX_MUSL_BIN}\",\"url\":\"${PACKAGE_REGISTRY_URL}/${LINUX_MUSL_BIN}\"}" \ --assets-link "{\"name\":\"${LINUX_ARMV7_GNU_BIN}\",\"url\":\"${PACKAGE_REGISTRY_URL}/${LINUX_ARMV7_GNU_BIN}\"}" \ --assets-link "{\"name\":\"${LINUX_AARCH64_GNU_BIN}\",\"url\":\"${PACKAGE_REGISTRY_URL}/${LINUX_AARCH64_GNU_BIN}\"}" \ - --assets-link "{\"name\":\"${MACOS_BIN}\",\"url\":\"${PACKAGE_REGISTRY_URL}/${MACOS_BIN}\"}" \ --assets-link "{\"name\":\"${WINDOWS_BIN}\",\"url\":\"${PACKAGE_REGISTRY_URL}/${WINDOWS_BIN}\"}" # Publish GitHub release @@ -334,7 +291,6 @@ release-github: - build-x86_64-linux-musl - build-armv7-linux-gnu - build-aarch64-linux-gnu - - build-macos - build-x86_64-windows before_script: [] script: @@ -353,5 +309,4 @@ release-github: - ./github-release upload --token "$GITHUB_TOKEN" --owner timvisee --repo lazymc --tag "$CI_COMMIT_REF_NAME" --file ./lazymc-x86_64-unknown-linux-musl --name lazymc-$CI_COMMIT_REF_NAME-linux-x64-static - ./github-release upload --token "$GITHUB_TOKEN" --owner timvisee --repo lazymc --tag "$CI_COMMIT_REF_NAME" --file ./lazymc-armv7-unknown-linux-gnueabihf --name lazymc-$CI_COMMIT_REF_NAME-linux-armv7 - ./github-release upload --token "$GITHUB_TOKEN" --owner timvisee --repo lazymc --tag "$CI_COMMIT_REF_NAME" --file ./lazymc-aarch64-unknown-linux-gnu --name lazymc-$CI_COMMIT_REF_NAME-linux-aarch64 - - ./github-release upload --token "$GITHUB_TOKEN" --owner timvisee --repo lazymc --tag "$CI_COMMIT_REF_NAME" --file ./lazymc-x86_64-apple-darwin --name lazymc-$CI_COMMIT_REF_NAME-macos - ./github-release upload --token "$GITHUB_TOKEN" --owner timvisee --repo lazymc --tag "$CI_COMMIT_REF_NAME" --file ./lazymc-x86_64-pc-windows-msvc.exe --name lazymc-$CI_COMMIT_REF_NAME-windows.exe diff --git a/README.md b/README.md index 13d1906..6e987e3 100644 --- a/README.md +++ b/README.md @@ -67,7 +67,8 @@ _Note: these instructions are for Linux & macOS, for Windows look Make sure you meet all [requirements](#requirements). Download the appropriate binary for your system from the [latest -release][latest-release] page. +release][latest-release] page. On macOS you must [compile from +source](#compile-from-source). Place the binary in your Minecraft server directory, rename it if you like. Open a terminal, go to the directory, and make sure you can invoke it: From 35fff7168b5e801d99d837e9a75094471c93e787 Mon Sep 17 00:00:00 2001 From: timvisee Date: Wed, 25 Jan 2023 20:33:25 +0100 Subject: [PATCH 2/8] Disable Rust build cache in CI --- .gitlab-ci.yml | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a7e9854..181970d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -11,12 +11,6 @@ stages: variables: TARGET: x86_64-unknown-linux-gnu -# Rust build cache configuration -.rust-build-cache: &rust-build-cache - key: "$CI_PIPELINE_ID" - paths: - - target/ - # Install build dependencies before_script: - apt-get update @@ -42,8 +36,6 @@ before_script: # Check on stable, beta and nightly .check-base: &check-base stage: check - cache: - <<: *rust-build-cache script: - cargo check --verbose - cargo check --no-default-features --verbose @@ -67,8 +59,6 @@ check-windows: build-x86_64-linux-gnu: stage: build needs: [] - cache: - <<: *rust-build-cache script: - cargo build --target=$TARGET --release --locked --verbose - mv target/$TARGET/release/lazymc ./lazymc-$TARGET @@ -85,8 +75,6 @@ build-x86_64-linux-musl: needs: [] variables: TARGET: x86_64-unknown-linux-musl - cache: - <<: *rust-build-cache script: - rustup target add $TARGET - cargo build --target=$TARGET --release --locked --verbose @@ -108,8 +96,6 @@ build-armv7-linux-gnu: needs: [] variables: TARGET: armv7-unknown-linux-gnueabihf - cache: - <<: *rust-build-cache before_script: - apt-get update - apt-get install -y --no-install-recommends build-essential @@ -143,8 +129,6 @@ build-aarch64-linux-gnu: needs: [] variables: TARGET: aarch64-unknown-linux-gnu - cache: - <<: *rust-build-cache before_script: - apt-get update - apt-get install -y --no-install-recommends build-essential @@ -195,8 +179,6 @@ test-cargo-x86_64-linux-gnu: stage: test needs: [] dependencies: [] - cache: - <<: *rust-build-cache script: - cargo test --locked --verbose - cargo test --locked --no-default-features --verbose From 39feb0bdc2542789d3cca5ba2cd51a20940174e9 Mon Sep 17 00:00:00 2001 From: timvisee Date: Wed, 25 Jan 2023 20:35:27 +0100 Subject: [PATCH 3/8] Remove and disable some Windows CI jobs --- .gitlab-ci.yml | 38 +++++++++++++------------------------- 1 file changed, 13 insertions(+), 25 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 181970d..4616182 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -43,17 +43,6 @@ before_script: - cargo check --no-default-features --features lobby --verbose check: <<: *check-base -check-windows: - stage: check - tags: - - windows - allow_failure: true - cache: {} - <<: *before_script-windows - script: - - cargo check --locked --verbose - - cargo check --locked --no-default-features --features rcon --verbose - - cargo check --locked --no-default-features --features rcon,lobby --verbose # Build using Rust stable on Linux build-x86_64-linux-gnu: @@ -185,20 +174,19 @@ test-cargo-x86_64-linux-gnu: - cargo test --locked --no-default-features --features rcon --verbose - cargo test --locked --no-default-features --features lobby --verbose -# Run the unit tests through Cargo on Windows -test-cargo-x86_64-windows: - stage: test - tags: - - windows - allow_failure: true - needs: [] - dependencies: [] - cache: {} - <<: *before_script-windows - script: - - cargo test --locked --verbose - - cargo test --locked --no-default-features --features rcon --verbose - - cargo test --locked --no-default-features --features rcon,lobby --verbose +# # Run the unit tests through Cargo on Windows +# test-cargo-x86_64-windows: +# stage: test +# tags: +# - windows +# allow_failure: true +# needs: [] +# dependencies: [] +# <<: *before_script-windows +# script: +# - cargo test --locked --verbose +# - cargo test --locked --no-default-features --features rcon --verbose +# - cargo test --locked --no-default-features --features rcon,lobby --verbose # Release binaries on GitLab as generic package release-gitlab-generic-package: From c6db4d7c3fd89a34baa96e9d935393d37d32b715 Mon Sep 17 00:00:00 2001 From: timvisee Date: Wed, 25 Jan 2023 20:44:11 +0100 Subject: [PATCH 4/8] Use Rust stable and MSRV in GitLab CI --- .gitlab-ci.yml | 10 +++++++++- README.md | 4 ++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4616182..0f0bc35 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -9,12 +9,16 @@ stages: # Variable defaults variables: + RUST_VERSION: stable TARGET: x86_64-unknown-linux-gnu # Install build dependencies before_script: - apt-get update - apt-get install -y --no-install-recommends build-essential + - | + rustup install $RUST_VERSION + rustup default $RUST_VERSION - | rustc --version cargo --version @@ -41,8 +45,12 @@ before_script: - cargo check --no-default-features --verbose - cargo check --no-default-features --features rcon --verbose - cargo check --no-default-features --features lobby --verbose -check: +check-stable: <<: *check-base +check-msrv: + <<: *check-base + variables: + RUST_VERSION: 1.60.0 # Build using Rust stable on Linux build-x86_64-linux-gnu: diff --git a/README.md b/README.md index 6e987e3..955fb2d 100644 --- a/README.md +++ b/README.md @@ -55,6 +55,10 @@ https://user-images.githubusercontent.com/856222/141378688-882082be-9efa-4cfe-81 - Minecraft Java Edition 1.6+ - On Windows: RCON (automatically managed) +Build requirements: + +- Rust 1.60 (MSRV) + _Note: You must have access to the system to run the `lazymc` binary. If you're using a Minecraft shared hosting provider with a custom dashboard, you likely won't be able to set this up._ From c415420eaef833496ae6770d7131ab0a012e2448 Mon Sep 17 00:00:00 2001 From: timvisee Date: Wed, 25 Jan 2023 20:45:21 +0100 Subject: [PATCH 5/8] Build Linux jobs CI jobs on custom runner by default --- .gitlab-ci.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0f0bc35..a0c8242 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -7,6 +7,11 @@ stages: - pre-release - release +default: + tags: + - linux + - timvisee-linux + # Variable defaults variables: RUST_VERSION: stable From f4870c66fa588000ca133107ed1488e4879c884c Mon Sep 17 00:00:00 2001 From: timvisee Date: Wed, 25 Jan 2023 20:45:45 +0100 Subject: [PATCH 6/8] Fix scoop installation on Windows in GitLab CI --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a0c8242..f076cb9 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -32,7 +32,7 @@ before_script: .before_script-windows: &before_script-windows before_script: # Install scoop - - Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh') + - iex "& {$(irm get.scoop.sh)} -RunAsAdmin" # Install Rust - scoop install rustup gcc From 226215479ce5aa7fa6898ef6477e5483a1aefe1a Mon Sep 17 00:00:00 2001 From: timvisee Date: Wed, 25 Jan 2023 20:45:55 +0100 Subject: [PATCH 7/8] Run many jobs on master branch only --- .gitlab-ci.yml | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f076cb9..336272e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -56,6 +56,8 @@ check-msrv: <<: *check-base variables: RUST_VERSION: 1.60.0 + only: + - master # Build using Rust stable on Linux build-x86_64-linux-gnu: @@ -74,6 +76,8 @@ build-x86_64-linux-gnu: # Build a static version build-x86_64-linux-musl: stage: build + only: + - master needs: [] variables: TARGET: x86_64-unknown-linux-musl @@ -95,6 +99,8 @@ build-x86_64-linux-musl: build-armv7-linux-gnu: stage: build image: ubuntu + only: + - master needs: [] variables: TARGET: armv7-unknown-linux-gnueabihf @@ -128,6 +134,8 @@ build-armv7-linux-gnu: build-aarch64-linux-gnu: stage: build image: ubuntu + only: + - master needs: [] variables: TARGET: aarch64-unknown-linux-gnu @@ -162,6 +170,8 @@ build-x86_64-windows: stage: build tags: - windows + only: + - master allow_failure: true needs: [] variables: @@ -179,6 +189,8 @@ build-x86_64-windows: # Run the unit tests through Cargo on Linux test-cargo-x86_64-linux-gnu: stage: test + only: + - master needs: [] dependencies: [] script: @@ -212,7 +224,8 @@ release-gitlab-generic-package: - build-aarch64-linux-gnu - build-x86_64-windows only: - - /^v(\d+\.)*\d+$/ + - master + - /^v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/ variables: LINUX_GNU_BIN: "lazymc-x86_64-unknown-linux-gnu" LINUX_MUSL_BIN: "lazymc-x86_64-unknown-linux-musl" @@ -242,7 +255,8 @@ release-gitlab-release: image: registry.gitlab.com/gitlab-org/release-cli stage: release only: - - /^v(\d+\.)*\d+$/ + - master + - /^v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/ variables: LINUX_GNU_BIN: "lazymc-x86_64-unknown-linux-gnu" LINUX_MUSL_BIN: "lazymc-x86_64-unknown-linux-musl" @@ -268,7 +282,8 @@ release-gitlab-release: release-github: stage: release only: - - /^v(\d+\.)*\d+$/ + - master + - /^v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/ dependencies: - build-x86_64-linux-gnu - build-x86_64-linux-musl From 5f13132c57b1ec3cf4d695c072c5eac81bd167af Mon Sep 17 00:00:00 2001 From: timvisee Date: Wed, 25 Jan 2023 20:47:43 +0100 Subject: [PATCH 8/8] Run release jobs in CI for release tag only --- .gitlab-ci.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 336272e..26a66e9 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -224,7 +224,6 @@ release-gitlab-generic-package: - build-aarch64-linux-gnu - build-x86_64-windows only: - - master - /^v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/ variables: LINUX_GNU_BIN: "lazymc-x86_64-unknown-linux-gnu" @@ -255,7 +254,6 @@ release-gitlab-release: image: registry.gitlab.com/gitlab-org/release-cli stage: release only: - - master - /^v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/ variables: LINUX_GNU_BIN: "lazymc-x86_64-unknown-linux-gnu" @@ -282,7 +280,6 @@ release-gitlab-release: release-github: stage: release only: - - master - /^v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/ dependencies: - build-x86_64-linux-gnu