Migrate to new infrastructure
ci/woodpecker/manual/woodpecker Pipeline failed Details

This commit is contained in:
Johannes Frohnmeyer 2022-12-02 18:59:18 +01:00
parent ca2e166a9d
commit b672e8f929
Signed by: Johannes
GPG Key ID: E76429612C2929F4
10 changed files with 151 additions and 132 deletions

View File

@ -1,61 +0,0 @@
stages:
- compile_native
- build
- deploy
variables:
GRADLE_OPTS: "-Dorg.gradle.daemon=false -Dorg.gradle.jvmargs=-Xmx2G"
build_natives:
tags:
- windows
stage: compile_native
script:
- .\src\main\c\build.bat
artifacts:
paths:
- src/main/resources/native/natives.dll
only:
- master
build_test:
image: gradle:jdk17
stage: deploy
script:
- gradle --build-cache deployDebug -Pmaven="$CI_API_V4_URL/projects/$CI_PROJECT_ID/packages/maven"
- rm src/main/java/io/gitlab/jfronny/breakme/crash/KnownProviders.java
- mv build/libs/* ./
- mv build/devlibs/*-dev.jar ./
- rm *-maven.jar *-sources.jar *-testmod.jar
- mv *-dev.jar dev-free.zip
- mv *.jar latest.zip
- gradle --build-cache -Pflavor=curseforge build
- rm src/main/java/io/gitlab/jfronny/breakme/crash/KnownProviders.java
- cp build/libs/* ./
- cp build/devlibs/*-dev.jar ./
- rm *-maven.jar *-sources.jar *-testmod.jar
- mv *-dev.jar dev.zip
- mv *.jar latest-cf.jar
- mv latest.zip latest.jar
- mv dev-free.zip latest-dev.jar
- mv dev.zip latest-cf-dev.jar
artifacts:
paths:
- latest.jar
- latest-cf.jar
- latest-dev.jar
- latest-cf-dev.jar
only:
- master
deploy:
image: gradle:jdk17
rules:
- if: $CI_COMMIT_TAG && '$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME =~ /^master/'
stage: deploy
script:
- gradle --build-cache build publish modrinth modrinthSyncBody -Prelease -Pmaven="$CI_API_V4_URL/projects/$CI_PROJECT_ID/packages/maven"
- rm src/main/java/io/gitlab/jfronny/breakme/crash/KnownProviders.java
- rm build/libs/*
- rm build/devlibs/*
- gradle --build-cache -Pflavor=curseforge build curseforge -Prelease

49
.woodpecker.yml Normal file
View File

@ -0,0 +1,49 @@
#include https://pages.frohnmeyer-wds.de/scripts/clone.yml
pipeline:
build_test:
image: gradle:alpine
pull: true
commands:
- mkdir artifacts
- if [ $CI_PIPELINE_EVENT = tag ]; then
- gradle --build-cache -Pflavor=curseforge build curseforge -Prelease -Pmaven="https://maven.frohnmeyer-wds.de/artifacts"
- rm build/libs/*
- rm build/devlibs/*
- gradle --build-cache build publish modrinth modrinthSyncBody -Prelease -Pmaven="https://maven.frohnmeyer-wds.de/artifacts"
- else
- gradle --build-cache deployDebug -Pmaven="https://maven.frohnmeyer-wds.de/artifacts"
- fi
- mv build/libs/* artifacts/
- mv build/devlibs/*-dev.jar artifacts/
- cd artifacts
- rm *-maven.jar *-sources.jar *-testmod.jar
- mv *-dev.jar dev-free.zip
- mv *.jar latest.zip
- cd ..
- gradle --build-cache -Pflavor=curseforge build
- cp build/libs/* artifacts/
- cp build/devlibs/*-dev.jar artifacts/
- cd artifacts
- rm *-maven.jar *-sources.jar *-testmod.jar
- mv *-dev.jar dev.zip
- mv *.jar latest-cf.jar
- mv latest.zip latest.jar
- mv dev-free.zip latest-dev.jar
- mv dev.zip latest-cf-dev.jar
- cd ..
secrets: [ maven_token, maven_name, modrinth_api_token, curseforge_api_token ]
artifacts:
image: woodpeckerci/plugin-s3
settings:
bucket: pages
region: nebula
path_style: true
endpoint: https://s3.frohnmeyer-wds.de
access_key: pages
secret_key:
from_secret: pages_secret
source: artifacts/**/*
target: /${CI_REPO}
when:
- branch: ${CI_REPO_DEFAULT_BRANCH}

