Skip to content

GitHub project folder update (QA standard) #6

GitHub project folder update (QA standard)

GitHub project folder update (QA standard) #6

Workflow file for this run

# Copyright 2024 ABSA Group Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
name: CI Scala
on:
pull_request:
jobs:
test:
name: Test
runs-on: ubuntu-22.04
env:
overall: 0.0
changed: 80.0
defaults:
run:
working-directory: bigfiles
strategy:
matrix:
include:
- scala: 2.12.17
scalaShort: "2.12"
- scala: 2.11.12
scalaShort: "2.11"
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Setup Scala
uses: olafurpg/setup-scala@v14
with:
java-version: "[email protected]"
- name: Build and run tests
continue-on-error: true
id: jacocorun
run: sbt ++${{ matrix.scala }} jacoco
- name: Add coverage to PR
if: steps.jacocorun.outcome == 'success'
id: jacoco-coverage
uses: madrapps/[email protected]
with:
paths: ${{ github.workspace }}/bigfiles/target/scala-${{ matrix.scalaShort }}/jacoco/report/jacoco.xml
token: ${{ secrets.GITHUB_TOKEN }}
min-coverage-overall: ${{ env.overall }}
min-coverage-changed-files: ${{ env.changed }}
title: JaCoCo code coverage report - scala ${{ matrix.scala }}
update-comment: true
- name: Get the Coverage info
run: |
echo "Total coverage ${{ steps.jacoco-coverage.outputs.coverage-overall }}"
echo "Changed Files coverage ${{ steps.jacoco-coverage.outputs.coverage-changed-files }}"
- name: Fail PR if changed files coverage is less than ${{ env.changed }}%
if: ${{ steps.jacoco-coverage.outputs.coverage-changed-files < 80.0 }}
uses: actions/github-script@v6
with:
script: |
core.setFailed('Changed files coverage is less than ${{ env.changed }}%!')
format-check:
name: Format Check
runs-on: ubuntu-latest
defaults:
run:
working-directory: bigfiles
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
persist-credentials: false
fetch-depth: 0
ref: ${{ github.event.pull_request.head.ref }}
- name: Setup Scala
uses: olafurpg/setup-scala@v14
with:
java-version: "[email protected]"
- name: Run scalafmt And Print Diff
continue-on-error: false
run: sbt scalafmt scalafmtSbt && git diff --exit-code