From d37d13dacad45af717e1f97488e739ef617fd89d Mon Sep 17 00:00:00 2001 From: Linnea Gräf Date: Mon, 18 Nov 2024 18:18:38 +0100 Subject: ci: Split up test and build steps --- .github/composite/gradle/action.yml | 27 +++++++++++++++++++++++++++ .github/workflows/build.yml | 33 ++++++++++++++++++++++----------- 2 files changed, 49 insertions(+), 11 deletions(-) create mode 100644 .github/composite/gradle/action.yml diff --git a/.github/composite/gradle/action.yml b/.github/composite/gradle/action.yml new file mode 100644 index 0000000..5f7a260 --- /dev/null +++ b/.github/composite/gradle/action.yml @@ -0,0 +1,27 @@ +# SPDX-FileCopyrightText: 2024 Linnea Gräf +# +# SPDX-License-Identifier: CC0-1.0 + +name: "Run Gradle on a filter=tree:0 checkout" +runs: + using: composite + steps: + - uses: actions/checkout@v4 + name: Checkout repository + with: + fetch-tags: true + fetch-depth: 0 + filter: 'tree:0' + - name: Set up JDK 21 + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: 21 + - name: Set up gradle cache + uses: gradle/actions/setup-gradle@v3 + with: + add-job-summary-as-pr-comment: 'on-failure' + - name: Prepare unpacked Jars + run: | + ./gradlew unpackAllJars + shell: sh diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cddb0ed..b1daf9d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,9 +7,12 @@ on: - push - pull_request +permissions: + pull-requests: write + jobs: build: - name: Test + name: Build runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -18,18 +21,10 @@ jobs: fetch-tags: true fetch-depth: 0 filter: 'tree:0' - - name: Set up JDK 21 - uses: actions/setup-java@v4 - with: - distribution: temurin - java-version: 21 - - name: Set up gradle cache - uses: gradle/actions/setup-gradle@v3 + - uses: ./.github/composite/gradle - name: Build with gradle run: | - ./gradlew clean - ./gradlew unpackAllJars --stacktrace - ./gradlew test remapJar --stacktrace + ./gradlew remapJar --scan - name: Move build artifact around and print check sum run: | rm -f build/libs/*sources*.jar @@ -40,6 +35,22 @@ jobs: name: built-mod-jar path: build/libs/Firmament-*.jar + test: + name: Test + needs: build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + name: Checkout repository + with: + fetch-tags: true + fetch-depth: 0 + filter: 'tree:0' + - uses: ./.github/composite/gradle + - name: Build with gradle + run: | + ./gradlew test --scan + upload: name: Upload runs-on: ubuntu-latest -- cgit