Properly Cache Build Dependencies, Optimize Build Action, and Save Build Action Artifacts (#3593)

* Attempt cache gradle properly

* Save artifacts on standard build

* Dont build on bad path and standardize pr action

* Don't do caching for PR builds

* Correct exclusion paths

* Allow manual trigger of build action
This commit is contained in:
Kas-tle 2023-03-07 18:59:21 -08:00 committed by GitHub
parent 81f0cbe5ed
commit a5a4f5c3ea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 90 additions and 11 deletions

View file

@ -1,6 +1,18 @@
name: Build
on: [push]
on:
workflow_dispatch:
push:
paths-ignore:
- '.github/ISSUE_TEMPLATE/*.yml'
- '.github/actions/pullrequest.yml'
- '.idea/copyright/*.xml'
- '.gitignore'
- 'CONTRIBUTING.md'
- 'LICENSE'
- 'Jenkinsfile '
- 'README.md'
- 'licenseheader.txt'
jobs:
build:
@ -15,12 +27,64 @@ jobs:
with:
java-version: 17
distribution: temurin
cache: gradle
- name: Cache Gradle Packages
uses: actions/cache@v3
with:
path: |
~/.m2
~/.gradle/caches
~/.gradle/wrapper
key: ${{ github.ref_name }}-gradle-${{ hashFiles('*.gradle.kts', 'gradle.properties', 'gradlew', 'gradle/*', 'gradle/**/*', 'build-logic/*', 'build-logic/**/**/**/*', '**/*.gradle.kts', '**/**/*.gradle.kts') }}
restore-keys: ${{ github.ref_name }}-gradle-
- name: Build
uses: gradle/gradle-build-action@v2
with:
arguments: build
arguments: build --no-daemon
- name: Archive artifacts (Geyser Fabric)
uses: actions/upload-artifact@v3
if: success()
with:
name: Geyser Fabric
path: bootstrap/fabric/build/libs/Geyser-Fabric.jar
if-no-files-found: error
- name: Archive artifacts (Geyser Standalone)
uses: actions/upload-artifact@v3
if: success()
with:
name: Geyser Standalone
path: bootstrap/standalone/build/libs/Geyser-Standalone.jar
if-no-files-found: error
- name: Archive artifacts (Geyser Spigot)
uses: actions/upload-artifact@v3
if: success()
with:
name: Geyser Spigot
path: bootstrap/spigot/build/libs/Geyser-Spigot.jar
if-no-files-found: error
- name: Archive artifacts (Geyser BungeeCord)
uses: actions/upload-artifact@v3
if: success()
with:
name: Geyser BungeeCord
path: bootstrap/bungeecord/build/libs/Geyser-BungeeCord.jar
if-no-files-found: error
- name: Archive artifacts (Geyser Sponge)
uses: actions/upload-artifact@v3
if: success()
with:
name: Geyser Sponge
path: bootstrap/sponge/build/libs/Geyser-Sponge.jar
if-no-files-found: error
- name: Archive artifacts (Geyser Velocity)
uses: actions/upload-artifact@v3
if: success()
with:
name: Geyser Velocity
path: bootstrap/velocity/build/libs/Geyser-Velocity.jar
if-no-files-found: error
- name: Publish to Maven Repository
if: ${{ job.status == 'success' && github.repository == 'GeyserMC/Geyser' && github.ref_name == 'master' }}

View file

@ -1,6 +1,16 @@
name: Build Pull Request
on: [pull_request]
on:
pull_request:
paths-ignore:
- '.github/ISSUE_TEMPLATE/*.yml'
- '.idea/copyright/*.xml'
- '.gitignore'
- 'CONTRIBUTING.md'
- 'LICENSE'
- 'Jenkinsfile '
- 'README.md'
- 'licenseheader.txt'
jobs:
build:
@ -11,7 +21,6 @@ jobs:
with:
java-version: 17
distribution: temurin
cache: gradle
- name: Check if the author has forked the API repo
uses: Kas-tle/ForkFinder@v1.0.1
@ -44,38 +53,44 @@ jobs:
build-root-directory: geyser
- name: Archive artifacts (Geyser Fabric)
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
if: success()
with:
name: Geyser Fabric
path: geyser/bootstrap/fabric/build/libs/Geyser-Fabric.jar
if-no-files-found: error
- name: Archive artifacts (Geyser Standalone)
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
if: success()
with:
name: Geyser Standalone
path: geyser/bootstrap/standalone/build/libs/Geyser-Standalone.jar
if-no-files-found: error
- name: Archive artifacts (Geyser Spigot)
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
if: success()
with:
name: Geyser Spigot
path: geyser/bootstrap/spigot/build/libs/Geyser-Spigot.jar
if-no-files-found: error
- name: Archive artifacts (Geyser BungeeCord)
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
if: success()
with:
name: Geyser BungeeCord
path: geyser/bootstrap/bungeecord/build/libs/Geyser-BungeeCord.jar
if-no-files-found: error
- name: Archive artifacts (Geyser Sponge)
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
if: success()
with:
name: Geyser Sponge
path: geyser/bootstrap/sponge/build/libs/Geyser-Sponge.jar
if-no-files-found: error
- name: Archive artifacts (Geyser Velocity)
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
if: success()
with:
name: Geyser Velocity
path: geyser/bootstrap/velocity/build/libs/Geyser-Velocity.jar
if-no-files-found: error