Combine CI & Java CI workflows #8
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
name: "Java CI" | |
on: | |
push: | |
branches: | |
- '[5-9].[0-9].x' | |
pull_request: | |
branches: | |
- '[5-9].[0-9].x' | |
workflow_dispatch: | |
env: | |
GIT_USER_NAME: 'grails-build' | |
GIT_USER_EMAIL: '[email protected]' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
java: ['17', '21'] | |
steps: | |
- name: "π₯ Checkout the repository" | |
uses: actions/checkout@v4 | |
- name: "βοΈ Setup JDK" | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'liberica' | |
java-version: ${{ matrix.java }} | |
- name: "π Setup Gradle" | |
uses: gradle/actions/setup-gradle@v4 | |
- name: "π¨ Run Base Tests" | |
env: | |
DEVELOCITY_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} | |
DEVELOCITY_BUILD_CACHE_NODE_USER: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER }} | |
DEVELOCITY_BUILD_CACHE_NODE_KEY: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY }} | |
run: ./gradlew check | |
- name: "βοΈ Upload Base Tests Results" | |
uses: actions/upload-artifact@v4 | |
with: | |
name: testreport-audit-test-allow-update-outside-transaction-${{ matrix.java }} | |
path: examples/audit-test-allow-update-outside-transaction/build/reports/tests | |
- name: "π¨ Run Tests Outside of Transaction" | |
env: | |
DEVELOCITY_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} | |
DEVELOCITY_BUILD_CACHE_NODE_USER: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER }} | |
DEVELOCITY_BUILD_CACHE_NODE_KEY: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY }} | |
run: ./gradlew :examples:audit-test:check -Daudit-test.AuditTrail.datasource=DEFAULT | |
- name: "βοΈ Upload Outside of Transaction Tests Results" | |
uses: actions/upload-artifact@v4 | |
with: | |
name: testreport-audit-test-single-datasource-${{ matrix.java }} | |
path: examples/audit-test/build/reports/tests | |
publish: | |
if: github.event_name == 'push' | |
needs: build | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
steps: | |
- name: "π₯ Checkout the repository" | |
uses: actions/checkout@v4 | |
- name: "βοΈ Setup JDK" | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'liberica' | |
java-version: '17' | |
- name: "π Setup Gradle" | |
uses: gradle/actions/setup-gradle@v4 | |
- name: "π€ Publish to Snapshot (repo.grails.org)" | |
env: | |
DEVELOCITY_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} | |
MAVEN_PUBLISH_USERNAME: ${{ secrets.MAVEN_PUBLISH_USERNAME }} | |
MAVEN_PUBLISH_PASSWORD: ${{ secrets.MAVEN_PUBLISH_PASSWORD }} | |
MAVEN_PUBLISH_URL: ${{ secrets.MAVEN_PUBLISH_SNAPSHOT_URL }} | |
working-directory: ./plugin | |
run: ../gradlew publish | |
- name: "π Generate Documentation" | |
if: success() | |
env: | |
DEVELOCITY_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} | |
working-directory: ./plugin | |
run: ../gradlew docs | |
- name: "π Publish to Github Pages" | |
if: success() | |
uses: micronaut-projects/github-pages-deploy-action@grails | |
env: | |
SKIP_SNAPSHOT: ${{ contains(needs.publish.outputs.release_version, 'M') }} | |
TARGET_REPOSITORY: ${{ github.repository }} | |
GH_TOKEN: ${{ secrets.GH_TOKEN }} | |
BRANCH: gh-pages | |
FOLDER: plugin/build/docs | |
DOC_FOLDER: gh-pages | |
COMMIT_EMAIL: ${{ env.GIT_USER_EMAIL }} | |
COMMIT_NAME: ${{ env.GIT_USER_NAME }} |