Skip to content

chore(build): use shared-ghactions in build GHA job #528

chore(build): use shared-ghactions in build GHA job

chore(build): use shared-ghactions in build GHA job #528

Workflow file for this run

name: jooqx
on:
create:
branches: [ 'release/**' ]
push:
branches: [ main ]
tags: [ 'v*' ]
paths-ignore:
- '.github/ISSUE_TEMPLATE/**'
- '.github/*.yml'
- '*.md'
- 'LICENSE'
- 'webdocs/**'
pull_request:
types: [ opened, synchronize, reopened, closed ]
branches: [ main ]
paths-ignore:
- '.github/ISSUE_TEMPLATE/**'
- '.github/*.yml'
- '*.md'
- 'LICENSE'
- 'webdocs/**'
env:
PROFILE: 'jooqx'
JAVA_DIST: 'temurin'
jobs:
context:
uses: zero88/shared-ghactions/.github/workflows/project-context.yml@main
with:
profile: 'jooqx'
skipBranchPattern: '^(jpa|rsql)/.*'
secrets:
githubToken: ${{ secrets.OSS_GITHUB_TOKEN }}
gpgKey: ${{ secrets.CI_GPG_PRIVATE_KEY }}
gpgPassphrase: ${{ secrets.CI_GPG_PASSPHARSE }}
build:
uses: zero88/shared-ghactions/.github/workflows/gradle-build.yml@main
needs: context
if: needs.context.outputs.shouldBuild == 'true'
strategy:
matrix:
java: [ '8', '11', '17' ]
os: [ 'ubuntu-latest', 'windows-latest' ]
name: Build & Test Java ${{ matrix.java }} (${{ matrix.os }})
with:
profile: 'jooqx'
version: ${{ needs.context.outputs.version }}
semanticVersion: ${{ needs.context.outputs.semanticVersion }}
hashVersion: ${{ needs.context.outputs.commitId }}
javaVersion: ${{ matrix.java }}
analysis:
needs: context
if: needs.context.outputs.shouldBuild == 'true'
strategy:
matrix:
java: [ '11' ]
os: [ 'ubuntu-latest' ]
db: [ 'pg:10-alpine', 'pg:12-alpine', 'pg:14-alpine', 'h2', 'mysql:5.7-debian', 'mysql:8.0-debian' ]
fail-fast: false
name: Test ${{ matrix.db }} | Java ${{ matrix.java }} (${{ matrix.os }})
runs-on: ${{ matrix.os }}
env:
PROFILE: 'ciSonar'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: 'true'
- uses: actions/setup-java@v4
with:
distribution: ${{ env.JAVA_DIST }}
java-version: ${{ matrix.java }}
- uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ matrix.db }}-${{ runner.os }}-${{ matrix.java }}-${{ env.JAVA_DIST }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ matrix.db }}-${{ runner.os }}-${{ matrix.java }}-${{ env.JAVA_DIST }}-gradle-
- name: Get context
id: db_profile
shell: bash
run: |
echo project=$(echo ${{ matrix.db }} | cut -d':' -f1) >> $GITHUB_OUTPUT
echo dbVersion=$(echo ${{ matrix.db }} | cut -d':' -f2) >> $GITHUB_OUTPUT
# - name: Cache SonarCloud packages
# uses: actions/[email protected]
# with:
# path: ~/.sonar/cache
# key: ${{ runner.os }}-sonar
# restore-keys: ${{ runner.os }}-sonar
- name: Generate jOOQ test schema
shell: bash
run: |
./gradlew --stacktrace \
:integtest:${{ steps.db_profile.outputs.project }}:generateJooq \
-Pprofile=${{ env.PROFILE }} \
-PdbVersion=${{ steps.db_profile.outputs.dbVersion }} \
-PsemanticVersion=${{ needs.context.outputs.semanticVersion }}
- name: Run test
shell: bash
run: |
./gradlew --stacktrace \
:integtest:${{ steps.db_profile.outputs.project }}:test \
:integtest:${{ steps.db_profile.outputs.project }}:jacocoTestReport \
-Pprofile=${{ env.PROFILE }} \
-PdbVersion=${{ steps.db_profile.outputs.dbVersion }} \
-PsemanticVersion=${{ needs.context.outputs.semanticVersion }} \
-PstopOnTestFailure=true
# - name: SonarQube
# shell: bash
# run: |
# ./gradlew sonarqube -x test --stacktrace \
# -Pprofile=${{ env.PROFILE }} \
# -PsemanticVersion=${{ needs.context.outputs.semanticVersion }} \
# -Dsonar.branch.name=${{ needs.context.outputs.branch }} \
# -Dsonar.login=${{ secrets.OSS_SONARQUBE_TOKEN }} \
# -Dorg.gradle.jvmargs="-Xmx2g -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError"
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
publish:
needs: [ context, build, analysis ]
if: needs.context.outputs.shouldPublish == 'true' || needs.context.outputs.isRelease == 'true'
uses: zero88/shared-ghactions/.github/workflows/gradle-publish.yml@main
with:
profile: 'jooqx'
version: ${{ needs.context.outputs.version }}
semanticVersion: ${{ needs.context.outputs.semanticVersion }}
hashVersion: ${{ needs.context.outputs.commitId }}
isRelease: ${{ needs.context.outputs.isRelease }}
secrets:
ossrhUser: ${{ secrets.OSS_SONATYPE_USER }}
ossrhToken: ${{ secrets.OSS_SONATYPE_PASSWORD }}
gpgKey: ${{ secrets.CI_GPG_PRIVATE_KEY }}
gpgPassphrase: ${{ secrets.CI_GPG_PASSPHARSE }}
docs:
uses: zero88/shared-ghactions/.github/workflows/antora-docs.yml@main
needs: [ context, build ]
with:
profile: 'jooqx'
version: ${{ needs.context.outputs.version }}
semanticVersion: ${{ needs.context.outputs.semanticVersion }}
hashVersion: ${{ needs.context.outputs.commitId }}
sha: ${{ needs.context.outputs.sha }}
isRelease: ${{ needs.context.outputs.isRelease }}
antoraCommand: ':integtest:pg:generateJooq antoraDoc'
antoraBuildDir: 'docs/build/docs/antora'
syncDoc: ${{ needs.context.outputs.shouldPublish == 'true' || needs.context.outputs.isRelease == 'true' }}
docBranch: ${{ needs.context.outputs.docBranch }}
docVersion: ${{ needs.context.outputs.docVersion }}
docCommitMsg: ${{ needs.context.outputs.docCommitMsg }}
docCommitGPGSign: 'false'
secrets:
githubToken: ${{ secrets.OSS_GITHUB_TOKEN }}
gpgKey: ${{ secrets.CI_GPG_PRIVATE_KEY }}
gpgPassphrase: ${{ secrets.CI_GPG_PASSPHARSE }}
webdocs:
uses: zero88/shared-ghactions/.github/workflows/webdocs-communal-publish.yml@main
needs: [ context, docs ]
if: needs.context.outputs.shouldPublish == 'true' || needs.context.outputs.isRelease == 'true'
with:
docCommitMsg: ${{ needs.context.outputs.docCommitMsg }}
secrets:
githubToken: ${{ secrets.OSS_GITHUB_TOKEN }}
release:
runs-on: ubuntu-latest
needs: [ context, publish, docs ]
if: needs.context.outputs.isRelease == 'true'
steps:
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
name: Release ${{ env.PROFILE }} ${{ needs.context.outputs.version }}
tag_name: ${{ needs.context.outputs.branch }}
generate_release_notes: true