AI Feature #1052
Workflow file for this run
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: backend | |
on: | |
pull_request: | |
paths: | |
- '.github/workflows/backend.yaml' | |
- 'backend/**' | |
- '!**.md' | |
workflow_dispatch: | |
env: | |
JAVA_VERSION: 17 | |
jobs: | |
formatting: | |
name: Formatting | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
if: github.event_name != 'pull_request' | |
uses: actions/checkout@v3 | |
- name: Checkout | |
if: github.event_name == 'pull_request' | |
uses: actions/checkout@v3 | |
with: | |
repository: ${{ github.event.pull_request.head.repo.full_name }} | |
ref: ${{ github.event.pull_request.head.ref }} | |
- name: Format | |
if: (github.event.pull_request.head.repo.full_name == github.repository) && (github.actor != 'dependabot[bot]') | |
uses: axel-op/googlejavaformat-action@v3 | |
with: | |
args: "--skip-sorting-imports --replace" | |
# Recommended if you use MacOS: | |
# githubToken: ${{ secrets.GITHUB_TOKEN }} | |
- name: Format | |
if: github.event.pull_request.head.repo.full_name != github.repository | |
uses: axel-op/googlejavaformat-action@v3 | |
with: | |
skip-commit: true | |
args: "--skip-sorting-imports --replace" | |
# Recommended if you use MacOS: | |
# githubToken: ${{ secrets.GITHUB_TOKEN }} | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up JDK ${{ env.JAVA_VERSION }} | |
uses: actions/setup-java@v3 | |
with: | |
java-version: ${{ env.JAVA_VERSION }} | |
distribution: 'adopt' | |
- name: Package server | |
uses: gradle/gradle-build-action@v2 | |
with: | |
arguments: assemble | |
build-root-directory: backend | |
- name: Upload artifacts | |
if: github.event.pull_request.head.repo.full_name == github.repository | |
uses: actions/upload-artifact@v2 | |
with: | |
name: backend | |
path: backend/build | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
permissions: | |
checks: write | |
contents: read | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up JDK ${{ env.JAVA_VERSION }} | |
uses: actions/setup-java@v3 | |
with: | |
java-version: ${{ env.JAVA_VERSION }} | |
distribution: 'adopt' | |
- name: Run unit tests | |
uses: gradle/gradle-build-action@v2 | |
with: | |
arguments: test | |
build-root-directory: backend | |
- name: Publish Test Report | |
if: github.event.pull_request.head.repo.full_name == github.repository | |
uses: scacap/action-surefire-report@v1 | |
with: | |
report_paths: '**/build/test-results/test/TEST-*.xml' | |
- name: Log coverage percentage | |
run: | | |
echo "coverage = ${{ steps.jacoco.outputs.coverage }}" | |
echo "branch coverage = ${{ steps.jacoco.outputs.branches }}" | |
- name: Upload JaCoCo coverage report | |
if: github.event.pull_request.head.repo.full_name == github.repository | |
uses: actions/upload-artifact@v2 | |
with: | |
name: jacoco-report | |
path: backend/build/jacoco-report/ |