multiversion test
This commit is contained in:
+29
-2
@@ -6,12 +6,14 @@ image: eclipse-temurin:21
|
||||
# TODO: Make stages depend on what is in versionProperties
|
||||
stages:
|
||||
- build
|
||||
- multiversion
|
||||
- api
|
||||
- pages
|
||||
|
||||
variables:
|
||||
# Pull core when building
|
||||
GIT_SUBMODULE_STRATEGY: recursive
|
||||
MC_VERSIONS: ["1.16.5", "1.17.1", "1.18.2", "1.19.2", "1.19.4", "1.20.1", "1.20.2", "1.20.4", "1.20.6", "1.21.1", "1.21.3", "1.21.4", "1.21.5"]
|
||||
|
||||
|
||||
# These can be extended so code is a bit less duplicated
|
||||
@@ -35,13 +37,13 @@ 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", "1.20.2", "1.20.4", "1.20.6", "1.21.1", "1.21.3", "1.21.4", "1.21.5"]
|
||||
- MC_VER: $MC_VERSIONS
|
||||
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/;
|
||||
- ./gradlew mergeJars -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/merged/* . || true
|
||||
- cp ./build/forgix/* . || true
|
||||
artifacts:
|
||||
name: "NightlyBuild_${MC_VER}-${CI_COMMIT_SHORT_SHA}-${CI_COMMIT_TIMESTAMP}"
|
||||
paths:
|
||||
@@ -55,6 +57,31 @@ build:
|
||||
extends: .build_java
|
||||
|
||||
|
||||
multiversion:
|
||||
stage: multiversion
|
||||
needs: [build]
|
||||
script:
|
||||
# Download artifacts from all build jobs
|
||||
- mkdir -p jars
|
||||
- for VER in $MC_VERSIONS; do
|
||||
- echo "Downloading artifacts for MC version $VER"
|
||||
- curl --location --output "artifacts_${VER}.zip" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/jobs/artifacts/${CI_COMMIT_REF_NAME}/download?job=build&job_token=${CI_JOB_TOKEN}&job_variables[MC_VER]=${VER}"
|
||||
- unzip -j "artifacts_${VER}.zip" "*.jar" -d "jars/${VER}"
|
||||
- done
|
||||
# Create a semicolon-separated list of jar paths
|
||||
- MC_VER_PATHS=$(find jars -name "*.jar" -type f | tr '\n' ';')
|
||||
# Run the mergeVersions task
|
||||
- ./gradlew mergeVersions -PmergeVersions="${MC_VER_PATHS}" -PinfoGitCommit="${CI_COMMIT_SHA}" -PinfoGitBranch="${CI_COMMIT_BRANCH}" -PinfoBuildSource="GitLab CI (${CI_PIPELINE_ID})" --gradle-user-home cache/;
|
||||
- cp ./build/forgix/multiversion/* . || true
|
||||
artifacts:
|
||||
name: "NightlyBuild_Multiversion-${CI_COMMIT_SHORT_SHA}-${CI_COMMIT_TIMESTAMP}"
|
||||
paths:
|
||||
- ./*.jar
|
||||
expire_in: 30 days
|
||||
when: always
|
||||
extends: .build_java
|
||||
|
||||
|
||||
api:
|
||||
stage: api
|
||||
needs: []
|
||||
|
||||
+9
-1
@@ -13,7 +13,7 @@ plugins {
|
||||
id "com.github.johnrengelman.shadow" version '8.1.1' apply false
|
||||
|
||||
// Plugin to create merged jars
|
||||
id "io.github.pacifistmc.forgix" version "1.3.4"
|
||||
id "io.github.pacifistmc.forgix" version "2.0.0-SNAPSHOT.1"
|
||||
|
||||
// Manifold preprocessor
|
||||
id "systems.manifold.manifold-gradle-plugin" version "0.0.2-alpha"
|
||||
@@ -22,6 +22,14 @@ plugins {
|
||||
id "dev.architectury.loom" version "1.10-SNAPSHOT" apply false
|
||||
}
|
||||
|
||||
// Sets up Forgix for multiversion merging
|
||||
forgix {
|
||||
if (project.hasProperty('mergeVersions')) { // This is set using -PmergeVersions by the GitLab CI
|
||||
multiversion {
|
||||
inputJars = project.files(project.property('mergeVersions').toString().split(';'))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the list of preprocessors to use.
|
||||
|
||||
@@ -48,6 +48,7 @@ infoBuildSource=User
|
||||
|
||||
# Internal Properties (These are set at runtime for Forgix to merge jar's)
|
||||
versionStr=
|
||||
mergeVersions=
|
||||
|
||||
# This defines what MC version Intellij will use for the preprocessor
|
||||
# and what version is used automatically by build and run commands
|
||||
|
||||
+1
-1
@@ -58,7 +58,7 @@ If you still need help with compiling, please read the Readme.md
|
||||
|
||||
|
||||
|
||||
/** Loads the VersionProperties fiel for the currently selected Minecraft version. */
|
||||
/** Loads the VersionProperties field for the currently selected Minecraft version. */
|
||||
def loadProperties() {
|
||||
def defaultMcVersion = "1.20.1" // 1.20.1 is our current most stable version so we use that if no version was defined
|
||||
|
||||
|
||||
Reference in New Issue
Block a user