Continuous Integration #1807
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 workflow will build a Java project with Gradle | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle | |
name: Continuous Integration | |
on: | |
push: | |
branches: '*' | |
pull_request: | |
branches: [ main ] | |
schedule: | |
- cron: "0 7 * * *" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
java: [ 11, 17 ] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK ${{ matrix.java }} | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'zulu' | |
java-version: ${{ matrix.java }} | |
- name: Cache Gradle Home files | |
uses: actions/cache@v4.0.2 | |
continue-on-error: true | |
with: | |
path: ~/.gradle/caches | |
key: ${{ runner.os }}-gradle-home-examples-${{matrix.gradle_args}}_check-${{ hashFiles('**/*.gradle') }} | |
- name: Grant execute permission for gradlew | |
run: chmod +x gradlew | |
- name: Build with Gradle | |
run: ./gradlew build jacocoTestReport | |
- name: Upload to Sonatype | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && matrix.java == '11' | |
run: | | |
echo "${{ secrets.MAVEN_GPG_PRIVATE_KEY }}" > ~/.gradle/secring.gpg.b64 | |
base64 -d ~/.gradle/secring.gpg.b64 > ~/.gradle/secring.gpg | |
./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository -PsonatypeUsername=${SONATYPE_USERNAME} -PsonatypePassword=${SONATYPE_PASSWORD} -Psigning.keyId=${GPG_KEYID} -Psigning.secretKeyRingFile=$(echo ~/.gradle/secring.gpg) -Psigning.password=${GPG_PASSWORD} | |
env: | |
GPG_KEYID: ${{ secrets.MAVEN_GPG_KEYID }} | |
GPG_PASSWORD: ${{ secrets.MAVEN_GPG_PASSPHRASE }} | |
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} | |
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} | |
- name: Upload coverate to CodeClimate | |
uses: paambaati/codeclimate-action@v5.0.0 | |
env: | |
CC_TEST_REPORTER_ID: 9c22853d2ecf28aec51c1b578072031a3a655790cffb9fecfed6101920e5446c | |
JACOCO_SOURCE_PATH: "${{github.workspace}}/src/main/java" | |
with: | |
coverageLocations: ${{github.workspace}}/build/reports/jacoco/test/jacocoTestReport.xml:jacoco |