# 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: - 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: before_script: - GRADLE_USER_HOME="$(pwd)/.gradle" - export GRADLE_USER_HOME retry: max: 2 when: - runner_system_failure - stuck_or_timeout_failure build: stage: build needs: [] dependencies: [] 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" ] script: # this both runs the unit tests and assembles the code - gradle build -PmcVer="${MC_VER}" -PinfoGitCommit="${CI_COMMIT_SHA}" -PinfoGitBranch="${CI_COMMIT_BRANCH}" -PinfoBuildSource="GitLab CI (${CI_PIPELINE_ID})" - 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 cache: key: gradle-${MC_VER} policy: pull-push paths: - .gradle/caches/ - .gradle/notifications/ - coreSubProjects/api/build - coreSubProjects/core/build - build allow_failure: true api: stage: api needs: [] dependencies: [] script: # this also runs unit tests - gradle api:build - gradle api:addSourcesToCompiledJar - 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 cache: key: gradle-api policy: pull-push paths: - .gradle/caches/ - .gradle/notifications/ - coreSubProjects/api/build - coreSubProjects/core/build - build allow_failure: true # generate and publish API javadocs pages: stage: pages needs: [] dependencies: [] script: # this also runs unit tests - gradle api:build - gradle api:javadoc - mkdir public - cp -r $CI_PROJECT_DIR/coreSubProjects/api/build/docs/javadoc/. public artifacts: paths: - public # allow_failure: false cache: key: gradle-pages policy: pull-push paths: - .gradle/caches/ - .gradle/notifications/ - coreSubProjects/api/build - coreSubProjects/core/build - build allow_failure: true