Bump actions/checkout from 3 to 4 (#365) #310
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: Build | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
jobs: | |
build: | |
strategy: | |
fail-fast: true | |
matrix: | |
java: [11] | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
include: | |
- os: ubuntu-latest | |
java: 17 | |
- os: ubuntu-latest | |
java: 18 | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }}-os-${{ matrix.os }}-java-${{ matrix.java }} | |
cancel-in-progress: true | |
runs-on: ${{ matrix.os }} | |
name: "Build on ${{ matrix.os }} with Java ${{ matrix.java }}" | |
env: | |
DEFAULT_JAVA: 11 | |
DEFAULT_OS: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Fetch all history for all tags and branches | |
run: git fetch --prune --unshallow | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: ${{ matrix.java }} | |
cache: 'maven' | |
- name: Cache SonarQube packages | |
if: ${{ env.DEFAULT_OS == matrix.os && env.DEFAULT_JAVA == matrix.java }} | |
uses: actions/cache@v3 | |
with: | |
path: ~/.sonar/cache | |
key: ${{ runner.os }}-sonar | |
restore-keys: ${{ runner.os }}-sonar | |
- name: Build with Maven | |
run: mvn --errors --batch-mode clean org.jacoco:jacoco-maven-plugin:prepare-agent install | |
env: | |
MAVEN_OPTS: "-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn" | |
- name: Sonar analysis | |
if: ${{ env.DEFAULT_OS == matrix.os && env.DEFAULT_JAVA == matrix.java && env.SONAR_TOKEN != null }} | |
run: | | |
mvn --errors --batch-mode \ | |
-Dsonar.host.url=https://sonarcloud.io \ | |
-Dsonar.organization=itsallcode \ | |
-Dsonar.login=$SONAR_TOKEN \ | |
org.sonarsource.scanner.maven:sonar-maven-plugin:sonar | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
MAVEN_OPTS: "-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn" | |
- name: Archive oft binary | |
uses: actions/upload-artifact@v3 | |
if: ${{ env.DEFAULT_OS == matrix.os && env.DEFAULT_JAVA == matrix.java }} | |
with: | |
name: openfasttrace-binaries | |
path: product/target/openfasttrace-*.jar | |
- name: Run self-trace | |
if: ${{ matrix.os != 'macos-latest' }} | |
run: ./oft-self-trace.sh | |
- name: Upload self-tracing report | |
uses: actions/upload-artifact@v3 | |
if: ${{ env.DEFAULT_OS == matrix.os && env.DEFAULT_JAVA == matrix.java }} | |
with: | |
name: self-tracing-report | |
path: target/self-trace-report.html | |
if-no-files-found: error |