Separate jobs for modules #192
Workflow file for this run
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: test-all | |
on: | |
push: | |
branches-ignore: | |
- 'dependabot/**' #avoid duplicates: only run the PR, not the commit | |
- 'gh-pages' #github pages do not trigger all tests | |
tags-ignore: | |
- 'v*' #avoid rerun existing commit on release | |
pull_request: | |
branches: | |
- 'main' | |
env: | |
TEST_CASSANDRA_PWD: ${RANDOM}${RANDOM}${RANDOM} | |
jobs: | |
test-transform: | |
runs-on: ubuntu-latest | |
#if: ${{ false }} # disable for now | |
#avoids duplicate execution of pr from local repo, but allows pr from forked repos and dependabot | |
if: (github.event_name != 'pull_request' && ! github.event.pull_request.head.repo.fork) || (github.event_name == 'pull_request' && (github.event.pull_request.head.repo.fork || startsWith(github.head_ref, 'dependabot/'))) | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
cache: 'maven' | |
- name: Test transform module and aggregate surefire report | |
run: mvn test -Daggregate=true -Dtest=* -pl modevo-transform -am -Dmaven.test.failure.ignore=true -U --no-transfer-progress | |
- name: Additional aggregated junit report | |
uses: javiertuya/junit-report-action@v1 | |
with: | |
surefire-files: "**/target/surefire-reports/TEST-*.xml" | |
report-dir: target/site | |
- name: Generate report checks | |
if: always() | |
uses: mikepenz/[email protected] | |
with: | |
check_name: "test-result" | |
report_paths: "**/surefire-reports/TEST-*.xml" | |
fail_on_failure: 'true' | |
- if: always() | |
name: Publish test report files | |
uses: actions/upload-artifact@v4 | |
with: | |
name: "test-report-files" | |
path: | | |
target/site | |
**/target/site/jacoco/jacoco.xml | |
**/target/surefire-reports | |
test-script: | |
runs-on: ubuntu-latest | |
#if: ${{ false }} # disable for now | |
#avoids duplicate execution of pr from local repo, but allows pr from forked repos and dependabot | |
if: (github.event_name != 'pull_request' && ! github.event.pull_request.head.repo.fork) || (github.event_name == 'pull_request' && (github.event.pull_request.head.repo.fork || startsWith(github.head_ref, 'dependabot/'))) | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
cache: 'maven' | |
# Starts the DBMS containers when applicable | |
- name: Launch Cassandra | |
run: | | |
docker run --name test-cassandra -d -p 9042:9042 \ | |
-v ${GITHUB_WORKSPACE}/modevo-script/dat/inp/creationSchema.cql:/creationSchema.cql \ | |
cassandra:3.11 | |
chmod u+x setup/wait-container-ready.sh && ./setup/wait-container-ready.sh test-cassandra 1 "Created default superuser role" | |
docker exec test-cassandra cqlsh localhost 9042 -u cassandra -p cassandra -f creationSchema.cql | |
- name: Test and aggregate surefire report | |
run: mvn test -Daggregate=true -Dtest=* -pl modevo-script -am -Dmaven.test.failure.ignore=true -U --no-transfer-progress | |
- name: Additional aggregated junit report | |
uses: javiertuya/junit-report-action@v1 | |
with: | |
surefire-files: "**/target/surefire-reports/TEST-*.xml" | |
report-dir: target/site | |
- name: Generate report checks | |
if: always() | |
uses: mikepenz/[email protected] | |
with: | |
check_name: "test-result" | |
report_paths: "**/surefire-reports/TEST-*.xml" | |
fail_on_failure: 'true' | |
- if: always() | |
name: Publish test report files | |
uses: actions/upload-artifact@v4 | |
with: | |
name: "test-report-files" | |
path: | | |
target/site | |
**/target/site/jacoco/jacoco.xml | |
**/target/surefire-reports | |
sonarqube: | |
needs: [test-transform, test-script] | |
#if: ${{ false }} # disable for now | |
#This job fails when comming from a dependabot PR (can't read the sonarqube token for security reasons). | |
#Links to discussions and workaround at: https://github.com/giis-uniovi/samples-giis-template/issues/4 | |
if: ${{ github.actor != 'dependabot[bot]' }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: javiertuya/[email protected] | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
sonar-token: ${{ secrets.SONAR_TOKEN }} | |
restore-artifact-name1: "test-report-files" | |
publish-java-snapshot: | |
if: ${{ false }} # disable for now | |
#avoid publishing PRs and dependabot branches | |
#if: ${{ github.event_name != 'pull_request' && !startsWith(github.ref, 'refs/heads/dependabot/') && !startsWith(github.ref, 'refs/heads/dashgit/combined/') }} | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- uses: javiertuya/[email protected] | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
java-version: '17' | |
mvn-deploy-args: '-P publish-github -DskipTests=true -Dmaven.test.failure.ignore=false -U --no-transfer-progress' | |
delete-old-snapshots: true | |
min-snapshots-to-keep: 2 | |
always-keep-regex: "\\d*\\.\\d*\\.\\d*-main-SNAPSHOT$" |