Spotless #194
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: CI | |
on: | |
push: | |
branches: | |
- zkbesu | |
pull_request: | |
branches: | |
- zkbesu | |
jobs: | |
build_and_test: | |
runs-on: ubuntu-22.04-16core | |
env: | |
architecture: "amd64" | |
GRADLE_OPTS: "-Xmx6g -Dorg.gradle.parallel=true -Dorg.gradle.workers.max=4" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: 17 | |
distribution: 'adopt' | |
- name: Cache Gradle dependencies | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/gradle/versions.gradle') }}-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-gradle-${{ hashFiles('**/gradle/versions.gradle') }} | |
${{ runner.os }}-gradle- | |
- name: Spotless | |
run: ./gradlew clean spotlessCheck | |
- name: Test & Build | |
run: ./gradlew build | |
- name: Test Report | |
uses: dorny/test-reporter@v1 | |
if: success() || failure() # run this step even if previous step failed | |
with: | |
name: JUnit Tests # Name of the check run which will be created | |
path: '**/test-results/test/*.xml' # Path to test results | |
reporter: java-junit # Format of test results | |
only-summary: true | |
max-annotations: 50 | |
publish: | |
needs: build_and_test | |
if: github.event_name != 'pull_request' | |
runs-on: ubuntu-22.04-16core | |
env: | |
architecture: "amd64" | |
GRADLE_OPTS: "-Xmx6g -Dorg.gradle.parallel=true -Dorg.gradle.workers.max=4" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: 17 | |
distribution: 'adopt' | |
- name: Publish Java artifacts | |
run: ./gradlew publish | |
env: | |
CLOUDSMITH_USER: ${{ secrets.CLOUDSMITH_USER }} | |
CLOUDSMITH_API_KEY: ${{ secrets.CLOUDSMITH_API_KEY }} | |
- name: Publish distribution artifacts | |
run: | | |
sudo apt update | |
sudo apt install -y python3 python3-pip python3-venv | |
./gradlew cloudsmithUpload | |
env: | |
CLOUDSMITH_USER: ${{ secrets.CLOUDSMITH_USER }} | |
CLOUDSMITH_API_KEY: ${{ secrets.CLOUDSMITH_API_KEY }} | |
- name: Check Dockerfile syntax | |
run: | | |
docker run --rm -i hadolint/hadolint < docker/Dockerfile | |
- name: Build Docker Image | |
run: | | |
./gradlew dockerDist | |
- name: Login to Docker Hub for self hosted | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USER_RW }} | |
password: ${{ secrets.DOCKER_PAT_RW }} | |
- name: Publish Docker Image | |
run: | | |
./gradlew dockerUpload |