View File

@ -27,8 +27,7 @@ Please note that all methods marked "Unsafe" as well as the shutdown method are
<!-- modrinth_exclude.start -->
# Building
BreakMe consists of two parts: The main mod and the DLL used for Unsafe_Windows_WinAPI, which are built separately.\
If you don't build on windows you can use the dll contained in the latest [CI build](https://gitlab.com/jfmods/BreakMe/-/jobs/artifacts/master/browse/build/libs?job=build_test) and place it in src/main/resources/native.\
If you want to build the dll, use [this](https://gitlab.com/jfmods/BreakMe/-/blob/master/src/main/c/build.bat) as a reference (requires VS build tools).\
The mod itself is built like any other fabric mod: using gradle. Look at the [CI config](https://gitlab.com/jfmods/BreakMe/-/blob/master/.gitlab-ci.yml#L10) for an example\
A prebuilt DLL is included in the source tree and will be removed once it is replaced by a panama implementation.\
If you want to build it yourself, use src/main/c/build.bat to build it on a windows PC.\
The mod itself is built like any other fabric mod: using gradle
<!-- modrinth_exclude.end -->

View File

@ -1,48 +0,0 @@
import java.util.stream.Collectors
import java.nio.file.Files
import java.nio.file.Path
apply from: "https://jfmods.gitlab.io/scripts/gradle/v2.gradle"
ext.flavor = project.hasProperty('flavor') ? project.getProperty('flavor') : 'modrinth'
dependencies {
modImplementation("io.gitlab.jfronny.libjf:libjf-config-core-v1:$project.libjf_version")
// Dev env
modLocalRuntime("io.gitlab.jfronny.libjf:libjf-devutil:$project.libjf_version")
modLocalRuntime("io.gitlab.jfronny.libjf:libjf-config-ui-tiny-v1:$project.libjf_version")
modLocalRuntime("net.fabricmc.fabric-api:fabric-api:${project.fabric_version}")
modLocalRuntime("com.terraformersmc:modmenu:4.0.6")
}
def list(String dir) {
return Files.list(Path.of("$projectDir/$dir"))
.map(p -> p.fileName.toString())
.map(p -> p.substring(0, p.lastIndexOf('.')))
.filter(p -> p.endsWith("Provider"))
.toArray(String[]::new)
}
String[] paths = list("src/main/java/io/gitlab/jfronny/breakme/crash/safe")
if (flavor == "curseforge") {
sourceSets.main.java.filter.exclude("**/unsafe/*")
sourceSets.main.resources.exclude("**/native/*")
} else {
paths += list("src/main/java/io/gitlab/jfronny/breakme/crash/unsafe")
}
Files.writeString(Path.of("$projectDir/src/main/java/io/gitlab/jfronny/breakme/crash/KnownProviders.java"), """
package io.gitlab.jfronny.breakme.crash;
import io.gitlab.jfronny.breakme.crash.safe.*;
${if (flavor == "curseforge") "" else "import io.gitlab.jfronny.breakme.crash.unsafe.*;"}
import java.util.Map;
public class KnownProviders {
public static final Map<String, CrashProvider> PROVIDERS = Map.of(
${Arrays.stream(paths).map(path -> "\"${path.substring(0, path.length() - "Provider".length())}\", new $path()").collect(Collectors.joining(",\n "))}
);
}
""")

71
build.gradle.kts Normal file
View File

