# use Eclipse's JDK # The ci should always use a unix(-like) OS to work image: eclipse-temurin:25 # all stages need to be defined here stages: - translations - build - api - pages variables: # Pull core when building GIT_SUBMODULE_STRATEGY: recursive # These can be extended so code is a bit less duplicated .build_java: #image: eclipse-temurin:17 cache: key: "gradleCache_$CI_JOB_NAME_SLUG" policy: pull-push paths: - .gradle - cache/ allow_failure: true retry: max: 2 when: - runner_system_failure - stuck_or_timeout_failure build: stage: build needs: - job: translations artifacts: true parallel: matrix: - MC_VER: [ "26.1.2", "1.21.11", "1.21.10", "1.21.9", "1.21.8", "1.21.6", "1.21.5", "1.21.4", "1.21.3", "1.21.1", "1.20.6", "1.20.4", "1.20.2", "1.20.1", "1.19.4", "1.19.2", "1.18.2", "1.17.1", "1.16.5", "1.12.2" ] before_script: # MC 1.12.2 needs both JDK 25 (for unimined) and JDK 8 (for MC 1.12) # hopefully downloading the JDK 8 like this will solve that problem? - apt-get update -q - apt-get install -y openjdk-8-jdk script: # this both runs the unit tests and assembles the code - ./gradlew clean -PmcVer="${MC_VER}" -PinfoGitCommit="${CI_COMMIT_SHA}" -PinfoGitBranch="${CI_COMMIT_BRANCH}" -PinfoBuildSource="GitLab CI (${CI_PIPELINE_ID})" --gradle-user-home cache/; - ./gradlew build -PmcVer="${MC_VER}" -PinfoGitCommit="${CI_COMMIT_SHA}" -PinfoGitBranch="${CI_COMMIT_BRANCH}" -PinfoBuildSource="GitLab CI (${CI_PIPELINE_ID})" --gradle-user-home cache/; - cp ./fabric/build/libs/* ./forge/build/libs/* ./neoforge/build/libs/* ./build/forgix/* . || true artifacts: name: "NightlyBuild_${MC_VER}-${CI_COMMIT_SHORT_SHA}-${CI_COMMIT_TIMESTAMP}" paths: - ./*.jar exclude: - ./*-all.jar - ./*-dev.jar - ./*-sources.jar expire_in: 14 days when: always extends: .build_java api: stage: api needs: [] 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/; - cp ./coreSubProjects/api/build/libs/merged/* . artifacts: name: "NightlyBuild_Api-${CI_COMMIT_SHORT_SHA}-${CI_COMMIT_TIMESTAMP}" paths: - ./*.jar exclude: - ./*-all.jar - ./*-dev.jar - ./*-sources.jar expire_in: 1 day when: always extends: .build_java # generate and publish API javadocs pages: stage: pages needs: [] 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 artifacts: paths: - public allow_failure: false extends: .build_java translations: stage: translations needs: [] image: crowdin/cli:latest script: - if [ "$CI_COMMIT_BEFORE_SHA" = "0000000000000000000000000000000000000000" ] || git diff --name-only "$CI_COMMIT_BEFORE_SHA" "$CI_COMMIT_SHA" -- coreSubProjects/core/src/main/resources/assets/distanthorizons/lang | grep -q .; then crowdin upload sources; fi - crowdin download --export-only-approved --skip-untranslated-files - for f in coreSubProjects/core/src/main/resources/assets/distanthorizons/lang/*.json; do [ -e "$f" ] || continue; sed -i 's/\\\\n/\\n/g' "$f"; n="$(basename "$f" | tr '[:upper:]' '[:lower:]')"; [ "$(basename "$f")" = "$n" ] || mv "$f" "$(dirname "$f")/$n"; done artifacts: paths: - coreSubProjects/core/src/main/resources/assets/distanthorizons/lang/** expire_in: 1 day when: always