Skip to content

Build - pull_request #930

Build - pull_request

Build - pull_request #930

Workflow file for this run

# Build and Test
#
# Description:
# Builds the project and runs unit tests for every supported Java version.
#
# Triggers:
# - pull_request: when a PR targets main
# - push: when code is pushed to main
#
# Notes:
# Builds against Java 17, 21, and 25.
name: Build
run-name: Build - ${{ github.event_name }}
on:
workflow_dispatch:
pull_request:
branches:
- main
paths:
- '.github/workflows/build.yml'
- 'sdk/**'
- 'sdk-testing/**'
- 'sdk-integration-tests/**'
- 'examples/**'
- 'pom.xml'
push:
branches:
- main
paths:
- '.github/workflows/build.yml'
- 'sdk/**'
- 'sdk-testing/**'
- 'sdk-integration-tests/**'
- 'examples/**'
- 'pom.xml'
permissions:
contents: read
pages: write
id-token: write
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
java:
- 17
- 21
- 25
steps:
- name: Checkout repository
uses: actions/checkout@v7
- name: Setup Java ${{ matrix.java }}
uses: actions/setup-java@v5
with:
distribution: corretto
java-version: ${{ matrix.java }}
cache: maven
- name: Build and test
run: mvn -B install --file pom.xml
- name: Generate JaCoCo Badge
if: ${{ matrix.java == 17 }}
uses: cicirello/jacoco-badge-generator@72266185b7ee48a6fd74eaf0238395cc8b14fef8 # v2
with:
jacoco-csv-file: coverage-report/target/site/jacoco-aggregate/jacoco.csv
badges-directory: coverage-report/target/site/jacoco-aggregate
- name: Generate javadoc site
if: ${{ matrix.java == 17 }}
run: mvn -B -pl sdk -am javadoc:javadoc
- name: Configure GitHub Pages
if: ${{ matrix.java == 17 }}
uses: actions/configure-pages@v5
- name: Prepare GitHub Pages artifact
if: ${{ matrix.java == 17 }}
run: |
mkdir -p github-pages/coverage github-pages/javadoc
cp -R coverage-report/target/site/jacoco-aggregate/. github-pages/coverage
cp -R sdk/target/site/apidocs/. github-pages/javadoc
touch github-pages/.nojekyll
- name: Upload GitHub Pages artifact
if: ${{ matrix.java == 17 }}
uses: actions/upload-pages-artifact@v4
with:
path: github-pages
deploy-pages:
if: ${{ github.ref == 'refs/heads/main' }}
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy GitHub Pages
id: deployment
uses: actions/deploy-pages@v4