-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
384 additions
and
374 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
This file was deleted.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.
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,37 +1,113 @@ | ||
name: Build | ||
|
||
on: [push, pull_request, workflow_dispatch] | ||
on: | ||
pull_request: | ||
workflow_dispatch: | ||
push: | ||
tags: | ||
- 'v*' | ||
branches-ignore: | ||
- 'dependabot/**' | ||
- 'gh-pages' | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 15 | ||
if: | | ||
github.event_name != 'pull_request' || | ||
github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name | ||
(github.event_name != 'pull_request' && ! github.event.pull_request.head.repo.fork) | ||
|| (github.event_name == 'pull_request' && (github.event.pull_request.head.repo.fork || startsWith(github.head_ref, 'dependabot/'))) | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Validate gradle wrapper | ||
uses: gradle/wrapper-validation-action@v1 | ||
- name: Setup Gradle | ||
uses: gradle/gradle-build-action@v2 | ||
|
||
- name: Setup jdk | ||
uses: actions/setup-java@v3 | ||
- name: Setup JDK | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: 17 | ||
java-version: 21 | ||
cache: gradle | ||
distribution: temurin | ||
|
||
- name: Build with gradle | ||
- name: Build | ||
run: ./gradlew build coverage | ||
|
||
- name: Upload build reports | ||
uses: actions/upload-artifact@v3 | ||
if: always() | ||
- name: Publish Test Report | ||
if: success() || failure() # run this step even if previous step failed | ||
continue-on-error: true | ||
uses: dorny/test-reporter@v1 | ||
with: | ||
name: test report | ||
path: ./**/build/test-results/test/*.xml | ||
reporter: java-junit | ||
|
||
- name: Publish Coverage Report | ||
uses: codecov/codecov-action@v3 | ||
if: github.repository == 'coditory/quark-context' && github.ref == 'refs/heads/main' | ||
continue-on-error: true | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
override_commit: ${{ github.event.workflow_run.head_sha }} | ||
override_branch: ${{ github.event.workflow_run.head_branch }} | ||
override_build: ${{ github.event.workflow_run.id }} | ||
files: 'build/reports/kover/report.xml' | ||
|
||
- name: Import GPG Key | ||
id: gpg | ||
uses: crazy-max/ghaction-import-gpg@v6 | ||
if: | | ||
github.repository == 'coditory/quark-context' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')) | ||
with: | ||
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} | ||
passphrase: ${{ secrets.GPG_PASSPHRASE }} | ||
git_user_signingkey: true | ||
git_commit_gpgsign: true | ||
git_committer_name: Coditory Bot | ||
git_committer_email: [email protected] | ||
|
||
- name: Publish Snapshot | ||
if: github.repository == 'coditory/quark-context' && github.ref == 'refs/heads/main' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch') | ||
env: | ||
SIGNING_KEY: ${{ secrets.GPG_PRIVATE_KEY }} | ||
SIGNING_PASSWORD: ${{ secrets.GPG_PASSPHRASE }} | ||
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} | ||
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} | ||
run: ./gradlew publishToSonatype version | ||
|
||
- name: Publish Release | ||
id: publish-release | ||
if: github.repository == 'coditory/quark-context' && startsWith(github.ref, 'refs/tags/v') && (github.event_name == 'push' || github.event_name == 'release' || github.event_name == 'workflow_dispatch') | ||
env: | ||
SIGNING_KEY: ${{ secrets.GPG_PRIVATE_KEY }} | ||
SIGNING_PASSWORD: ${{ secrets.GPG_PASSPHRASE }} | ||
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} | ||
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} | ||
OSSRH_STAGING_PROFILE_ID: ${{ secrets.OSSRH_STAGING_PROFILE_ID }} | ||
run: ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository version -Pversion=${GITHUB_REF_NAME:1} | ||
|
||
- name: Generate Release Notes | ||
id: generate-release-notes | ||
if: steps.publish-release.conclusion == 'success' | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
declare -r NOTES="$(gh api \ | ||
--method POST \ | ||
-H "Accept: application/vnd.github+json" \ | ||
/repos/${{ github.repository }}/releases/generate-notes \ | ||
-f target_commitish='main' \ | ||
| jq -r '.body')" | ||
declare -r ESCAPED="${NOTES//$'\n'/'%0A'}" | ||
echo "notes=$ESCAPED" >> $GITHUB_OUTPUT | ||
- name: Create github release | ||
if: steps.generate-release-notes.conclusion == 'success' | ||
uses: ncipollo/release-action@v1 | ||
with: | ||
name: build-reports | ||
retention-days: 7 | ||
path: | | ||
**/build/test-results/*/TEST-*.xml | ||
**/build/reports/jacoco/*/*.xml | ||
allowUpdates: true | ||
body: ${{ steps.notes.outputs.notes }} | ||
token: ${{ secrets.GITHUB_TOKEN }} |
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.