|
| 1 | +# |
| 2 | +# Copyright 2025 Aiven Oy and project contributors |
| 3 | +# |
| 4 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | +# you may not use this file except in compliance with the License. |
| 6 | +# You may obtain a copy of the License at |
| 7 | +# |
| 8 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | +# |
| 10 | +# Unless required by applicable law or agreed to in writing, |
| 11 | +# software distributed under the License is distributed on an |
| 12 | +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 13 | +# KIND, either express or implied. See the License for the |
| 14 | +# specific language governing permissions and limitations |
| 15 | +# under the License. |
| 16 | +# |
| 17 | +# SPDX-License-Identifier: Apache-2 |
| 18 | + |
| 19 | +# Workflow to check pull requests main branches |
| 20 | +# This checks the source in the state as if after the merge. |
| 21 | +name: Pull request checks |
| 22 | +on: |
| 23 | + workflow_dispatch: |
| 24 | + pull_request: |
| 25 | + branches: [ main ] |
| 26 | + |
| 27 | +permissions: |
| 28 | + contents: read |
| 29 | + |
| 30 | +# Disallow concurrent runs for the same PR by cancelling in-progress runs |
| 31 | +# when new commits are pushed |
| 32 | +concurrency: |
| 33 | + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} |
| 34 | + cancel-in-progress: true |
| 35 | + |
| 36 | +jobs: |
| 37 | + |
| 38 | + build: |
| 39 | + name: Check release conditions |
| 40 | + runs-on: ubuntu-latest |
| 41 | + |
| 42 | + steps: |
| 43 | + - name: Checkout code |
| 44 | + uses: actions/checkout@v6 |
| 45 | + |
| 46 | + - name: Configure artifact caching |
| 47 | + uses: actions/cache@v5 |
| 48 | + with: |
| 49 | + path: ~/.m2/repository |
| 50 | + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} |
| 51 | + restore-keys: | |
| 52 | + ${{ runner.os }}-maven- |
| 53 | + |
| 54 | + - name: Extract version info |
| 55 | + run: | |
| 56 | + echo "version=$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec)" >> $GITHUB_OUTPUT; |
| 57 | + echo "java_version=$(mvn -q -Dexec.executable=echo -Dexec.args='${jdk.version}' --non-recursive exec:exec)" >> $GITHUB_OUTPUT; |
| 58 | + id: project |
| 59 | + |
| 60 | + - name: Set up JDK ${{ steps.project.outputs.java_version }} |
| 61 | + uses: actions/setup-java@v5 |
| 62 | + with: |
| 63 | + distribution: 'adopt' |
| 64 | + java-version: ${{ matrix.java }} |
| 65 | + cache: 'maven' |
| 66 | + |
| 67 | + - name: Check ${{ steps.project.outputs.version }} |
| 68 | + run: mvn -P pre-release-check -e -B -V -ntp clean verify |
| 69 | + |
| 70 | + - name: "Upload build failure reports" |
| 71 | + uses: actions/upload-artifact@v4 |
| 72 | + if: failure() |
| 73 | + with: |
| 74 | + name: unit-test-results-${{ matrix.java }}-JDK |
| 75 | + path: | |
| 76 | + **/target/*-reports/** |
| 77 | + retention-days: 1 |
| 78 | + |
| 79 | + |
0 commit comments