From ef7a61c45acb6efd4776cbd16308cec2dcdc6d6a Mon Sep 17 00:00:00 2001 From: xeruf <27jf@pm.me> Date: Wed, 2 Oct 2024 14:37:59 +0200 Subject: [PATCH] chore: rename task deploy to bundle --- .dev/scopes.txt | 2 +- .github/workflows/gradle.yml | 10 ++++----- .travis.yml | 42 ------------------------------------ CONTRIBUTING.md | 2 +- gradle/build.gradle.kts | 24 ++++++++++----------- player/build.gradle.kts | 17 ++++++++------- server/build.gradle.kts | 6 +++--- 7 files changed, 31 insertions(+), 72 deletions(-) delete mode 100644 .travis.yml diff --git a/.dev/scopes.txt b/.dev/scopes.txt index 471fcfa48..f507fb97a 100644 --- a/.dev/scopes.txt +++ b/.dev/scopes.txt @@ -5,7 +5,7 @@ contributing git gradle ci -deploy +bundle # Modules testclient diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index cb8eb4936..3b2c687e8 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -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 diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 56d366b5f..000000000 --- a/.travis.yml +++ /dev/null @@ -1,42 +0,0 @@ -dist: bionic -language: java -jdk: openjdk8 -git: - depth: 3 - submodules: false - -env: - - buildNSSC=false TERM=dumb - -before_cache: - - rm -f $HOME/.gradle/caches/modules-2/modules-2.lock - - rm -fr $HOME/.gradle/caches/*/plugin-resolution/ -cache: - directories: - - $HOME/.gradle/caches/ - - $HOME/.gradle/wrapper/ - -script: - - ./gradlew build || (exitcode=$?; find build/tests -name '*.log' -type f | while read f; do echo -e "\033[4m$f\033[0m"; cat $f; done && return $exitcode) - -before_deploy: - - ./gradlew deploy - - if $buildNSSC; then - cd .. && - git clone "https://socha-bot:$GH_TOKEN@github.com/software-challenge/not-so-simple-client.git" && - cd not-so-simple-client && - ./gradlew shadowJar && - cd "$TRAVIS_BUILD_DIR"; - fi - -deploy: - provider: releases - api_key: "$GH_TOKEN" - file_glob: true - file: - - build/deploy/*.jar - - build/deploy/*.zip - - ../not-so-simple-client/*.jar - skip_cleanup: true - on: - tags: true diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c45f9b3cd..ece95c58b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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 diff --git a/gradle/build.gradle.kts b/gradle/build.gradle.kts index e6eac1477..0b727354b 100644 --- a/gradle/build.gradle.kts +++ b/gradle/build.gradle.kts @@ -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") @@ -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 { @@ -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 { @@ -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") @@ -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() } @@ -190,12 +190,12 @@ 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 @@ -203,7 +203,7 @@ tasks { 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") diff --git a/player/build.gradle.kts b/player/build.gradle.kts index 5d0d808cc..4e5cdef8f 100644 --- a/player/build.gradle.kts +++ b/player/build.gradle.kts @@ -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") } @@ -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!") } } diff --git a/server/build.gradle.kts b/server/build.gradle.kts index beb3af2a4..800a16863 100644 --- a/server/build.gradle.kts +++ b/server/build.gradle.kts @@ -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 { @@ -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 {