Change GitHub workflows

This commit is contained in:
SKBotNL committed 2025-10-10 23:20:18 +02:00
1 parent 264ed75931
commit 1768cb4d65
4 files changed
+71 -285

No files matched your search

-118
View File
@@ -1,118 +0,0 @@
# This workflow will build a Java project with Gradle
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle
name: Java CI with Gradle
on:
push:
branches-ignore: [ 'api-*' ]
tags-ignore: ["*"]
pull_request:
branches-ignore: [ stable-7 ]
env:
CACHE_REV: "1"
jobs:
build:
# Only run on PRs if the source branch is on someone else's repo
if: "${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }}"
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
${{ github.workspace}}/buildSrc/.gradle/
${{ github.workspace}}/forge/build/fg_cache
${{ github.workspace}}/.gradle/
key: "${{ runner.os }}-minecraft-${{ env.CACHE_REV }}-${{ hashFiles('**/*.gradle*') }}"
restore-keys: |
${{ runner.os }}-minecraft-${{ env.CACHE_REV }}-
- name: Set up JDK 11
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 11
- name: Validate Gradle Wrapper
uses: gradle/actions/wrapper-validation@v3
- name: Setup workspace
run: |
echo "GIT_COMMIT=${GITHUB_SHA}" >> $GITHUB_ENV
echo "GIT_BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV
- name: Build with Gradle
run: ./gradlew -PenableTestPlugins=true -PenableSpongeForge=true build --stacktrace
env:
CI_SYSTEM: Github Actions
- name: Archive artifacts for build
uses: actions/upload-artifact@v4
with:
name: Sponge Jars
path: |
${{ github.workspace }}/SpongeAPI/build/libs/*.jar
${{ github.workspace }}/build/libs/*.jar
${{ github.workspace }}/vanilla/build/libs/*.jar
${{ github.workspace }}/forge/build/libs/*.jar
- name: SpongeVanilla Production Jar
uses: actions/upload-artifact@v4
with:
name: SpongeVanilla Production Jar
path: "${{ github.workspace }}/vanilla/build/libs/*-universal.jar"
- name: SpongeForge Production Jar
uses: actions/upload-artifact@v4
with:
name: SpongeForge Production Jar
path: "${{ github.workspace }}/forge/build/libs/*-universal.jar"
- name: SpongeVanilla libraries
uses: actions/upload-artifact@v4
with:
name: SpongeVanilla installer libraries
path: "${{ github.workspace }}/vanilla/build/resources/installer/libraries.json"
integrationTest:
needs: build
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, windows-latest, macos-latest]
java: [8, 11, 16]
exclude:
- os: macos-latest
java: 8
- os: macos-latest
java: 16
runs-on: "${{ matrix.os }}"
steps:
- name: Check out repository to use the build.gradle.kts as a hash file
uses: actions/checkout@v4
with:
path: code
- name: Download SpongeVanilla libraries as an additional hash file
uses: actions/download-artifact@v4
with:
name: SpongeVanilla installer libraries
path: "${{ github.workspace }}/code/libraries.json"
- name: "Setup JDK ${{ matrix.java }}"
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: "${{ matrix.java }}"
- uses: actions/cache@v4
with:
path: "${{ github.workspace}}/libraries"
key: "${{runner.os}}-${{matrix.java}}-it-libraries-${{ hashFiles('code/build.gradle.kts') }}-${{ github.workspace }}/code/libraries.json"
restore-keys: "${{runner.os}}-${{matrix.java}}-it-libraries-"
- name: Download SpongeVanilla server
uses: actions/download-artifact@v4
with:
name: SpongeVanilla Production Jar
- name: Run SpongeVanilla Test (windows)
if: "runner.os == 'Windows'"
run: java "-Dmixin.debug.verbose=true" -jar $(gci | Where-Object NameString -Match "-universal.jar") --launchTarget sponge_server_it
- name: Run SpongeVanilla Test (other)
if: "runner.os != 'Windows'"
run: java -Dmixin.debug.verbose=true -jar *-universal.jar --launchTarget sponge_server_it
-14
View File
@@ -1,14 +0,0 @@
name: Spotless Check
on:
push:
branches: "**"
tags-ignore: ["**"]
pull_request:
jobs:
call-check:
uses: SpongePowered/.github/.github/workflows/shared-check-spotless.yaml@master
with:
extra_gradle_params: "-PenableTestPlugins=true -PenableSpongeForge=true"
secrets: inherit
-153
View File
@@ -1,153 +0,0 @@
# This workflow will build a Java project with Gradle
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle
# This workflow should have the same content as build-project.yaml, plus extra handling for publishing
name: Build and Deploy
on:
push:
branches: [ 'api-*' ]
env:
CACHE_REV: "1"
jobs:
build:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
${{ github.workspace}}/buildSrc/.gradle/
${{ github.workspace}}/forge/build/fg_cache
${{ github.workspace}}/.gradle/
key: "${{ runner.os }}-minecraft-${{ env.CACHE_REV }}-${{ hashFiles('**/*.gradle*') }}"
restore-keys: |
${{ runner.os }}-minecraft-${{ env.CACHE_REV }}-
- name: Set up JDK 11
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 11
- name: Validate Gradle Wrapper
uses: gradle/actions/wrapper-validation@v3
- name: Setup workspace
run: |
echo "GIT_COMMIT=${GITHUB_SHA}" >> $GITHUB_ENV
echo "GIT_BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV
echo "BUILD_NUMBER=${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV
- name: Build with Gradle
run: ./gradlew -PenableTestPlugins=true -PenableSpongeForge=true build --stacktrace
env:
CI_SYSTEM: Github Actions
- name: Archive artifacts for build
uses: actions/upload-artifact@v4
with:
name: Sponge Jars
path: |
${{ github.workspace }}/SpongeAPI/build/libs/*.jar
${{ github.workspace }}/build/libs/*.jar
${{ github.workspace }}/vanilla/build/libs/*.jar
${{ github.workspace }}/forge/build/libs/*.jar
- name: SpongeVanilla Production Jar
uses: actions/upload-artifact@v4
with:
name: SpongeVanilla Production Jar
path: "${{ github.workspace }}/vanilla/build/libs/*-universal.jar"
- name: SpongeForge Production Jar
uses: actions/upload-artifact@v4
with:
name: SpongeForge Production Jar
path: "${{ github.workspace }}/forge/build/libs/*-universal.jar"
- name: SpongeVanilla libraries
uses: actions/upload-artifact@v4
with:
name: SpongeVanilla installer libraries
path: "${{ github.workspace }}/vanilla/build/resources/installer/libraries.json"
integrationTest:
needs: build
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, windows-latest, macos-latest]
java: [8, 11, 16]
exclude:
- os: macos-latest
java: 8
- os: macos-latest
java: 16
runs-on: "${{ matrix.os }}"
steps:
- name: Check out repository to use the build.gradle.kts as a hash file
uses: actions/checkout@v4
with:
path: code
- name: Download SpongeVanilla libraries as an additional hash file
uses: actions/download-artifact@v4
with:
name: SpongeVanilla installer libraries
path: "${{ github.workspace }}/code/libraries.json"
- name: "Setup JDK ${{ matrix.java }}"
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: "${{ matrix.java }}"
- uses: actions/cache@v4
with:
path: "${{ github.workspace}}/libraries"
key: "${{runner.os}}-${{matrix.java}}-it-libraries-${{ hashFiles('code/build.gradle.kts') }}-${{ github.workspace }}/code/libraries.json"
restore-keys: "${{runner.os}}-${{matrix.java}}-it-libraries-"
- name: Download SpongeVanilla server
uses: actions/download-artifact@v4
with:
name: SpongeVanilla Production Jar
- name: Run SpongeVanilla Test (windows)
if: "runner.os == 'Windows'"
run: java "-Dmixin.debug.verbose=true" -jar $(gci | Where-Object NameString -Match "-universal.jar") --launchTarget sponge_server_it
- name: Run SpongeVanilla Test (other)
if: "runner.os != 'Windows'"
run: java -Dmixin.debug.verbose=true -jar *-universal.jar --launchTarget sponge_server_it
publish:
needs: integrationTest
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
${{ github.workspace}}/buildSrc/.gradle/
${{ github.workspace}}/forge/build/fg_cache
${{ github.workspace}}/.gradle/
key: "${{ runner.os }}-minecraft-${{ env.CACHE_REV }}-${{ hashFiles('**/*.gradle*') }}"
restore-keys: |
${{ runner.os }}-minecraft-${{ env.CACHE_REV }}-
- name: Set up JDK 11
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 11
# We don't need to run tests again, so we just publish
- name: Setup workspace
run: |
echo "GIT_COMMIT=${GITHUB_SHA}" >> $GITHUB_ENV
echo "GIT_BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV
echo "BUILD_NUMBER=${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV
- name: Publish to Sponge Maven & GitHub Packages
run: ./gradlew -s -PenableSpongeForge=true :publish :SpongeVanilla:publish :SpongeForge:publish
env:
CI_SYSTEM: Github Actions
GITHUB_USERNAME: "${{ github.actor }}"
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
ORG_GRADLE_PROJECT_spongeSnapshotRepo: "${{ secrets.SPONGE_MAVEN_SNAPSHOT_REPO_URL }}"
ORG_GRADLE_PROJECT_spongeReleaseRepo: "${{ secrets.SPONGE_MAVEN_RELEASE_REPO_URL }}"
ORG_GRADLE_PROJECT_spongeUsername: "${{ secrets.SPONGE_MAVEN_REPO_USER }}"
ORG_GRADLE_PROJECT_spongePassword: "${{ secrets.SPONGE_MAVEN_REPO_PASSWORD }}"
+71
View File
@@ -0,0 +1,71 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle
name: Java CI with Gradle
on:
push:
branches: [ "api-8" ]
pull_request:
branches: [ "api-8" ]
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
# Configure Gradle for optimal use in GitHub Actions, including caching of downloaded dependencies.
# See: https://github.com/gradle/actions/blob/main/setup-gradle/README.md
- name: Setup Gradle
uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0
- name: Build with Gradle Wrapper
run: ./gradlew build test
# NOTE: The Gradle Wrapper is the default and recommended way to run Gradle (https://docs.gradle.org/current/userguide/gradle_wrapper.html).
# If your project does not have the Gradle Wrapper configured, you can use the following configuration to run Gradle with a specified version.
#
# - name: Setup Gradle
# uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0
# with:
# gradle-version: '8.9'
#
# - name: Build with Gradle 8.9
# run: gradle build
dependency-submission:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
# Generates and submits a dependency graph, enabling Dependabot Alerts for all project dependencies.
# See: https://github.com/gradle/actions/blob/main/dependency-submission/README.md
- name: Generate and submit dependency graph
uses: gradle/actions/dependency-submission@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0