All Downloads are FREE. Search and download functionalities are using the official Maven repository.

templates..github.workflows.ci-build-native-build.yml Maven / Gradle / Ivy

# Generated by Project Keeper
# https://github.com/exasol/project-keeper/blob/main/project-keeper/src/main/resources/templates/.github/workflows/ci-build-native-build.yml
name: CI Build
on:
  push:
    branches:
      - main
  pull_request:
jobs:
  build:
    name: Build native-image on ${{ matrix.os }}
    runs-on: ${{ matrix.os }}
    permissions:
      contents: read
    defaults:
      run:
        shell: "bash"
    strategy:
      fail-fast: false
      matrix:
        os: [macos-latest, windows-latest, ubuntu-latest]
    concurrency:
      group: ${{ github.workflow }}-${{ matrix.os }}-${{ github.ref }}
      cancel-in-progress: true
    steps:
      - name: Free Disk Space
        id: free-disk-space
        run: |
          sudo rm -rf /usr/local/lib/android
          sudo rm -rf /usr/share/dotnet
      - name: Checkout the repository
        id: checkout
        uses: actions/checkout@v4
        with:
          fetch-depth: 0
      - uses: graalvm/setup-graalvm@v1
        with:
          version: "21.2.0"
          java-version: 11
          components: "native-image"
          github-token: ${{ secrets.GITHUB_TOKEN }}
      - name: Enable testcontainer reuse
        run: echo 'testcontainers.reuse.enable=true' > "$HOME/.testcontainers.properties"
      - name: Cache local Maven repository
        uses: actions/cache@v4
        with:
          path: ~/.m2/repository
          key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
          restore-keys: |
            ${{ runner.os }}-maven-
      - name: Run tests and build with Maven
        run: mvn --batch-mode --update-snapshots clean verify --file pom.xml -DtrimStackTrace=false
      - name: Cache SonarCloud packages
        uses: actions/cache@v4
        with:
          path: ~/.sonar/cache
          key: ${{ runner.os }}-sonar
          restore-keys: ${{ runner.os }}-sonar
      - name: Sonar analysis
        id: sonar-analysis
        if: ${{ env.SONAR_TOKEN != null && matrix.os == 'ubuntu-latest' }}
        run: |
          mvn --batch-mode sonar:sonar \
              -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \
              -DtrimStackTrace=false \
              -Dsonar.token=$SONAR_TOKEN
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
      - name: Upload binary
        uses: actions/upload-artifact@v4
        with:
          name: executable-${{ matrix.os }}
          path: target/${{ github.event.repository.name }}
          retention-days: 5




© 2015 - 2025 Weber Informatics LLC | Privacy Policy