Fixing test cases. #366
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
--- | |
name: build | |
# description: Builds, tests and publishes artifacts to sonatype snapshots | |
on: | |
push: | |
branches: | |
- 'main' | |
- '**-SNAPSHOT' | |
paths-ignore: | |
- 'README.adoc' | |
- 'docs/**' | |
- '.github/workflows/publish-documentation.yml' | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
MAVEN_OPTS: -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn | |
steps: | |
- name: Cancel previous Action | |
uses: styfle/cancel-workflow-action@0.12.1 | |
- uses: actions/checkout@v4 | |
with: | |
# Use personal token for the commit at the end. otherwise publish-documentation action is not triggered | |
token: ${{ secrets.PERSONAL_GITHUB_TOKEN }} | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: 17 | |
cache: maven | |
server-id: ossrh | |
server-username: OSSRH_USERNAME | |
server-password: OSSRH_PASSWORD | |
gpg-private-key: ${{ secrets.GPG_SECRET_KEY }} | |
gpg-passphrase: GPG_SECRET_KEY_PASSPHRASE | |
- name: Build with Maven | |
run: | | |
mvn -ntp -Dmaven.test.failure.ignore=true | |
- name: Check test results | |
run: | | |
# fail the build if failures | |
find . -regex '.*/surefire-reports/.*txt' | xargs sed -n 's/^Tests run: \([0-9]*\), Failures: \([0-9]*\), Errors: \([0-9]*\).*in \(.*\)/\1 \2 \3 \4/p' | awk '$2 + $3 > 0 {print "::error file="$4 "::failures: " $2 "\terrors: " $3 "\t" $4}' | tee report.txt | |
# number of lines is exit code | |
exit $(cat report.txt | wc -l) | |
- name: Publish Unit Test Results | |
uses: EnricoMi/publish-unit-test-result-action@v2.17.1 | |
if: always() | |
with: | |
files: "**/target/surefire-reports/*.xml" | |
check_name: Tests results | |
- uses: codecov/codecov-action@v4 | |
if: ${{ ! cancelled()}} | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} # required | |
- name: Deploy with Maven | |
run: mvn -B -Ddeploy -DskipTests=true deploy | |
if: ${{ github.event_name == 'push' && ! cancelled()}} | |
env: | |
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} | |
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} | |
GPG_SECRET_KEY_PASSPHRASE: ${{ secrets.GPG_SECRET_KEY_PASSPHRASE }} | |
- name: Commit generated dot file if it changed | |
uses: EndBug/add-and-commit@v9 | |
with: | |
message: Automated update of dot.m4 | |
add: docs/algebras.dot.m4 |