From e884315887e9a720eb594d36af4279b9050fe9f9 Mon Sep 17 00:00:00 2001 From: tj-wazei <158822022+tj-wazei@users.noreply.github.com> Date: Sun, 19 May 2024 12:40:09 +0100 Subject: [PATCH] Revert "Improve GHA and usual repository boilerplate (#12)" This reverts commit 3f4bd23f41fc43105101faa9a49b5e862261c0e8. --- .gitattributes | 1 - .github/dependabot.yml | 6 ----- .github/pull_request_template.md | 26 ------------------- .github/workflows/docker-publish.yaml | 33 ++++++++++++++---------- .github/workflows/docker-verify.yaml | 24 ++++++++--------- .github/workflows/releases.yaml | 21 ++++++++------- Insomnia_2023-01-09.json | 1 + JShellAPI/build.gradle | 8 +++++- JShellWrapper/build.gradle | 1 + gradle/wrapper/gradle-wrapper.properties | 2 +- gradlew | 14 +++++----- 11 files changed, 59 insertions(+), 78 deletions(-) delete mode 100644 .gitattributes delete mode 100644 .github/dependabot.yml delete mode 100644 .github/pull_request_template.md create mode 100644 Insomnia_2023-01-09.json diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 07764a7..0000000 --- a/.gitattributes +++ /dev/null @@ -1 +0,0 @@ -* text eol=lf \ No newline at end of file diff --git a/.github/dependabot.yml b/.github/dependabot.yml deleted file mode 100644 index 8030eef..0000000 --- a/.github/dependabot.yml +++ /dev/null @@ -1,6 +0,0 @@ -version: 2 -updates: - - package-ecosystem: "gradle" - directory: "/" - schedule: - interval: "weekly" \ No newline at end of file diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md deleted file mode 100644 index a6cb564..0000000 --- a/.github/pull_request_template.md +++ /dev/null @@ -1,26 +0,0 @@ -[contributing]: https://github.com/Together-Java/TJ-Bot/wiki/Contributing -[code_guidelines]: https://github.com/Together-Java/TJ-Bot/wiki/Code-Guidelines -[new_issue]: https://github.com/Together-Java/TJ-Bot/issues/new/choose - -## Pull-request - -- [ ] I have read the [contributing guidelines][contributing]. -- [ ] I have read the [code guidelines][code_guidelines]. -- [ ] I have created a relating [issue][new_issue]. - -### Changes - -- [ ] Existing code -- [ ] New feature - - - -Closes Issue: NaN - -## Description - -Replace this sentence with general description of what your Pull Request does. \ No newline at end of file diff --git a/.github/workflows/docker-publish.yaml b/.github/workflows/docker-publish.yaml index 0e69f53..c289c8e 100644 --- a/.github/workflows/docker-publish.yaml +++ b/.github/workflows/docker-publish.yaml @@ -2,28 +2,33 @@ name: Docker Publish on: push: - branches: [ master ] - workflow_dispatch: + branches: + - 'master' + - 'feature/cicd-workflows' + +env: + JAVA_VERSION: 19 jobs: docker: runs-on: ubuntu-latest steps: - - name: Check out code - uses: actions/checkout@v4 - - - name: Install Java - uses: actions/setup-java@v3 + - name: Set up JDK + uses: actions/setup-java@v1 with: - java-version: '21' - distribution: 'corretto' - - - name: Build Docker image and publish + java-version: ${{ env.JAVA_VERSION }} + - name: Extract branch name + shell: bash + run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" + id: extract_branch + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Build and Publish Docker Image env: ORG_REGISTRY_USER: ${{ secrets.ORG_REGISTRY_USER }} ORG_REGISTRY_PASSWORD: ${{ secrets.ORG_REGISTRY_PASSWORD }} - BRANCH_NAME: ${{ github.ref_name }} + BRANCH_NAME: ${{ steps.extract_branch.outputs.branch }} run: ./gradlew jib - - - name: Trigger deployment + - name: Re-Deploy run: "curl -H 'Authorization: Bearer ${{ secrets.ORG_WATCHTOWER_TOKEN }}' https://togetherjava.org:5003/v1/update" diff --git a/.github/workflows/docker-verify.yaml b/.github/workflows/docker-verify.yaml index 3af1081..1c96145 100644 --- a/.github/workflows/docker-verify.yaml +++ b/.github/workflows/docker-verify.yaml @@ -1,21 +1,21 @@ name: Docker Verify -on: - pull_request: - workflow_dispatch: + +on: [pull_request] + +env: + JAVA_VERSION: 19 jobs: docker: name: Docker Verify runs-on: ubuntu-latest steps: - - name: Check out code - uses: actions/checkout@v4 - - - name: Install Java - uses: actions/setup-java@v3 + - name: Set up JDK + uses: actions/setup-java@v1 with: - java-version: 21 - distribution: 'corretto' - - - name: Build Docker image + java-version: ${{ env.JAVA_VERSION }} + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Docker Verify run: ./gradlew jibDockerBuild diff --git a/.github/workflows/releases.yaml b/.github/workflows/releases.yaml index 1c8af2f..933abb1 100644 --- a/.github/workflows/releases.yaml +++ b/.github/workflows/releases.yaml @@ -9,27 +9,28 @@ defaults: run: shell: bash +env: + JAVA_VERSION: 19 + jobs: release: name: Build and release runs-on: ubuntu-latest steps: - - name: Check out code - uses: actions/checkout@v4 - - - name: Install Java - uses: actions/setup-java@v3 + - name: Set up JDK + uses: actions/setup-java@v1 with: - java-version: 21 - distribution: 'corretto' + java-version: ${{ env.JAVA_VERSION }} + + - uses: actions/checkout@v2 - - name: Generate FAT Jar + - name: Build shadow jar run: ./gradlew shadowJar - name: Create release - uses: softprops/action-gh-release@v2 + uses: softprops/action-gh-release@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - files: app/build/libs/TJ-JShell-Backend.jar + files: app/build/libs/TJ-Plays.jar diff --git a/Insomnia_2023-01-09.json b/Insomnia_2023-01-09.json new file mode 100644 index 0000000..6f18508 --- /dev/null +++ b/Insomnia_2023-01-09.json @@ -0,0 +1 @@ +{"_type":"export","__export_format":4,"__export_date":"2023-01-09T22:20:32.207Z","__export_source":"insomnia.desktop.app:v2022.6.0","resources":[{"_id":"req_72d292af436943f3acc7811cd6cda651","parentId":"wrk_9201930bce444ac8a852dd54cbf5cafc","modified":1673302718265,"created":1673298082010,"url":"{{ _.baseUrl }}jshell/eval/864","name":"Eval","description":"","method":"POST","body":{"mimeType":"","text":"for(int i = 5; i < 10; i++) {\n\tSystem.out.println(i);\n}"},"parameters":[],"headers":[],"authentication":{},"metaSortKey":-1673298082010,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"wrk_9201930bce444ac8a852dd54cbf5cafc","parentId":null,"modified":1673298071281,"created":1673298071281,"name":"JShellPlaygroundBackend.yaml","description":"","scope":"design","_type":"workspace"},{"_id":"req_5800c720bc6d42279f10920f0f810d0b","parentId":"wrk_9201930bce444ac8a852dd54cbf5cafc","modified":1673300342786,"created":1673300127045,"url":"{{ _.baseUrl }}jshell/eval","name":"Eval no id","description":"","method":"POST","body":{"mimeType":"","text":"for(int i = 5; i < 10; i++) {\n\tSystem.out.println(i);\n}"},"parameters":[],"headers":[],"authentication":{},"metaSortKey":-1671284625665.5,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_7a9147556dca485581f6a49be54cc47e","parentId":"wrk_9201930bce444ac8a852dd54cbf5cafc","modified":1673300143893,"created":1673300097575,"url":"{{ _.baseUrl }}jshell/snippets/864","name":"Snippets","description":"","method":"GET","body":{},"parameters":[],"headers":[],"authentication":{},"metaSortKey":-1669271169321,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_a3af52aad2ef48a7b48136bea956803d","parentId":"wrk_9201930bce444ac8a852dd54cbf5cafc","modified":1673300226219,"created":1673300163253,"url":"{{ _.baseUrl }}jshell/864","name":"Delete","description":"","method":"DELETE","body":{},"parameters":[],"headers":[],"authentication":{},"metaSortKey":-1667257712976.5,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"env_3aab86b18a10af8cac406990d3f05953859c65da","parentId":"wrk_9201930bce444ac8a852dd54cbf5cafc","modified":1673298222338,"created":1673298071287,"name":"Base Environment","data":{},"dataPropertyOrder":{},"color":null,"isPrivate":false,"metaSortKey":1673298071287,"_type":"environment"},{"_id":"jar_3aab86b18a10af8cac406990d3f05953859c65da","parentId":"wrk_9201930bce444ac8a852dd54cbf5cafc","modified":1673298071288,"created":1673298071288,"name":"Default Jar","cookies":[],"_type":"cookie_jar"},{"_id":"spc_2730c97ce76e44e99faa9ab3320038d5","parentId":"wrk_9201930bce444ac8a852dd54cbf5cafc","modified":1673298071283,"created":1673298071283,"fileName":"JShellPlaygroundBackend.yaml","contents":"","contentType":"yaml","_type":"api_spec"},{"_id":"env_0533b109f389443daa97bb05c73e7502","parentId":"env_3aab86b18a10af8cac406990d3f05953859c65da","modified":1673298277963,"created":1673298227299,"name":"Localhost","data":{"baseUrl":"http://localhost:8080/"},"dataPropertyOrder":{"&":["baseUrl"]},"color":null,"isPrivate":false,"metaSortKey":1673298227299,"_type":"environment"}]} \ No newline at end of file diff --git a/JShellAPI/build.gradle b/JShellAPI/build.gradle index 461bb92..efe627c 100644 --- a/JShellAPI/build.gradle +++ b/JShellAPI/build.gradle @@ -11,6 +11,12 @@ plugins { group 'org.togetherjava' version '1.0-SNAPSHOT' +java { + toolchain { + languageVersion = JavaLanguageVersion.of(19) + } +} + repositories { mavenCentral() } @@ -28,7 +34,7 @@ dependencies { var outputImage = 'togetherjava.org:5001/togetherjava/jshellbackend:master' ?: 'latest' jib { - from.image = 'eclipse-temurin:21' + from.image = 'eclipse-temurin:19' to { image = outputImage auth { diff --git a/JShellWrapper/build.gradle b/JShellWrapper/build.gradle index 7bbc0b6..647f50e 100644 --- a/JShellWrapper/build.gradle +++ b/JShellWrapper/build.gradle @@ -8,6 +8,7 @@ group 'org.togetherjava' version '1.0-SNAPSHOT' mainClassName = 'Main' // Debugging only +sourceCompatibility = 19 run { // Debugging only standardInput = System.in diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index b82aa23..ac72c34 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/gradlew b/gradlew index 1aa94a4..0adc8e1 100755 --- a/gradlew +++ b/gradlew @@ -145,7 +145,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC2039,SC3045 + # shellcheck disable=SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac @@ -153,7 +153,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then '' | soft) :;; #( *) # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC2039,SC3045 + # shellcheck disable=SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -202,11 +202,11 @@ fi # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' -# Collect all arguments for the java command: -# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, -# and any embedded shellness will be escaped. -# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be -# treated as '${Hostname}' itself on the command line. +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \