From 15beb792d179882ae1351ed67e9860f6da2e7ea0 Mon Sep 17 00:00:00 2001 From: Null 511 Date: Tue, 8 Aug 2023 22:09:51 +0000 Subject: [PATCH] CICD Improvements --- .gitlab-ci.yml | 270 +++---------------------------------------------- 1 file changed, 14 insertions(+), 256 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 516e22677..41c60758c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,17 +1,11 @@ # use Eclipse's JDK -image: gradle:eclipse-temurin # The ci should always use a unix(-like) OS to work - +image: eclipse-temurin:17 # all stages need to be defined here +# TODO: Make stages depend on what is in versionProperties stages: - # TODO: Make stages depend on what is in versionProperties - - build_1_16_5 - - build_1_17_1 - - build_1_18_2 - - build_1_19_2 - - build_1_19_4 - - build_1_20_1 + - build - api - pages @@ -22,7 +16,7 @@ variables: # These can be extended so code is a bit less duplicated .build_java: - image: eclipse-temurin:17 + #image: eclipse-temurin:17 cache: key: "gradleCache" policy: pull-push @@ -30,7 +24,13 @@ variables: - .gradle - cache/ allow_failure: true -.build_mc: + + +build: + stage: build + parallel: + matrix: + - MC_VER: ["1.16.5", "1.17.1", "1.18.2", "1.19.2", "1.19.4", "1.20.1"] script: # this both runs the unit tests and assembles the code - ./gradlew clean -PmcVer="${MC_VER}" --gradle-user-home cache/; @@ -51,59 +51,14 @@ variables: - forge/build/libs/*-sources.jar - quilt/build/libs/*-all.jar - quilt/build/libs/*-sources.jar - expire_in: 1 day + expire_in: 14 days when: always extends: .build_java -# 1.16.5 build -build_1_16_5: - stage: build_1_16_5 - variables: - MC_VER: "1.16.5" - extends: .build_mc - -# 1.17.1 build -build_1_17_1: - stage: build_1_17_1 - variables: - MC_VER: "1.17.1" - extends: .build_mc - -# 1.18.2 build -build_1_18_2: - stage: build_1_18_2 - variables: - MC_VER: "1.18.2" - extends: .build_mc - -# 1.19.2 build -build_1_19_2: - stage: build_1_19_2 - variables: - MC_VER: "1.19.2" - extends: .build_mc - -# 1.19.2 build -build_1_19_4: - stage: build_1_19_4 - variables: - MC_VER: "1.19.4" - extends: .build_mc - -# 1.20.1 build -build_1_20_1: - stage: build_1_20_1 - variables: - MC_VER: "1.20.1" - extends: .build_mc - - - - - api: stage: api + needs: [] script: # this should only run for the API - ./gradlew api:clean --gradle-user-home cache/; @@ -127,6 +82,7 @@ api: # generate and publish API javadocs pages: stage: pages + needs: [] script: # this should only run for the API - ./gradlew api:clean --gradle-user-home cache/; @@ -140,201 +96,3 @@ pages: - public allow_failure: false extends: .build_java - - - - - - -# ============================== Previous CI for future reference ============================== # -## all stages need to be defined here -# # Don't build the standalone jar yet because it isn't done yet -# # - build_standalone -#stages: -# - build_19 -# - build_18_2 -# - build_18_1 -# - build_17_1 -# - build_16_5 -# -#variables: -# # Pull core when building -# GIT_SUBMODULE_STRATEGY: recursive -# -# -#before_script: -# - echo $CI_JOB_ID -# # Writing GE_JOB_ID variable to environment file, will need the value in the next stage. -# - echo GE_JOB_ID=$CI_JOB_ID >> generate_jars.env -# -# -## The standalone build -##build_standalone: -## stage: build_standalone -## script: -## # make sure any previously merged jars are removed before running this job. -## # note: if the merged folder doesn't exist "rm -R Merged" will throw an error, which can be ignored -## # the "|| true" makes that step always succeed. -## - ./gradlew core:build --gradle-user-home cache/; -## -## # Copy the file with the shortest name to the root DistantHorizons.jar so it can be sent off -## - cp $(find core/build/libs/ | awk 'function base(f){sub(".*/", "", f); return f;} {print length(base($0)), $0}'| sort -n | head -2 | grep -P "[0-9][0-9] core/build/libs/*" | #sed -r "s/([0-9][0-9] )//g") DistantHorizons.jar -## # build using Java 16 -## image: eclipse-temurin:16 -## artifacts: -## name: "NightlyBuild_standalone-${CI_COMMIT_SHORT_SHA}-${CI_COMMIT_TIMESTAMP}" -## paths: -## # Get the standalone jar -## - DistantHorizons.jar -## expire_in: 1 day -## # even if one build fails, upload the successful jars -## when: always -## cache: -## key: "gradleCache" -## policy: pull-push -## paths: -## - .gradle -## - cache/ -## allow_failure: true -# -# -## 1.16.5 build -#build_16_5: -# stage: build_16_5 -# script: -# # make sure any previously merged jars are removed before running this job. -# # note: if the merged folder doesn't exist "rm -R Merged" will throw an error, which can be ignored -# # the "|| true" makes that step always succeed. -# - ./gradlew test --gradle-user-home cache/; -# - ./gradlew build -PmcVer="1.16.5" --gradle-user-home cache/; -# # build using Java 16 -# image: eclipse-temurin:16 -# artifacts: -# name: "Merged_NightlyBuild_1_16_5-${CI_COMMIT_SHORT_SHA}-${CI_COMMIT_TIMESTAMP}" -# paths: -# # relative to the root directory -# - Merged -# expire_in: 1 day -# # even if one build fails, upload the successful jars -# when: always -# cache: -# key: "gradleCache" -# policy: pull-push -# paths: -# - .gradle -# - cache/ -# allow_failure: true -# -## 1.17.1 build -#build_17_1: -# stage: build_17_1 -# script: -# - ./gradlew test --gradle-user-home cache/; -# - ./gradlew build -PmcVer="1.17.1" --gradle-user-home cache/; -# image: eclipse-temurin:16 -# artifacts: -# name: "Merged_NightlyBuild_1_17_1-${CI_COMMIT_SHORT_SHA}-${CI_COMMIT_TIMESTAMP}" -# paths: -# - Merged -# expire_in: 1 day -# when: always -# cache: -# key: "gradleCache" -# policy: pull-push -# paths: -# - .gradle -# - cache/ -# allow_failure: true -# -## 1.18.1 build -#build_18_1: -# stage: build_18_1 -# script: -# - ./gradlew test --gradle-user-home cache/; -# - ./gradlew build -PmcVer="1.18.1" --gradle-user-home cache/; -# # build using Java 17 -# image: eclipse-temurin:17 -# artifacts: -# name: "Merged_NightlyBuild_1_18_1-${CI_COMMIT_SHORT_SHA}-${CI_COMMIT_TIMESTAMP}" -# paths: -# - Merged -# expire_in: 1 day -# when: always -# cache: -# key: "gradleCache" -# policy: pull-push -# paths: -# - .gradle -# - cache/ -# allow_failure: true -# -## 1.18.2 build -#build_18_2: -# stage: build_18_2 -# script: -# - ./gradlew test --gradle-user-home cache/; -# - ./gradlew build -PmcVer="1.18.2" --gradle-user-home cache/; -# image: eclipse-temurin:17 -# artifacts: -# name: "Merged_NightlyBuild_1_18_2-${CI_COMMIT_SHORT_SHA}-${CI_COMMIT_TIMESTAMP}" -# paths: -# - Merged -# expire_in: 1 day -# when: always -# cache: -# key: "gradleCache" -# policy: pull-push -# paths: -# - .gradle -# - cache/ -# allow_failure: true -# -## 1.19 build -#build_19: -# stage: build_19 -# script: -# - ./gradlew test --gradle-user-home cache/; -# - ./gradlew build -PmcVer="1.19" --gradle-user-home cache/; -# image: eclipse-temurin:17 -# artifacts: -# name: "Merged_NightlyBuild_1_19-${CI_COMMIT_SHORT_SHA}-${CI_COMMIT_TIMESTAMP}" -# paths: -# - Merged -# expire_in: 1 day -# when: always -# cache: -# key: "gradleCache" -# policy: pull-push -# paths: -# - .gradle -# - cache/ -# allow_failure: true - - - - - -# unused deployment stage -#deploy: -# stage: deploy -# image: registry.gitlab.com/gitlab-org/release-cli:latest -# script: -# - echo 'running release_job' -# - echo 'Previous Job ID is printed below' -# - echo $GE_JOB_ID -# # Specifying that this job requires artifacts from the previous job to succeed -# needs: -# - job: build -# artifacts: true -# release: -# name: 'Unstable Jars for Latest Commit' #: $CI_COMMIT_SHORT_SHA' -# description: 'Created automatically using the release-cli.' -# # tag_name is a mendatory field and can not be an empty string -# tag_name: 'Unstable-$CI_COMMIT_SHORT_SHA' -# assets: -# links: -# - name: 'Fabric Jars' -# url: 'https://gitlab.com/jeseibel/minecraft-lod-mod/cw/-/jobs/${GE_JOB_ID}/artifacts/file/fabric/build/libs' -# - name: 'Forge Jars' -# url: 'https://gitlab.com/jeseibel/minecraft-lod-mod/cw/-/jobs/${GE_JOB_ID}/artifacts/file/forge/build/libs' -