From bc53cd4e3b8456b8243b816722dd933d17e6bf2e Mon Sep 17 00:00:00 2001 From: Samuel Bucheli Date: Fri, 30 Jun 2023 21:02:23 +0200 Subject: [PATCH] Update to Java 11 --- .github/workflows/maven.yml | 64 +++++++++++++++++++ .gitignore | 43 ++++++++++--- .idea/compiler.xml | 3 - .idea/encodings.xml | 1 + .idea/jarRepositories.xml | 20 ++++++ .idea/misc.xml | 1 + .idea/sonarlint/issuestore/index.pb | 23 +++++++ .travis.yml | 8 --- Dockerfile | 4 ++ README.md | 4 +- pom.xml | 35 ++++++---- src/main/java/ch/bfh/pcws/Application.java | 22 +++---- .../ch/bfh/pcws/api/CreateCodeEndpoint.java | 6 +- system.properties | 1 + 14 files changed, 183 insertions(+), 52 deletions(-) create mode 100644 .github/workflows/maven.yml create mode 100644 .idea/jarRepositories.xml create mode 100644 .idea/sonarlint/issuestore/index.pb delete mode 100644 .travis.yml create mode 100644 Dockerfile create mode 100644 system.properties diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml new file mode 100644 index 0000000..a9e9868 --- /dev/null +++ b/.github/workflows/maven.yml @@ -0,0 +1,64 @@ +name: Build Java Jar with Maven, build Docker Image and publish + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up JDK 11 + uses: actions/setup-java@v3 + with: + java-version: '11' + distribution: 'temurin' + cache: maven + - name: Build jar with Maven + run: mvn -B package -Pjar --file pom.xml + # Uploads the full dependency graph to GitHub to improve the quality of Dependabot alerts this repository can receive + - name: Update dependency graph + uses: advanced-security/maven-dependency-submission-action@571e99aab1055c2e71a1e2309b9691de18d6b7d6 + - name: Create jar release + uses: ncipollo/release-action@v1 + with: + allowUpdates: true + artifacts: "target/pcws.jar" + commit: "${{ github.sha }}" + tag: "latest-jar" + prerelease: true + - name: Build war with Maven + run: mvn -B package -Pwar --file pom.xml + - name: Create war release + uses: ncipollo/release-action@v1 + with: + allowUpdates: true + artifacts: "target/pcws.war,src/main/db/setup_db.sql,src/main/sh/transfer_logs.sh" + commit: "${{ github.sha }}" + tag: "latest-war" + prerelease: true + - name: Log in to the Container registry + uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + - name: Build and push Docker image + uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4 + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/.gitignore b/.gitignore index 4805584..9244c93 100644 --- a/.gitignore +++ b/.gitignore @@ -21,8 +21,27 @@ # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml hs_err_pid* - -# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm +replay_pid* + +target/ +pom.xml.tag +pom.xml.releaseBackup +pom.xml.versionsBackup +pom.xml.next +release.properties +dependency-reduced-pom.xml +buildNumber.properties +.mvn/timing.properties +# https://github.com/takari/maven-wrapper#usage-without-binary-jar +.mvn/wrapper/maven-wrapper.jar + +# Eclipse m2e generated files +# Eclipse Core +.project +# JDT-specific (Eclipse Java Development Tools) +.classpath + +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 # User-specific stuff @@ -32,6 +51,9 @@ hs_err_pid* .idea/**/dictionaries .idea/**/shelf +# AWS User-specific +.idea/**/aws.xml + # Generated files .idea/**/contentModel.xml @@ -52,11 +74,14 @@ hs_err_pid* # When using Gradle or Maven with auto-import, you should exclude module files, # since they will be recreated, and may cause churn. Uncomment if using # auto-import. -.idea/modules.xml -.idea/*.iml -.idea/modules -*.iml -*.ipr +# .idea/artifacts +# .idea/compiler.xml +# .idea/jarRepositories.xml +# .idea/modules.xml +# .idea/*.iml +# .idea/modules +# *.iml +# *.ipr # CMake cmake-build-*/ @@ -79,6 +104,9 @@ atlassian-ide-plugin.xml # Cursive Clojure plugin .idea/replstate.xml +# SonarLint plugin +.idea/sonarlint/ + # Crashlytics plugin (for Android Studio and IntelliJ) com_crashlytics_export_strings.xml crashlytics.properties @@ -91,4 +119,3 @@ fabric.properties # Android studio 3.1+ serialized cache file .idea/caches/build_file_checksums.ser -.idea/artifacts/* \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml index 8fbb920..cb85a70 100644 --- a/.idea/compiler.xml +++ b/.idea/compiler.xml @@ -9,9 +9,6 @@ - - -