Separate workflows between PRs and pushes

This commit is contained in:
Alexander Brandes 2023-01-14 17:18:34 +01:00
parent 00722bc463
commit 9295bbfdae
No known key found for this signature in database
GPG Key ID: 158F5701A6AAD00C
4 changed files with 68 additions and 5 deletions

48
.github/workflows/build-pr.yml vendored Normal file
View File

@ -0,0 +1,48 @@
name: Build PR
on: [ pull_request ]
jobs:
build_pr:
if: github.repository_owner == 'IntellectualSites'
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest, windows-latest, macos-latest ]
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17
- name: Clean Build
run: ./gradlew clean build
- name: Upload test results
if: always()
uses: actions/upload-artifact@v3
with:
name: Test Results ${{ matrix.os }}
path: Core/build/test-results/test/*.xml
publish-test-results:
name: "Publish Tests Results"
needs: build_pr
runs-on: ubuntu-latest
permissions:
checks: write
if: always()
steps:
- name: Download Artifacts
uses: actions/download-artifact@v3
with:
path: artifacts
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
with:
junit_files: Core/build/test-results/test/*.xml

View File

@ -1,15 +1,18 @@
name: build
on: [ pull_request, push ]
on:
push:
branches:
- v6
jobs:
build:
if: ${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }}
if: github.repository_owner == 'IntellectualSites'
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Validate Gradle Wrapper"
- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1
- name: Setup Java
uses: actions/setup-java@v3

View File

@ -1,8 +1,6 @@
name: "CodeQL"
on:
push:
branches: [ v6 ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ v6 ]

View File

@ -1,3 +1,17 @@
plugins {
id("com.gradle.enterprise") version("3.9")
}
gradleEnterprise {
if (System.getenv("CI") != null) {
buildScan {
publishAlways()
termsOfServiceUrl = "https://gradle.com/terms-of-service"
termsOfServiceAgree = "yes"
}
}
}
rootProject.name = "PlotSquared"
include("Core", "Bukkit")