From 7de12dbb6413df6464ddd51fe81954ae20a54d3b Mon Sep 17 00:00:00 2001 From: DaTTV <104141141+DrFreezyYT@users.noreply.github.com> Date: Sun, 16 Feb 2025 16:44:03 +0100 Subject: [PATCH 1/4] add upload artifact step for JAR files --- .github/workflows/gradle.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 69cc00d..7d51ecb 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -45,3 +45,10 @@ jobs: # Schritt 3: Führe den Build mit dem Gradle Wrapper durch. - name: Build with Gradle Wrapper run: ./gradlew build + + # Schritt 4: Lade die im build/libs generierten JAR-Dateien als Artifakte hoch. + - name: Upload JAR Artifacts + uses: actions/upload-artifact@v4 + with: + name: jar-files + path: build/libs/*.jar From 63bb1415ab64fcc90338f74e7e568916cac6f234 Mon Sep 17 00:00:00 2001 From: DaTTV <104141141+DrFreezyYT@users.noreply.github.com> Date: Sun, 16 Feb 2025 16:48:23 +0100 Subject: [PATCH 2/4] tests --- .github/workflows/gradle.yml | 85 ++++++++++++++++++++++++------------ 1 file changed, 58 insertions(+), 27 deletions(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 7d51ecb..ecd534d 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -18,37 +18,68 @@ jobs: runs-on: ubuntu-latest permissions: contents: read - + outputs: + jarFiles: ${{ steps.jar_list.outputs.jarFiles }} steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v4 - - name: Set up JDK 21 - uses: actions/setup-java@v4 - with: - java-version: '21' - distribution: 'temurin' - cache: gradle + - name: Set up JDK 21 + uses: actions/setup-java@v4 + with: + java-version: '21' + distribution: 'temurin' + cache: gradle - # Configure Gradle for optimal use in GitHub Actions, including caching of downloaded dependencies. - # See: https://github.com/gradle/actions/blob/main/setup-gradle/README.md - - name: Setup Gradle - uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 + # Configure Gradle for optimal use in GitHub Actions, including caching of downloaded dependencies. + - name: Setup Gradle + uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 - # Schritt 1: Erzeuge den Gradle Wrapper, falls dieser nicht vorhanden ist. - - name: Generate Gradle Wrapper - run: gradle wrapper --gradle-version 8.9 + # Schritt 1: Erzeuge den Gradle Wrapper, falls dieser nicht vorhanden ist. + - name: Generate Gradle Wrapper + run: gradle wrapper --gradle-version 8.9 - # Schritt 2: Stelle sicher, dass das Wrapper-Skript ausführbar ist. - - name: Make gradlew executable - run: chmod +x gradlew + # Schritt 2: Stelle sicher, dass das Wrapper-Skript ausführbar ist. + - name: Make gradlew executable + run: chmod +x gradlew - # Schritt 3: Führe den Build mit dem Gradle Wrapper durch. - - name: Build with Gradle Wrapper - run: ./gradlew build + # Schritt 3: Führe den Build mit dem Gradle Wrapper durch. + - name: Build with Gradle Wrapper + run: ./gradlew build - # Schritt 4: Lade die im build/libs generierten JAR-Dateien als Artifakte hoch. - - name: Upload JAR Artifacts - uses: actions/upload-artifact@v4 - with: - name: jar-files - path: build/libs/*.jar + # Speichere das Build-Verzeichnis als Artifakt, damit es im nächsten Job verfügbar ist. + - name: Upload build/libs artifact + uses: actions/upload-artifact@v3 + with: + name: build-libs + path: build/libs + + # Ermittle die Liste der erzeugten JAR-Dateien und speichere sie als JSON-Array in den Job-Outputs. + - name: Get JAR files list + id: jar_list + run: | + jarFiles=$(find build/libs -maxdepth 1 -name '*.jar' -exec basename {} \; | awk '{printf "\"%s\",", $0}') + jarFiles="[${jarFiles%,}]" + echo "Found JAR files: $jarFiles" + echo "jarFiles=$jarFiles" >> $GITHUB_OUTPUT + + upload: + needs: build + runs-on: ubuntu-latest + # Erstelle für jede gefundene JAR-Datei einen Matrix-Eintrag. + strategy: + matrix: + jar: ${{ fromJson(needs.build.outputs.jarFiles) }} + steps: + # Lade das build/libs-Verzeichnis aus dem Build-Job herunter. + - name: Download build/libs artifact + uses: actions/download-artifact@v3 + with: + name: build-libs + path: build/libs + + # Lade die einzelne JAR-Datei (mit Originalnamen) als Artifakt hoch. + - name: Upload artifact for ${{ matrix.jar }} + uses: actions/upload-artifact@v3 + with: + name: ${{ matrix.jar }} + path: build/libs/${{ matrix.jar }} From abef7116844b98cd4a72d09133cfd6ea40eabe05 Mon Sep 17 00:00:00 2001 From: DaTTV <104141141+DrFreezyYT@users.noreply.github.com> Date: Sun, 16 Feb 2025 16:49:18 +0100 Subject: [PATCH 3/4] tests #2 --- .github/workflows/gradle.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index ecd534d..4bf8e8b 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -48,7 +48,7 @@ jobs: # Speichere das Build-Verzeichnis als Artifakt, damit es im nächsten Job verfügbar ist. - name: Upload build/libs artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: build-libs path: build/libs @@ -72,14 +72,14 @@ jobs: steps: # Lade das build/libs-Verzeichnis aus dem Build-Job herunter. - name: Download build/libs artifact - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: build-libs path: build/libs # Lade die einzelne JAR-Datei (mit Originalnamen) als Artifakt hoch. - name: Upload artifact for ${{ matrix.jar }} - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: ${{ matrix.jar }} path: build/libs/${{ matrix.jar }} From 660218e0ddcab67b25d631f209ea6b67b7964631 Mon Sep 17 00:00:00 2001 From: DaTTV <104141141+DrFreezyYT@users.noreply.github.com> Date: Sun, 16 Feb 2025 16:52:28 +0100 Subject: [PATCH 4/4] Made merge ready, fixed typo --- .github/workflows/gradle.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 4bf8e8b..a254a3a 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -5,7 +5,7 @@ # This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle -name: Build and package +name: build and package on: push: