deployment setup #7
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
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle | |
# Build a quarkus native executable | |
name: Test and Build | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main", "develop" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- uses: actions/checkout@v4 | |
name: Checkout badges repo | |
if: github.event.name != 'pull_request' | |
with: | |
ref: badges | |
path: badges | |
- name: Run gradle test | |
run: ./gradlew test | |
- name: Run gradle build | |
if: github.event.pull_request.base.ref == 'main' | |
run: ./gradlew build -x test | |
- name: Generate JaCoCo Badge | |
if: github.event_name != 'pull_request' | |
id: jacoco | |
uses: cicirello/jacoco-badge-generator@v2 | |
with: | |
jacoco-csv-file: build/jacoco-report/jacoco.csv | |
badges-directory: badges | |
- name: Log coverage percentages to workflow output | |
if: github.event_name != 'pull_request' | |
run: | | |
echo "coverage = ${{ steps.jacoco.outputs.coverage }}" | |
echo "branches = ${{ steps.jacoco.outputs.branches }}" | |
- name: Upload JaCoCo coverage report | |
if: github.event_name != 'pull_request' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: jacoco-report | |
path: build/jacoco-report/ | |
- name: Commit and push badge to 'badges' branch if required | |
if: github.event_name != 'pull_request' | |
run: | | |
cd badges | |
if [[ `git status --porcelain` ]]; then | |
git config --global user.name 'release-workflow' | |
git config --global user.email '55439476@users.noreply.github.com' | |
git add *.svg | |
git commit -m "Autogenerated JaCoCo coverage badge" | |
git push | |
fi | |
dependency-submission: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
# Generates and submits a dependency graph, enabling Dependabot Alerts for all project dependencies. | |
# See: https://github.com/gradle/actions/blob/main/dependency-submission/README.md | |
- name: Generate and submit dependency graph | |
uses: gradle/actions/dependency-submission@417ae3ccd767c252f5661f1ace9f835f9654f2b5 # v3.1.0 |