Github Action - Create Release and Deploy #301
This file contains hidden or 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: | |
| pull_request: | |
| branches: [develop] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| scala: [ 2.11, 2.12 ] | |
| spark: [ 2, 3 ] | |
| exclude: | |
| - scala: 2.11 | |
| spark: 3 | |
| name: Scala ${{ matrix.scala }}, Spark ${{ matrix.spark }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| persist-credentials: false | |
| - name: Set up JDK 1.8 | |
| uses: actions/setup-java@v2 | |
| with: | |
| distribution: 'adopt' | |
| java-version: 8 | |
| - uses: actions/cache@v4 | |
| with: | |
| path: ~/.m2/repository | |
| key: ${{ runner.os }}-${{ matrix.scala }}-${{ matrix.spark }}-${{ hashFiles('**/pom.xml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-${{ matrix.scala }}-${{ matrix.spark }}- | |
| - name: Install Maven 3.8.4 | |
| run: mvn -N wrapper:wrapper -Dmaven=3.8.4 | |
| - name: License check | |
| run: ./mvnw clean validate --no-transfer-progress -Plicense-check,spark-2,spark-3,scala-2.12 | |
| - name: Switch scala version | |
| run: ./mvnw scala-cross-build:change-version --no-transfer-progress -Pscala-${{ matrix.scala }},spark-${{ matrix.spark }} | |
| - name: Build and run tests | |
| run: ./mvnw clean verify --no-transfer-progress -Pscala-${{ matrix.scala }},spark-${{ matrix.spark }},all-tests,no-upgraded-snappy,code-coverage | |
| - name: Add coverage to PR | |
| id: jacoco | |
| uses: madrapps/[email protected] | |
| with: | |
| paths: > | |
| ${{ github.workspace }}/api/target/site/jacoco/jacoco.xml, | |
| ${{ github.workspace }}/compatibility-provider/target/site/jacoco/jacoco.xml, | |
| ${{ github.workspace }}/compatibility_spark-${{ matrix.spark }}/target/site/jacoco/jacoco.xml, | |
| ${{ github.workspace }}/component-scanner/target/site/jacoco/jacoco.xml, | |
| ${{ github.workspace }}/driver/target/site/jacoco/jacoco.xml, | |
| ${{ github.workspace }}/ingestor-default/target/site/jacoco/jacoco.xml, | |
| ${{ github.workspace }}/shared/target/site/jacoco/jacoco.xml | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| min-coverage-overall: 0.0 | |
| min-coverage-changed-files: 80.0 | |
| title: JaCoCo code coverage report - Scala ${{ matrix.scala }} & Spark ${{ matrix.spark }} | |
| update-comment: true | |
| - name: Get the Coverage info | |
| run: | | |
| echo "Total coverage ${{ steps.jacoco.outputs.coverage-overall }}" | |
| echo "Changed Files coverage ${{ steps.jacoco.outputs.coverage-changed-files }}" | |
| - name: Fail PR if changed files coverage is less than 80% | |
| if: ${{ steps.jacoco.outputs.coverage-changed-files < 80.0 }} | |
| uses: actions/github-script@v6 | |
| with: | |
| script: | | |
| core.setFailed('Changed files coverage is less than 80%!') |