Fix ci #101
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: test and docker | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
# Build and test the applications with multiple Java versions | |
build-and-test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
java-version: [ | |
'11.0.x', | |
'16.0.x', | |
'17.0.x', | |
'18.0.x', | |
] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: JDK Set up | |
uses: actions/setup-java@v3 | |
with: | |
java-version: ${{ matrix.java-version }} | |
architecture: x64 | |
distribution: 'temurin' | |
cache: 'maven' | |
- name: Package privacydashboard | |
run: mvn clean package -Pproduction | |
- name: Coverage Report | |
run: mvn jacoco:report | |
- name: Generate Jacoco Badge | |
id: jacoco | |
if: ${{ matrix.java-version == '18.0.x' }} | |
uses: cicirello/jacoco-badge-generator@v2 | |
with: | |
jacoco-csv-file: target/site/jacoco/jacoco.csv | |
- name: Log coverage percentage | |
if: ${{ matrix.java-version == '18.0.x' }} | |
run: | | |
echo "coverage = ${{ steps.jacoco.outputs.coverage }}" | |
- name: Move the badge to jacoco-aggregate folder | |
if: ${{ matrix.java-version == '18.0.x' }} | |
run: | | |
mv .github/badges/*.svg target/site/jacoco/ | |
- name: Deploy Jacoco code coverage reports to gh-pages | |
uses: JamesIves/github-pages-deploy-action@v4 | |
if: ${{ matrix.java-version == '18.0.x' }} | |
with: | |
clean: true | |
folder: target/site/jacoco | |
target-folder: reports | |
branch: gh-pages | |
# Build files necessary for building Docker Images (Dockerfiles and Contexts) | |
build-for-docker: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-java@v3 | |
with: | |
java-version: "18.0.x" | |
architecture: x64 | |
distribution: 'temurin' | |
cache: 'maven' | |
# Build multiarch Docker Images and push as GitHub Packages | |
docker-image-push: | |
if: ${{ github.repository == 'sifis-home/privacydashboard' }} | |
needs: [build-and-test, build-for-docker] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to GitHub container registry (ghcr.io) | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push image | |
uses: docker/build-push-action@v4 | |
with: | |
platforms: linux/amd64, linux/arm64 | |
push: true | |
tags: ghcr.io/sifis-home/privacydashboard:latest | |
outputs: type=registry, annotation-index.org.opencontainers.image.description=PrivacyDashboard |