From 70efa181fae60202cb69d463d352ec7be43a5c84 Mon Sep 17 00:00:00 2001 From: shartte Date: Wed, 8 Nov 2023 13:13:49 +0100 Subject: [PATCH 1/2] Added a GHA Pull-Request Workflow There is also a separate test-reporting workflow to allow the reporting of JUnit test results as a Github check, even if the build is running without write-permission (i.e. the PR is made from a fork). --- .github/workflows/pr.yml | 47 +++++++++++++++++++++++++++++++ .github/workflows/test-report.yml | 24 ++++++++++++++++ 2 files changed, 71 insertions(+) create mode 100644 .github/workflows/pr.yml create mode 100644 .github/workflows/test-report.yml diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml new file mode 100644 index 000000000..0896f29c7 --- /dev/null +++ b/.github/workflows/pr.yml @@ -0,0 +1,47 @@ +name: 'Build Pull Request' +run-name: Build for PR ${{ github.event.pull_request.number }} + +on: + pull_request: + types: + - synchronize + - opened + - ready_for_review + - reopened + +jobs: + build: + name: Build and Test + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 1000 + fetch-tags: true + + - name: Setup JDK + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'microsoft' + + - name: Setup Gradle + uses: gradle/gradle-build-action@v2 + + - name: Build + run: ./gradlew --info -s -x check build + + - name: Test + run: ./gradlew --info -s check + + # Always upload test results + - name: Merge Test Reports + if: success() || failure() + run: npx junit-report-merger junit.xml "**/TEST-*.xml" + + - uses: actions/upload-artifact@v3 + if: success() || failure() + with: + name: test-results + path: junit.xml diff --git a/.github/workflows/test-report.yml b/.github/workflows/test-report.yml new file mode 100644 index 000000000..6f272c51d --- /dev/null +++ b/.github/workflows/test-report.yml @@ -0,0 +1,24 @@ +name: 'Test Report' +on: + workflow_run: + workflows: ['Build Pull Request'] + types: + - completed +permissions: + contents: read + actions: read + checks: write +jobs: + report: + runs-on: ubuntu-latest + steps: + - uses: dorny/test-reporter@v1 + with: + artifact: test-results + name: Test Report + path: '**/*.xml' + reporter: java-junit + # This should not affect the result of the check created + # for the origin PR. This just affects this post-processing job itself. + fail-on-error: false + fail-on-empty: false From d0421284751a85668eeeb2e5c60529494bda236b Mon Sep 17 00:00:00 2001 From: shartte Date: Wed, 8 Nov 2023 19:47:13 +0100 Subject: [PATCH 2/2] Update README.md --- README.md | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/README.md b/README.md index e892f6ef6..98b15df69 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,4 @@ NeoGradle =========== -Minecraft mod development framework used by NeoForge and FML for the Gradle build system. - -For a quick start, see how the [NeoForge Mod Development Kit](https://github.com/neoforged/MDK) uses NeoGradle, or see our official [Documentation](https://docs.neoforged.net/neogradle/docs/). - -To see the latest available version of NeoGradle, visit the [NeoForged Maven](https://maven.neoforged.net/#/releases/net/neoforged/gradle/userdev). +TEST