-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#126: Bring workflow actions up to date
* unified actions names and filenames * added test filenames check * rewritten JaCoCo report to be more informative * streamlined job steps
- Loading branch information
Showing
9 changed files
with
236 additions
and
123 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
* @benedeki @dk1844 @jakipatryk @lsulak @Zejnilovic | ||
* @benedeki @dk1844 @jakipatryk @lsulak @Zejnilovic @salamonpavel @miroslavpojer |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: Auto Assign Issue to Project | ||
name: Assign Issue to Project | ||
|
||
on: | ||
issues: | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,7 +23,8 @@ on: | |
types: [ assigned, opened, synchronize, reopened, labeled ] | ||
|
||
jobs: | ||
build: | ||
build-test-and-doc: | ||
name: Build, Test and Doc | ||
runs-on: ubuntu-latest | ||
services: | ||
postgres: | ||
|
@@ -42,7 +43,6 @@ jobs: | |
fail-fast: false | ||
matrix: | ||
scala: [2.12.17, 2.13.12] | ||
name: Build and test | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
@@ -52,7 +52,9 @@ jobs: | |
java-version: "[email protected]" | ||
- name: Build and run unit tests | ||
run: sbt ++${{matrix.scala}} test | ||
- name: Generate documentation | ||
run: sbt ++${{matrix.scala}} doc | ||
- name: Prepare testing database | ||
run: sbt flywayMigrate | ||
- name: Build and run integration tests | ||
run: sbt ++${{matrix.scala}} testIT doc | ||
- name: Run integration tests | ||
run: sbt ++${{matrix.scala}} testIT |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: Dependent Issues | ||
name: Dependent Items | ||
|
||
on: | ||
issues: | ||
|
@@ -24,7 +24,8 @@ on: | |
- cron: '0 0 * * *' | ||
|
||
jobs: | ||
check: | ||
dependent-items-check: | ||
name: Dependent Items Check | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: z0al/[email protected] | ||
|
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,157 @@ | ||
# | ||
# Copyright 2022 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: JaCoCo Report | ||
|
||
on: | ||
pull_request: | ||
branches: [ master ] | ||
types: [ opened, edited, synchronize, reopened ] | ||
|
||
env: | ||
scalaLong: 2.13.11 | ||
scalaShort: 2.13 | ||
coverage-overall: 57.0 | ||
coverage-changed-files: 80.0 | ||
check-overall-coverages: true | ||
|
||
jobs: | ||
build-test-and-measure: | ||
name: Build, Test and Measure | ||
runs-on: ubuntu-latest | ||
|
||
services: | ||
postgres: | ||
image: postgres:15 | ||
env: | ||
POSTGRES_PASSWORD: postgres | ||
POSTGRES_DB: movies | ||
options: >- | ||
--health-cmd pg_isready | ||
--health-interval 10s | ||
--health-timeout 5s | ||
--health-retries 5 | ||
ports: | ||
- 5432:5432 | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
- name: Setup Scala | ||
uses: olafurpg/setup-scala@v14 | ||
with: | ||
java-version: "[email protected]" | ||
- name: Prepare testing database | ||
run: sbt flywayMigrate | ||
- name: Build and run tests | ||
continue-on-error: true | ||
id: jacocorun | ||
run: sbt ++${{env.scalaLong}} jacoco | ||
- name: Add coverage to PR (core) | ||
if: steps.jacocorun.outcome == 'success' | ||
id: jacoco-core | ||
uses: madrapps/[email protected] | ||
with: | ||
paths: ${{ github.workspace }}/core/target/scala-${{ env.scalaShort }}/jacoco/report/jacoco.xml | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
min-coverage-overall: ${{ env.coverage-overall }} | ||
min-coverage-changed-files: ${{ env.coverage-changed-files }} | ||
title: JaCoCo `model` module code coverage report - scala ${{ env.scalaLong }} | ||
update-comment: true | ||
- name: Add coverage to PR (doobie) | ||
if: steps.jacocorun.outcome == 'success' | ||
id: jacoco-doobie | ||
uses: madrapps/[email protected] | ||
with: | ||
paths: ${{ github.workspace }}/doobie/target/scala-${{ env.scalaShort }}/jacoco/report/jacoco.xml | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
min-coverage-overall: ${{ env.coverage-overall }} | ||
min-coverage-changed-files: ${{ env.coverage-changed-files }} | ||
title: JaCoCo `agent` module code coverage report - scala ${{ env.scalaLong }} | ||
update-comment: true | ||
- name: Add coverage to PR (slick) | ||
if: steps.jacocorun.outcome == 'success' | ||
id: jacoco-slick | ||
uses: madrapps/[email protected] | ||
with: | ||
paths: ${{ github.workspace }}/slick/target/scala-${{ env.scalaShort }}/jacoco/report/jacoco.xml | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
min-coverage-overall: ${{env.coverage-overall }} | ||
min-coverage-changed-files: ${{ env.coverage-changed-files }} | ||
title: JaCoCo `slick` module code coverage report - scala ${{ env.scalaLong }} | ||
update-comment: true | ||
- name: Get the Coverage info | ||
if: steps.jacocorun.outcome == 'success' | ||
run: | | ||
echo "Total `core` module coverage ${{ steps.jacoco-core.outputs.coverage-overall }}" | ||
echo "Changed Files coverage ${{ steps.jacoco-core.outputs.coverage-changed-files }}" | ||
echo "Total `doobie` module coverage ${{ steps.jacoco-doobie.outputs.coverage-overall }}" | ||
echo "Changed Files coverage ${{ steps.jacoco-doobie.outputs.coverage-changed-files }}" | ||
echo "Total `slick` module coverage ${{ steps.jacoco-slick.outputs.coverage-overall }}" | ||
echo "Changed Files coverage ${{ steps.jacoco-slick.outputs.coverage-changed-files }}" | ||
- name: Fail PR if changed files coverage is less than ${{ env.coverage-changed-files }}% | ||
if: steps.jacocorun.outcome == 'success' | ||
uses: actions/github-script@v6 | ||
with: | ||
script: | | ||
const coverageCheckFailed = | ||
Number('${{ steps.jacoco-core.outputs.coverage-changed-files }}') < Number('${{ env.coverage-changed-files }}') || | ||
Number('${{ steps.jacoco-doobie.outputs.coverage-changed-files }}') < Number('${{ env.coverage-changed-files }}') || | ||
Number('${{ steps.jacoco-slick.outputs.coverage-changed-files }}') < Number('${{ env.coverage-changed-files }}'); | ||
if (coverageCheckFailed) { | ||
core.setFailed('Changed files coverage is less than ${{ env.coverage-changed-files }}%!'); | ||
} | ||
- name: Fail PR if overall files coverage is less than ${{ env.coverage-overall }}% | ||
if: ${{ (steps.jacocorun.outcome == 'success') && (env.check-overall-coverages == 'true') }} | ||
uses: actions/github-script@v6 | ||
with: | ||
script: | | ||
const coverageCheckFailed = | ||
Number('${{ steps.jacoco-core.outputs.coverage-overall }}') < Number('${{ env.coverage-overall }}') || | ||
Number('${{ steps.jacoco-doobie.outputs.coverage-overall }}') < Number('${{ env.coverage-overall }}') || | ||
Number('${{ steps.jacoco-slick.outputs.coverage-overall }}') < Number('${{ env.coverage-overall }}'); | ||
if (coverageCheckFailed) { | ||
core.setFailed('Overall coverage is less than ${{ env.coverage-overall }}%!'); | ||
} | ||
- name: Edit JaCoCo comments on build failure | ||
if: steps.jacocorun.outcome != 'success' | ||
uses: actions/github-script@v6 | ||
with: | ||
script: | | ||
const issue_number = context.issue.number; | ||
const owner = context.repo.owner; | ||
const repo = context.repo.repo; | ||
const jacocoReportRegExp = /^### JaCoCo .* code coverage report .*/; | ||
const comments = await github.rest.issues.listComments({ | ||
owner, | ||
repo, | ||
issue_number, | ||
}); | ||
for (const comment of comments.data) { | ||
const lines = comment.body.split('\n'); | ||
if (lines.length > 0 && jacocoReportRegExp.test(lines[0])) { | ||
await github.rest.issues.updateComment({ | ||
owner, | ||
repo, | ||
comment_id: comment.id, | ||
body: lines[0] + "\n\n### Build Failed", | ||
}); | ||
} | ||
} | ||
core.setFailed('JaCoCo test coverage report generation failed, and related PR comments were updated.'); |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# | ||
# Copyright 2022 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: Test Filenames Check | ||
|
||
on: | ||
pull_request: | ||
branches: [ master ] | ||
types: [ opened, synchronize, reopened ] | ||
|
||
jobs: | ||
test_filenames_check: | ||
name: Test Filenames Check | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Filename Inspector | ||
id: scan-test-files | ||
uses: AbsaOSS/filename-inspector@master | ||
with: | ||
name-patterns: '*UnitTests.*,*IntegrationTests.*' | ||
paths: '**/src/test/scala/**' | ||
report-format: 'console' | ||
excludes: 'slick/src/test/scala/za/co/absa/fadb/slick/Actor.scala,slick/src/test/scala/za/co/absa/fadb/slick/ActorSlickConverter.scala,slick/src/test/scala/za/co/absa/fadb/slick/SlickTest.scala,doobie/src/test/scala/za/co/absa/fadb/doobie/DoobieTest.scala,slick/src/test/scala/za/co/absa/fadb/slick/OptionalActorSlickConverter.scala' | ||
verbose-logging: 'false' | ||
fail-on-violation: 'true' |
Oops, something went wrong.