@ -0,0 +1,71 @@
import com.squareup.javapoet.ClassName
import com.squareup.javapoet.ParameterizedTypeName
import com.squareup.javapoet.TypeName
import java.nio.file.Files
import io.gitlab.jfronny.scripts.*
import java.util.LinkedList
import javax.lang.model.element.Modifier.*
plugins {
id("jfmod") version "1.2-SNAPSHOT"
id("jf.codegen") version "1.2-SNAPSHOT"
id("io.gitlab.jfronny.libjf.libjf-config-compiler-plugin")
}
val flavor by extra(prop("flavor", "modrinth"))
dependencies {
modImplementation("io.gitlab.jfronny.libjf:libjf-config-core-v1:${prop("libjf_version")}")
// Dev env
modLocalRuntime("io.gitlab.jfronny.libjf:libjf-devutil:${prop("libjf_version")}")
modLocalRuntime("io.gitlab.jfronny.libjf:libjf-config-ui-tiny-v1:${prop("libjf_version")}")
modLocalRuntime("net.fabricmc.fabric-api:fabric-api:${prop("fabric_version")}")
modLocalRuntime("com.terraformersmc:modmenu:4.1.1")
}
fun list(`package`: String) = Files.list(projectDir.resolve("src/main/java").resolve(`package`.replace('.', '/')).toPath()).use { stream ->
stream
.map { it.fileName.toString() }
.map { it.substring(0, it.lastIndexOf('.')) }
.filter { it.endsWith("Provider") }
.map { ClassName.get(`package`, it) }
.toList()
}
val classes = LinkedList(list("io.gitlab.jfronny.breakme.crash.safe"))
if (flavor == "curseforge") {
sourceSets.main.get().java.filter.exclude("**/unsafe/*")
sourceSets.main.get().resources.exclude("**/native/*")
} else {
classes.addAll(list("io.gitlab.jfronny.breakme.crash.unsafe"))
}
sourceSets {
main {
generate(project) {
`class`("io.gitlab.jfronny.breakme.crash", "KnownProviders") {
modifiers(PUBLIC)
val type = ParameterizedTypeName.get(ClassName.get(Map::class.java), TypeName.get(String::class.java), ClassName.get("io.gitlab.jfronny.breakme.crash", "CrashProvider"))
field(type, "PROVIDERS", PUBLIC, STATIC, FINAL) {
initializer {
add("Map.of(\$>")
if (!classes.isEmpty()) {
indent()
var first = false
for (klazz in classes) {
if (!first) first = true
else add(",")
val name = klazz.simpleName()
add("\n\$S, new \$T()", name.substring(0, name.length - "Provider".length), klazz)
}
add("\n")
}
add("\$<)")
}
}
}
}
}
}

View File

@ -1,16 +1,17 @@
# https://fabricmc.net/develop/
minecraft_version=1.19.2
yarn_mappings=build.8
loader_version=0.14.9
yarn_mappings=build.24
loader_version=0.14.11
maven_group=io.gitlab.jfronny
archives_base_name=breakme
fabric_version=0.60.0+1.19.2
libjf_version=3.0.3
modrinth_id=breakme
modrinth_required_dependencies=libjf
modrinth_optional_dependencies=modmenu
curseforge_id=400842
curseforge_required_dependencies=libjf
curseforge_optional_dependencies=modmenu
curseforge_optional_dependencies=modmenu
fabric_version=0.68.0+1.19.2
libjf_version=3.2.1

13
settings.gradle.kts Normal file
View File

@ -0,0 +1,13 @@
pluginManagement {
val libjf_version: String by settings
repositories {
maven("https://maven.fabricmc.net/") // FabricMC
maven("https://maven.frohnmeyer-wds.de/artifacts") // scripts
gradlePluginPortal()
}
plugins {
id("io.gitlab.jfronny.libjf.libjf-config-compiler-plugin") version libjf_version
}
}
rootProject.name = "breakme"

View File

@ -1,26 +1,22 @@
{
"schemaVersion": 1,
"id": "breakme",
"version": "${version}",
"name": "BreakMe",
"version": "${version}",
"description": "Crashes if you take damage",
"authors": [
"JFronny"
],
"authors": ["JFronny"],
"contact": {
"website": "jfronny.gitlab.io",
"repo": "https://gitlab.com/jfmods/BreakMe"
"email": "projects.contact@frohnmeyer-wds.de",
"homepage": "https://jfronny.gitlab.io",
"issues": "https://git.frohnmeyer-wds.de/JfMods/BreakMe/issues",
"sources": "https://git.frohnmeyer-wds.de/JfMods/BreakMe"
},
"license": "MIT",
"icon": "assets/breakme/icon.png",
"environment": "*",
"entrypoints": {
"main": [
"io.gitlab.jfronny.breakme.BreakMe"
],
"libjf:config": [
"io.gitlab.jfronny.breakme.BreakMeConfig"
]
"main": ["io.gitlab.jfronny.breakme.BreakMe"],
"libjf:config": ["io.gitlab.jfronny.breakme.BreakMeConfig"]
},
"mixins": [
"breakme.mixins.json"

View File

@ -1 +0,0 @@
natives.dll

Binary file not shown.