From 58482e27117589cdda93b6157ab330cf2120524e Mon Sep 17 00:00:00 2001 From: David Gregory <2992938+DavidGregory084@users.noreply.github.com> Date: Thu, 1 Feb 2024 19:19:32 +0000 Subject: [PATCH] Add Github Actions workflows --- .github/workflows/ci.yml | 56 ++++++++++++++++++++++++++ .github/workflows/dependency-graph.yml | 48 ++++++++++++++++++++++ .github/workflows/test-report.yml | 27 +++++++++++++ 3 files changed, 131 insertions(+) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/dependency-graph.yml create mode 100644 .github/workflows/test-report.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..e5b932a --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,56 @@ +name: CI + +on: + push: + pull_request: + +env: + ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_USERNAME }} + ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_PASSWORD }} + ORG_GRADLE_PROJECT_signingKey: ${{ secrets.PGP_SECRET }} + ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.PGP_PASSPHRASE }} + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Validate Gradle Wrapper + uses: gradle/wrapper-validation-action@v1 + + - name: Download Java JDK + uses: typelevel/download-java@v2 + id: download-java + with: + distribution: temurin + java-version: 11 + + - name: Setup Java JDK + uses: actions/setup-java@v4 + with: + distribution: jdkfile + java-version: 11 + jdkFile: ${{ steps.download-java.outputs.jdkFile }} + + - name: Build & Test + uses: gradle/gradle-build-action@v2 + with: + arguments: build --info + + - name: Publish Test Results + uses: actions/upload-artifact@v4 + if: always() + with: + name: test-results + path: '**/build/test-results/*/TEST-*.xml' + + - name: Publish To Sonatype + if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main') + uses: gradle/gradle-build-action@v2 + with: + arguments: publishAllPublicationsToMavenCentral \ No newline at end of file diff --git a/.github/workflows/dependency-graph.yml b/.github/workflows/dependency-graph.yml new file mode 100644 index 0000000..6568516 --- /dev/null +++ b/.github/workflows/dependency-graph.yml @@ -0,0 +1,48 @@ +name: Update Dependency Graph + +on: + push: + branches: + - main + +jobs: + submit: + runs-on: ubuntu-latest + + permissions: + contents: write + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Validate Gradle Wrapper + uses: gradle/wrapper-validation-action@v1 + + - name: Download Java JDK + uses: typelevel/download-java@v2 + id: download-java + with: + distribution: temurin + java-version: 11 + + - name: Setup Java JDK + uses: actions/setup-java@v4 + with: + distribution: jdkfile + java-version: 11 + jdkFile: ${{ steps.download-java.outputs.jdkFile }} + + - name: Setup Dependency Graph + uses: gradle/gradle-build-action@v2 + with: + dependency-graph: generate-and-submit + + - name: Generate Dependency Graph Snapshot + uses: gradle/gradle-build-action@v2 + env: + DEPENDENCY_GRAPH_INCLUDE_CONFIGURATIONS: 'compileClasspath|runtimeClasspath' + with: + arguments: build \ No newline at end of file diff --git a/.github/workflows/test-report.yml b/.github/workflows/test-report.yml new file mode 100644 index 0000000..ecb3f3e --- /dev/null +++ b/.github/workflows/test-report.yml @@ -0,0 +1,27 @@ +name: Test Report + +on: + workflow_run: + workflows: ["CI"] + types: + - completed + +permissions: + checks: write + +jobs: + report: + runs-on: ubuntu-latest + steps: + - name: Download Test Report + uses: dawidd6/action-download-artifact@v2 + with: + name: test-results + workflow: ${{ github.event.workflow.id }} + run_id: ${{ github.event.workflow_run.id }} + + - name: Publish Test Report + uses: mikepenz/action-junit-report@v3 + with: + commit: ${{ github.event.workflow_run.head_sha }} + report_paths: "**/build/test-results/*/TEST-*.xml" \ No newline at end of file