Files
distant-horizons-sharded/.gitlab-ci.yml
T
2022-06-26 11:00:09 +00:00

203 lines
5.8 KiB
YAML

# use Eclipse's JDK
image: gradle:eclipse-temurin
# The ci should always use an unix/unix-like OS to work
# all stages need to be defined here
stages:
#Dont build the standalone yet cus it isnt done
# - build_standalone
- 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.
- rm -R Merged || true;
- ./gradlew build -PmcVer="1.16.5" --gradle-user-home cache/;
- ./gradlew merge --gradle-user-home cache/;
- ./gradlew test --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:
- rm -R Merged || true;
- ./gradlew build -PmcVer="1.17.1" --gradle-user-home cache/;
- ./gradlew merge --gradle-user-home cache/;
- ./gradlew test --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:
- rm -R Merged || true;
- ./gradlew build -PmcVer="1.18.1" --gradle-user-home cache/;
- ./gradlew merge --gradle-user-home cache/;
- ./gradlew test --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:
- rm -R Merged || true;
- ./gradlew build -PmcVer="1.18.2" --gradle-user-home cache/;
- ./gradlew merge --gradle-user-home cache/;
- ./gradlew test --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:
- rm -R Merged || true;
- ./gradlew build -PmcVer="1.19" --gradle-user-home cache/;
- ./gradlew merge --gradle-user-home cache/;
- ./gradlew test --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'