Merge pull request #423 from parsingdata/dependabot/maven/minor-updat… #225
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
# General workflow to build Metal | |
name: Metal build | |
on: push | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
strategy: | |
matrix: | |
distribution: [ temurin, corretto ] | |
java-version: [ 17, 21 ] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
# Fetch all history for Sonar analysis | |
fetch-depth: 0 | |
- name: Set up Cache | |
uses: actions/cache@v4 | |
with: | |
path: ~/.m2/repository | |
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
restore-keys: | | |
${{ runner.os }}-maven- | |
- name: Set up JDK | |
uses: actions/setup-java@v4 | |
with: | |
java-version: ${{ matrix.java-version }} | |
distribution: ${{ matrix.distribution }} | |
- name: Build with Maven and analyze with Sonar | |
# Analyze only the Corretto 17 build with Sonar | |
if: matrix.distribution == 'corretto' && matrix.java-version == '17' | |
env: | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
# The value of sonar.projectKey is generated by Sonar and needs to map to its internal project name | |
run: mvn -B --update-snapshots -Dmaven.test.failure.ignore=true package org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=parsingdata_metal -Dsonar.organization=parsingdata | |
- name: Deploy with Maven | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
if: matrix.distribution == 'corretto' && matrix.java-version == '17' | |
run: mvn -B --update-snapshots -Dmaven.test.failure.ignore=true deploy | |
- name: Build with Maven | |
if: matrix.distribution != 'corretto' || matrix.java-version != '17' | |
run: mvn -B --update-snapshots -Dmaven.test.failure.ignore=true package | |
- name: Upload Code Coverage to Codecov | |
# Upload test coverage results only from the Corretto 11 build | |
if: matrix.distribution == 'corretto' && matrix.java-version == '17' | |
uses: codecov/codecov-action@v4 |