-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Build update and improvements to CI (#16)
- Loading branch information
Showing
21 changed files
with
407 additions
and
289 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
name: Check Pull Request | ||
|
||
on: | ||
pull_request_target: | ||
types: [ opened ] | ||
|
||
jobs: | ||
run: | ||
if: | | ||
github.repository != github.event.pull_request.head.repo.full_name && | ||
( | ||
(github.head_ref == 'master' || github.head_ref == '3.1.x') || | ||
github.event.pull_request.head.repo.owner.type != 'User' | ||
) | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: superbrothers/close-pull-request@v3 | ||
id: "master_branch" | ||
with: | ||
comment: "This Pull Request is created from a restricted branch name. This can cause issues in the maintenance of the Pull Request; please create a new branch instead." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,69 +1,83 @@ | ||
name: Java CI | ||
|
||
on: | ||
push: | ||
paths: | ||
- '**.gradle' | ||
- '**.properties' | ||
- '**/src/**' | ||
branches: | ||
- 'master' | ||
- '3.1.x' | ||
tags-ignore: | ||
- '*.*' | ||
pull_request: | ||
paths: | ||
- '**.gradle' | ||
- '**.properties' | ||
- '**/src/**' | ||
types: [opened, synchronize, reopened] | ||
workflow_dispatch: | ||
push: | ||
paths: | ||
- '**.gradle' | ||
- '**.properties' | ||
- '**/src/**' | ||
- '.github/workflows/**' | ||
branches: | ||
- 'master' | ||
- '3.1.x' | ||
tags-ignore: | ||
- '*.*' | ||
pull_request: | ||
paths: | ||
- '**.gradle' | ||
- '**.properties' | ||
- '**/src/**' | ||
types: [ opened, synchronize, reopened ] | ||
|
||
jobs: | ||
build: | ||
name: Build for JDK ${{ matrix.java }} | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
java: [ 8, 11 ] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/cache@v1 | ||
with: | ||
path: ~/.gradle/caches | ||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} | ||
restore-keys: | | ||
${{ runner.os }}-gradle- | ||
- name: Set up JDK ${{ matrix.java }} | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: ${{ matrix.java }} | ||
- name: Build with Gradle | ||
run: ./gradlew build | ||
if: | | ||
!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.pull_request.title, '[ci skip]') | ||
release: | ||
name: Publish artifacts | ||
runs-on: ubuntu-latest | ||
if: github.event_name != 'pull_request' | ||
needs: build | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
- uses: actions/cache@v1 | ||
with: | ||
path: ~/.gradle/caches | ||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} | ||
restore-keys: | | ||
${{ runner.os }}-gradle- | ||
- name: Set up JDK | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: 8 | ||
- name: Publish with Gradle | ||
run: ./gradlew -x test publish | ||
build: | ||
name: Build for JDK ${{ matrix.java }} | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
java: [ 8, 11, 17, 21 ] | ||
steps: | ||
- name: PR Check (PR Blocked by Dependency) | ||
if: ${{ contains(toJson(github.event.pull_request.labels.*.name), 'PR depends on PR') }} | ||
run: echo "::warning::This PR was marked with the label 'PR depends on PR' this can cause issues in building" | ||
- uses: actions/checkout@v4 | ||
- uses: actions/cache@v4 | ||
with: | ||
path: ~/.gradle/caches | ||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} | ||
restore-keys: | | ||
${{ runner.os }}-gradle- | ||
- name: Set up JDK ${{ matrix.java }} | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: ${{ matrix.java }} | ||
distribution: 'temurin' | ||
- name: Build with Gradle | ||
run: ./gradlew build | ||
release: | ||
name: Publish artifacts | ||
runs-on: ubuntu-latest | ||
if: ${{ github.event_name != 'pull_request' && ( (vars.runReleaseOnPush || 'true') == 'true' || contains(github.event.head_commit.message, '[release]') ) }} | ||
needs: build | ||
env: | ||
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.signingKey }} | ||
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.signingPassword }} | ||
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.sonatypeUsername }} | ||
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.sonatypePassword }} | ||
HAS_CREDENTIALS: ${{ secrets.signingKey != '' && secrets.signingPassword != '' && secrets.sonatypeUsername != '' && secrets.sonatypePassword != '' }} | ||
steps: | ||
- name: Validate repository secrets for publish | ||
if: ${{ env.HAS_CREDENTIALS != 'true' }} | ||
run: | | ||
echo '### Release Failed ❌' >> $GITHUB_STEP_SUMMARY | ||
echo 'This repository does not have all required secrets: signingKey, signingPassword, sonatypeUsername or sonatypePassword).' >> $GITHUB_STEP_SUMMARY | ||
echo "::error::This repository does not have all required secrets: signingKey, signingPassword, sonatypeUsername or sonatypePassword)." | ||
exit -1 | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- uses: actions/cache@v4 | ||
with: | ||
path: ~/.gradle/caches | ||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} | ||
restore-keys: | | ||
${{ runner.os }}-gradle- | ||
- name: Set up JDK | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: 11 | ||
distribution: 'temurin' | ||
- name: Publish with Gradle | ||
run: ./gradlew -x test publish | ||
env: | ||
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.signingKey }} | ||
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.signingPassword }} | ||
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.sonatypeUsername }} | ||
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.sonatypePassword }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.