Skip to content

Commit

Permalink
chore: rename task deploy to bundle
Browse files Browse the repository at this point in the history
  • Loading branch information
xeruf committed Oct 2, 2024
1 parent 9c68e8f commit ef7a61c
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 72 deletions.
2 changes: 1 addition & 1 deletion .dev/scopes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ contributing
git
gradle
ci
deploy
bundle

# Modules
testclient
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ jobs:
run: chmod +x gradlew
- name: Execute tests
run: ./gradlew check || (exitcode=$?; find build/tests -name '*.log' -type f | while read f; do echo -e "\033[4m$f\033[0m"; cat $f; done && return $exitcode)
- name: Build deployment artifacts
run: ./gradlew deploy
- name: Upload jars as artifact
- name: Bundle Artifacts
run: ./gradlew bundle
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: software-challenge-backend-${{ github.sha }}
path: |
build/deploy/*.zip
build/deploy/*.jar
build/bundle/*.zip
build/bundle/*.jar
release:
needs: build
runs-on: ubuntu-latest
Expand Down
42 changes: 0 additions & 42 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Die wichtigsten Tasks:
| Task | Beschreibung
| ---- | ------------
| `build` | Kompiliert, packt und testet alles
| `deploy` | Erstellt hochladbare ZIP-Pakete
| `bundle` | Erstellt hochladbare ZIP-Pakete
| `check` | Führt alle Tests aus
| `test` | Führt Unittests aus
| `integrationTest` | Testet ein komplettes Spiel sowie den TestClient
Expand Down
24 changes: 12 additions & 12 deletions gradle/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ version = versionObject.toString() + property("socha.version.suffix").toString()
val year by extra { "20${versionObject.major}" }
val game by extra { "${gameName}_$year" }

val deployDir by extra { buildDir.resolve("deploy") }
val deployedPlayer by extra { "randomplayer-$gameName-$version.jar" }
val bundleDir by extra { buildDir.resolve("bundle") }
val bundledPlayer by extra { "randomplayer-$gameName-$version.jar" }
val testingDir by extra { buildDir.resolve("tests") }
val documentedProjects = listOf("sdk", "plugin$year")

Expand All @@ -48,7 +48,7 @@ tasks {
val doc by creating(DokkaTask::class) {
dependsOn(documentedProjects.map { ":$it:classes" })
group = "documentation"
outputDirectory = deployDir.resolve("doc").toString()
outputDirectory = bundleDir.resolve("doc").toString()
outputFormat = "javadoc"
subProjects = documentedProjects
configuration {
Expand All @@ -58,12 +58,12 @@ tasks {
}
}

val deploy by creating {
val bundle by creating {
dependsOn(doc)
dependOnSubprojects()
group = "distribution"
description = "Zips everything up for release into ${deployDir.relativeTo(projectDir)}"
outputs.dir(deployDir)
description = "Zips everything up for release into ${bundleDir.relativeTo(projectDir)}"
outputs.dir(bundleDir)
}

val release by creating {
Expand Down Expand Up @@ -111,14 +111,14 @@ tasks {
dependOnSubprojects()
}
build {
dependsOn(deploy)
dependsOn(bundle)
}

// TODO create a global constant which can be shared with testclient & co - maybe a resource?
val maxGameLength = 150L // 2m30s

val testGame by creating {
dependsOn(":server:deploy", ":player:deployShadow")
dependsOn(":server:bundle", ":player:bundleShadow")
group = "verification"
doFirst {
val testGameDir = testingDir.resolve("game")
Expand All @@ -145,7 +145,7 @@ tasks {
val startClient: (Int) -> Process = {
Thread.sleep(300)
ProcessBuilder(
java, "-jar", deployDir.resolve(deployedPlayer).absolutePath,
java, "-jar", bundleDir.resolve(bundledPlayer).absolutePath,
"--port", port
).redirectOutput(testGameDir.resolve("client$it.log")).redirectError(testGameDir.resolve("client$it-err.log")).start()
}
Expand Down Expand Up @@ -190,20 +190,20 @@ tasks {
server.destroy()
}
thread.interrupt()
println("Successfully played a game using the deployed server & client!")
println("Successfully played a game using the bundled server & client!")
}
}

val testTestClient by creating {
dependsOn(":server:deploy")
dependsOn(":server:bundle")
group = "verification"
shouldRunAfter(testGame)
val testClientGames = 3
doFirst {
testingDir.mkdirs()
val serverDir = testingDir.resolve("testclient")
serverDir.deleteRecursively()
unzipTo(serverDir, deployDir.resolve("software-challenge-server.zip"))
unzipTo(serverDir, bundleDir.resolve("software-challenge-server.zip"))

val command = (project(":test-client").getTasksByName("createStartScripts", false).single() as ScriptsTask).content.split(' ') +
arrayOf("--start-server", "--tests", testClientGames.toString(), "--port", "13055")
Expand Down
17 changes: 9 additions & 8 deletions player/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -78,19 +78,19 @@ tasks {
args = System.getProperty("args", "").split(" ")
}

val deployDir: File by project
val deployedPlayer: String by project
val deployShadow by creating(Copy::class) {
val bundleDir: File by project
val bundledPlayer: String by project
val bundleShadow by creating(Copy::class) {
group = "distribution"
from(shadowJar)
into(deployDir)
rename { deployedPlayer }
into(bundleDir)
rename { bundledPlayer }
}
val deploy by creating(Zip::class) {
val bundle by creating(Zip::class) {
group = "distribution"
dependsOn(deployShadow)
dependsOn(bundleShadow)
from(prepareZip, copyDocs)
destinationDirectory.set(deployDir)
destinationDirectory.set(bundleDir)
archiveFileName.set("player-$gameName-src.zip")
}

Expand Down Expand Up @@ -118,6 +118,7 @@ tasks {
commandLine("java", "-jar", execDir.resolve("${game}_client.jar"), "--verify")
standardOutput = org.apache.commons.io.output.NullOutputStream.NULL_OUTPUT_STREAM
}
println("Successfully built the shipped player package!")
}
}

Expand Down
6 changes: 3 additions & 3 deletions server/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ dependencies {
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine") // legacy java tests
}

val deployDir: File by project
val bundleDir: File by project
val isBeta: Boolean by project

tasks {
Expand Down Expand Up @@ -51,10 +51,10 @@ tasks {
into(runnableDir.resolve("lib"))
}

val deploy by creating(Zip::class) {
val bundle by creating(Zip::class) {
group = "distribution"
dependsOn(":test-client:jar", ":player:shadowJar", makeRunnable)
destinationDirectory.set(deployDir)
destinationDirectory.set(bundleDir)
archiveBaseName.set("software-challenge-server")
from(runnableDir)
doFirst {
Expand Down

0 comments on commit ef7a61c

Please sign in to comment.