Files
distant-horizons-sharded/.gitlab-ci.yml
T
2023-07-17 23:40:07 +09:30

408 lines
11 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:
# TODO: Make stages depending on what is in versionProperties
- build_1_18_2
- build_1_19_2
- build_1_19_4
- build_1_20_1
- api
- pages
variables:
# Pull core when building
GIT_SUBMODULE_STRATEGY: recursive
# 1.18.2 build
build_1_18_2:
stage: build_1_18_2
script:
# this both runs the unit tests and assembles the code
- ./gradlew clean -PmcVer="1.18.2" --gradle-user-home cache/;
- ./gradlew build -PmcVer="1.18.2" --gradle-user-home cache/;
- ./gradlew mergeJars -PmcVer="1.18.2" --gradle-user-home cache/;
image: eclipse-temurin:17
artifacts:
name: "NightlyBuild_1_18_2-${CI_COMMIT_SHORT_SHA}-${CI_COMMIT_TIMESTAMP}"
paths:
- Merged/*.jar
- fabric/build/libs/*.jar
- forge/build/libs/*.jar
- quilt/build/libs/*.jar
exclude:
# TODO: There is a lot of duplicate stuff here, fix it later to be smaller
- fabric/build/libs/*-all.jar
- fabric/build/libs/*-sources.jar
- forge/build/libs/*-all.jar
- forge/build/libs/*-sources.jar
- quilt/build/libs/*-all.jar
- quilt/build/libs/*-sources.jar
expire_in: 1 day
when: always
cache:
key: "gradleCache"
policy: pull-push
paths:
- .gradle
- cache/
allow_failure: true
# 1.19.2 build
build_1_19_2:
stage: build_1_19_2
script:
# this both runs the unit tests and assembles the code
- ./gradlew clean -PmcVer="1.19.2" --gradle-user-home cache/;
- ./gradlew build -PmcVer="1.19.2" --gradle-user-home cache/;
- ./gradlew mergeJars -PmcVer="1.19.2" --gradle-user-home cache/;
image: eclipse-temurin:17
artifacts:
name: "NightlyBuild_1_19_2-${CI_COMMIT_SHORT_SHA}-${CI_COMMIT_TIMESTAMP}"
paths:
- Merged/*.jar
- fabric/build/libs/*.jar
- forge/build/libs/*.jar
- quilt/build/libs/*.jar
exclude:
# TODO: There is a lot of duplicate stuff here, fix it later to be smaller
- fabric/build/libs/*-all.jar
- fabric/build/libs/*-sources.jar
- forge/build/libs/*-all.jar
- forge/build/libs/*-sources.jar
- quilt/build/libs/*-all.jar
- quilt/build/libs/*-sources.jar
expire_in: 1 day
when: always
cache:
key: "gradleCache"
policy: pull-push
paths:
- .gradle
- cache/
allow_failure: true
# 1.19.4 build
build_1_19_4:
stage: build_1_19_4
script:
# this both runs the unit tests and assembles the code
- ./gradlew clean -PmcVer="1.19.4" --gradle-user-home cache/;
- ./gradlew build -PmcVer="1.19.4" --gradle-user-home cache/;
- ./gradlew mergeJars -PmcVer="1.19.4" --gradle-user-home cache/;
image: eclipse-temurin:17
artifacts:
name: "NightlyBuild_1_19_4-${CI_COMMIT_SHORT_SHA}-${CI_COMMIT_TIMESTAMP}"
paths:
- Merged/*.jar
- fabric/build/libs/*.jar
- forge/build/libs/*.jar
- quilt/build/libs/*.jar
exclude:
# TODO: There is a lot of duplicate stuff here, fix it later to be smaller
- fabric/build/libs/*-all.jar
- fabric/build/libs/*-sources.jar
- forge/build/libs/*-all.jar
- forge/build/libs/*-sources.jar
- quilt/build/libs/*-all.jar
- quilt/build/libs/*-sources.jar
expire_in: 1 day
when: always
cache:
key: "gradleCache"
policy: pull-push
paths:
- .gradle
- cache/
allow_failure: true
# 1.20.1 build
build_1_20_1:
stage: build_1_20_1
script:
# this both runs the unit tests and assembles the code
- ./gradlew clean -PmcVer="1.20.1" --gradle-user-home cache/;
- ./gradlew build -PmcVer="1.20.1" --gradle-user-home cache/;
- ./gradlew mergeJars -PmcVer="1.20.1" --gradle-user-home cache/;
image: eclipse-temurin:17
artifacts:
name: "NightlyBuild_1_20_1-${CI_COMMIT_SHORT_SHA}-${CI_COMMIT_TIMESTAMP}"
paths:
- Merged/*.jar
- fabric/build/libs/*.jar
- forge/build/libs/*.jar
- quilt/build/libs/*.jar
exclude:
# TODO: There is a lot of duplicate stuff here, fix it later to be smaller
- fabric/build/libs/*-all.jar
- fabric/build/libs/*-sources.jar
- forge/build/libs/*-all.jar
- forge/build/libs/*-sources.jar
- quilt/build/libs/*-all.jar
- quilt/build/libs/*-sources.jar
expire_in: 1 day
when: always
cache:
key: "gradleCache"
policy: pull-push
paths:
- .gradle
- cache/
allow_failure: true
api:
stage: api
script:
# this should only run for the API
- ./gradlew api:clean --gradle-user-home cache/;
# this also runs unit tests
- ./gradlew api:build --gradle-user-home cache/;
- ./gradlew api:addSourcesToCompiledJar --gradle-user-home cache/;
image: eclipse-temurin:17
artifacts:
name: "Api_NightlyBuild-${CI_COMMIT_SHORT_SHA}-${CI_COMMIT_TIMESTAMP}"
paths:
- coreSubProjects/api/build/libs/merged/*.jar
# can be uncommented if we don't want a jar with the source code
# - coreSubProjects/api/build/libs/*.jar
exclude:
- coreSubProjects/api/build/libs/merged/*-all.jar
- coreSubProjects/api/build/libs/merged/*-sources.jar
expire_in: 1 day
when: always
cache:
key: "gradleCache"
policy: pull-push
paths:
- .gradle
- cache/
allow_failure: true
# generate and publish API javadocs
pages:
stage: pages
script:
# this should only run for the API
- ./gradlew api:clean --gradle-user-home cache/;
# this also runs unit tests
- ./gradlew api:build --gradle-user-home cache/;
- ./gradlew api:javadoc --gradle-user-home cache/;
- mkdir public
- cp -r $CI_PROJECT_DIR/coreSubProjects/api/build/docs/javadoc/. public
image: eclipse-temurin:17
artifacts:
paths:
- public
cache:
key: "gradleCache"
policy: pull-push
paths:
- .gradle
- cache/
allow_failure: false
# ============================== Previos 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'