minosoft ci: cache integration test assets

This commit is contained in:
Moritz Zwerger 2023-11-22 13:31:26 +01:00
parent 901de32766
commit 00e239527f
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4
5 changed files with 25 additions and 8 deletions

View File

@ -40,6 +40,12 @@ jobs:
path: ~/.gradle/wrapper
key: ${{ matrix.os }}-gradle-wrapper-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}
- name: Setup Gradle Wrapper Cache
uses: actions/cache@v3
with:
path: ./it
key: minosoft-assets
- name: Build
uses: gradle/gradle-build-action@v2
with:

2
.gitignore vendored
View File

@ -9,3 +9,5 @@ hs_err_pid*.log
# Ignore Gradle build output directory
build
it/

View File

@ -29,6 +29,10 @@ cache:
- "gradle/wrapper/gradle-wrapper.properties"
paths:
- .gradle_home/wrapper
- key:
"minosoft-assets"
paths:
- ./it
build:
stage: build

View File

@ -38,7 +38,7 @@ internal object MinosoftSIT {
Log.ASYNC_LOGGING = false
RunConfiguration.VERBOSE_LOGGING = true
RunConfiguration.APPLICATION_NAME = "Minosoft it"
RunConfiguration::HOME_DIRECTORY.forceSet(Path.of(System.getProperty("java.io.tmpdir"), "minosoft"))
RunConfiguration::HOME_DIRECTORY.forceSet(Path.of("./it"))
RunConfiguration::CONFIG_DIRECTORY.forceSet(Path.of(System.getProperty("java.io.tmpdir"), "minosoft").resolve("conf"))
RunConfiguration.PROFILES_HOT_RELOADING = false
}

View File

@ -179,16 +179,20 @@ abstract class StorageProfileManager<P : Profile> : Iterable<P>, Identified {
profile.lock.lock()
storage.updating = true
unsafeUpdate(profile, data)
storage.updating = false
// storage.invalid = false
profile.lock.unlock()
}
fun unsafeUpdate(profile: P, data: ObjectNode) {
val injectable = InjectableValues.Std()
injectable.addValue(type.clazz, profile)
reader
.withValueToUpdate(profile)
.with(injectable)
.readValue<P>(data)
storage.updating = false
// storage.invalid = false
profile.lock.unlock()
}
fun create(name: String): P {
@ -212,16 +216,17 @@ abstract class StorageProfileManager<P : Profile> : Iterable<P>, Identified {
Log.log(LogMessageType.PROFILES, LogLevels.VERBOSE) { "Saving profile to $path" }
profile.lock.acquire()
storage.invalid = false // do it before actually saving it. If the data changes while writing it gets saved another time
storage.saved++
val node = Jackson.MAPPER.valueToTree<ObjectNode>(profile) // TODO: cache jacksonType
node.put(VERSION, latestVersion)
val string = Jackson.MAPPER.writerWithDefaultPrettyPrinter().writeValueAsString(node)
val stream = FileOutputStream(path)
stream.write(string.encodeNetwork())
stream.close()
storage.invalid = false
profile.lock.release()
}
@ -250,7 +255,7 @@ abstract class StorageProfileManager<P : Profile> : Iterable<P>, Identified {
}
fun init() {
reader
reader // init lazy value
}
companion object {