Skip to content

Commit

Permalink
Improved build.yml, removed redundant remapping and compiling, added …
Browse files Browse the repository at this point in the history
…maven local cache load job to all tasks that need to build.
  • Loading branch information
JakeGBLP committed Feb 1, 2025
1 parent 042b28e commit c75bd9e
Showing 1 changed file with 69 additions and 107 deletions.
176 changes: 69 additions & 107 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,9 @@ jobs:
name: Lusk.jar
path: build/libs/*.jar


test_build:
runs-on: ubuntu-latest
needs: [ build ]
steps:
- name: Checkout repo
uses: actions/checkout@v4
Expand All @@ -170,111 +170,15 @@ jobs:
restore-keys: |
maven-${{ runner.os }}-
- name: Set up JDK 16
uses: actions/setup-java@v4
with:
java-version: 16
distribution: 'adopt'
- name: Compile Spigot 1.16.5-1.17.x
uses: SpraxDev/[email protected]
with:
versions: "1.16.5,1.17,1.17.1"
remapped: true

- name: Remap 1.17
run: ./gradlew nms:nms_v1_17:build

- name: Remap 1.17.1
run: ./gradlew nms:nms_v1_17_1:build

- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'adopt'

- name: Compile Spigot 1.18.x
uses: SpraxDev/[email protected]
with:
versions: "1.18,1.18.1,1.18.2"
remapped: true

- name: Remap 1.18
run: ./gradlew nms:nms_v1_18:build

- name: Remap 1.18.1
run: ./gradlew nms:nms_v1_18_1:build

- name: Remap 1.18.2
run: ./gradlew nms:nms_v1_18_2:build

- name: Compile Spigot 1.19.x
uses: SpraxDev/[email protected]
with:
versions: "1.19,1.19.1,1.19.3,1.19.4"
remapped: true

- name: Remap 1.19
run: ./gradlew nms:nms_v1_19:build

- name: Remap 1.19.1
run: ./gradlew nms:nms_v1_19_1:build

- name: Remap 1.19.3
run: ./gradlew nms:nms_v1_19_3:build

- name: Remap 1.19.4
run: ./gradlew nms:nms_v1_19_4:build

- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: 21
distribution: 'adopt'

- name: Compile Spigot 1.20.x
uses: SpraxDev/[email protected]
with:
versions: "1.20.1,1.20.2,1.20.4,1.20.6"
remapped: true

- name: Remap 1.20.1
run: ./gradlew nms:nms_v1_20_1:build

- name: Remap 1.20.2
run: ./gradlew nms:nms_v1_20_2:build

- name: Remap 1.20.4
run: ./gradlew nms:nms_v1_20_4:build

- name: Remap 1.20.6
run: ./gradlew nms:nms_v1_20_6:build

- name: Compile Spigot 1.21.x
uses: SpraxDev/[email protected]
with:
versions: "1.21.1,1.21.3,1.21.4"
remapped: true

- name: Remap 1.21.1
run: ./gradlew nms:nms_v1_21_1:build

- name: Remap 1.21.3
run: ./gradlew nms:nms_v1_21_3:build

- name: Remap 1.21.4
run: ./gradlew nms:nms_v1_21_4:build

- name: Build with Gradle
run: ./gradlew build

- name: Save Maven Local Cache
id: cache-maven-save
uses: actions/cache/save@v4
with:
path: ~/.m2/repository
key: ${{ steps.cache-maven-restore.outputs.cache-primary-key }}

- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
Expand All @@ -284,7 +188,7 @@ jobs:
v1_16_5:
if: "! contains(toJSON(github.event.commits.*.message), '[ci skip]')"
runs-on: ubuntu-latest
needs: [test_build]
needs: [ build ]
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -297,6 +201,16 @@ jobs:
java-version: '16'
distribution: 'adopt'
cache: gradle

- name: Restore Maven Local Cache
id: cache-maven-restore
uses: actions/cache/restore@v4
with:
path: ~/.m2/repository
key: maven-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/settings.gradle') }}
restore-keys: |
maven-${{ runner.os }}-
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build Lusk and run test scripts
Expand All @@ -308,12 +222,10 @@ jobs:
name: lusk-nightly.jar
path: build/libs/*



v1_17_x:
if: "! contains(toJSON(github.event.commits.*.message), '[ci skip]')"
runs-on: ubuntu-latest
needs: [test_build]
needs: [ build ]
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -326,6 +238,16 @@ jobs:
java-version: '17'
distribution: 'adopt'
cache: gradle

- name: Restore Maven Local Cache
id: cache-maven-restore
uses: actions/cache/restore@v4
with:
path: ~/.m2/repository
key: maven-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/settings.gradle') }}
restore-keys: |
maven-${{ runner.os }}-
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build Lusk and run test scripts
Expand All @@ -340,7 +262,7 @@ jobs:
v1_18_x:
if: "! contains(toJSON(github.event.commits.*.message), '[ci skip]')"
runs-on: ubuntu-latest
needs: [test_build]
needs: [ build ]
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -353,6 +275,16 @@ jobs:
java-version: '17'
distribution: 'adopt'
cache: gradle

- name: Restore Maven Local Cache
id: cache-maven-restore
uses: actions/cache/restore@v4
with:
path: ~/.m2/repository
key: maven-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/settings.gradle') }}
restore-keys: |
maven-${{ runner.os }}-
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build Lusk and run test scripts
Expand All @@ -367,7 +299,7 @@ jobs:
v1_19_x:
if: "! contains(toJSON(github.event.commits.*.message), '[ci skip]')"
runs-on: ubuntu-latest
needs: [test_build]
needs: [ build ]
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -380,6 +312,16 @@ jobs:
java-version: '17'
distribution: 'adopt'
cache: gradle

- name: Restore Maven Local Cache
id: cache-maven-restore
uses: actions/cache/restore@v4
with:
path: ~/.m2/repository
key: maven-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/settings.gradle') }}
restore-keys: |
maven-${{ runner.os }}-
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build Lusk and run test scripts
Expand All @@ -394,7 +336,7 @@ jobs:
v1_20_x:
if: "! contains(toJSON(github.event.commits.*.message), '[ci skip]')"
runs-on: ubuntu-latest
needs: [test_build]
needs: [ build ]
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -407,6 +349,16 @@ jobs:
java-version: '21'
distribution: 'adopt'
cache: gradle

- name: Restore Maven Local Cache
id: cache-maven-restore
uses: actions/cache/restore@v4
with:
path: ~/.m2/repository
key: maven-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/settings.gradle') }}
restore-keys: |
maven-${{ runner.os }}-
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build Lusk and run test scripts
Expand All @@ -421,7 +373,7 @@ jobs:
v1_21_x:
if: "! contains(toJSON(github.event.commits.*.message), '[ci skip]')"
runs-on: ubuntu-latest
needs: [test_build]
needs: [ build ]
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -434,6 +386,16 @@ jobs:
java-version: '21'
distribution: 'adopt'
cache: gradle

- name: Restore Maven Local Cache
id: cache-maven-restore
uses: actions/cache/restore@v4
with:
path: ~/.m2/repository
key: maven-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/settings.gradle') }}
restore-keys: |
maven-${{ runner.os }}-
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build Lusk and run test scripts
Expand All @@ -447,7 +409,7 @@ jobs:

test_dev_feature:
runs-on: ubuntu-latest
needs: [test_build]
needs: [ test_build ]
steps:
- name: Checkout repo
uses: actions/checkout@v2
Expand All @@ -465,7 +427,7 @@ jobs:

test_dev_patch:
runs-on: ubuntu-latest
needs: [test_build]
needs: [ test_build ]
steps:
- name: Checkout repo
uses: actions/checkout@v2
Expand Down

0 comments on commit c75bd9e

Please sign in to comment.