Combined dependency updates (2024-10-12) #700
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_POSTGRES_PWD: ${RANDOM}${RANDOM}${RANDOM} | |
#sqlserver must comply with password requirements (upper, lower, digit, symbol) | |
TEST_SQLSERVER_PWD: ${RANDOM}Ax.${RANDOM}${RANDOM} | |
TEST_ORACLE_PWD: ${RANDOM}${RANDOM}${RANDOM} | |
TEST_SQLITE_PWD: "" | |
#At the moment, Cassandra uses the default settings | |
TEST_CASSANDRA_PWD: "cassandra" | |
jobs: | |
test-java: | |
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/'))) | |
strategy: | |
matrix: | |
scope: [Core, Postgres, Sqlserver, Oracle, Cassandra] | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: '11' | |
cache: 'maven' | |
# Starts the DBMS containers when applicable | |
- name: Launch Postgres | |
if: ${{ matrix.scope == 'Postgres' }} | |
run: | | |
docker run -d -p 5432:5432 --name test-postgres --restart unless-stopped \ | |
-e POSTGRES_PASSWORD="$TEST_POSTGRES_PWD" \ | |
-e TEST_POSTGRES_PWD="$TEST_POSTGRES_PWD" \ | |
-v ${GITHUB_WORKSPACE}/setup/postgres:/docker-entrypoint-initdb.d \ | |
postgres:14 | |
chmod u+x setup/wait-container-ready.sh && ./setup/wait-container-ready.sh test-postgres "END SETUP!" | |
- name: Launch Sqlserver | |
if: ${{ matrix.scope == 'Sqlserver' }} | |
run: | | |
docker stop test-sqlserver && docker rm test-sqlserver | |
docker run -d -p 1433:1433 --name test-sqlserver --restart unless-stopped \ | |
-e SA_PASSWORD="$TEST_SQLSERVER_PWD" \ | |
-e TEST_SQLSERVER_PWD="$TEST_SQLSERVER_PWD" \ | |
-e "ACCEPT_EULA=Y" -e "MSSQL_PID=Developer" \ | |
-v ${GITHUB_WORKSPACE}/setup/sqlserver:/setup.d \ | |
mcr.microsoft.com/mssql/server:2019-latest | |
chmod u+x setup/wait-container-ready.sh && ./setup/wait-container-ready.sh test-sqlserver "SQL Server is now ready for client connections" | |
# SQLServer does not have an on startup script, run it now | |
docker exec --user root test-sqlserver bash -c "chmod u+x setup.d/sqlserver-setup.sh && ./setup.d/sqlserver-setup.sh" | |
- name: Launch Oracle | |
if: ${{ matrix.scope == 'Oracle' }} | |
run: | | |
docker run -d -p 1521:1521 --name test-oracle --restart unless-stopped \ | |
-e ORACLE_PASSWORD=$TEST_ORACLE_PWD \ | |
-e TEST_ORACLE_PWD="$TEST_ORACLE_PWD" \ | |
-v ${GITHUB_WORKSPACE}/setup/oracle:/container-entrypoint-initdb.d \ | |
gvenzl/oracle-xe:21.3.0-slim | |
chmod u+x setup/wait-container-ready.sh && ./setup/wait-container-ready.sh test-oracle "DATABASE IS READY TO USE!" | |
- name: Launch Cassandra | |
if: ${{ matrix.scope == 'Cassandra' }} | |
# Uses the default parameters to run container, except that disables gossip protocol to faster startup | |
run: | | |
docker run -d -p 9042:9042 --name test-cassandra --restart unless-stopped \ | |
-v ${GITHUB_WORKSPACE}/setup/cassandra/cassandra-setup.cql:/cassandra-setup.cql \ | |
-e JVM_OPTS="-Dcassandra.skip_wait_for_gossip_to_settle=0 -Dcassandra.initial_token=0" \ | |
cassandra:4.1 | |
chmod u+x setup/wait-container-ready.sh && ./setup/wait-container-ready.sh test-cassandra "Created default superuser role 'cassandra'" | |
docker exec test-cassandra bash -c "cqlsh localhost 9042 -u cassandra -p $TEST_CASSANDRA_PWD -f /cassandra-setup.cql" | |
# Run the tests, a step for those that use a DBMS, other for core | |
- name: Test and aggregate surefire report - ${{ matrix.scope }} | |
if: ${{ matrix.scope == 'Core' }} | |
run: > | |
mvn test surefire-report:report -Daggregate=true | |
-Dtest=!TestPostgres*,!TestSqlserver*,!TestOracle*,!TestCassandra* | |
-Dmaven.test.failure.ignore=true -U --no-transfer-progress | |
- name: Test and aggregate surefire report - ${{ matrix.scope }} | |
if: ${{ matrix.scope != 'Core' }} | |
run: > | |
mvn test surefire-report:report -Daggregate=true | |
-Dtest=Test${{ matrix.scope }}* -pl tdrules-client-rdb,tdrules-store-rdb,tdrules-store-loader -am -Dsurefire.failIfNoSpecifiedTests=false | |
-Dmaven.test.failure.ignore=true -U --no-transfer-progress | |
-Duser.timezone=Europe/Madrid | |
# NOTE: must specify a timezone to avoid oracle error ORA-01882: timezone region not found | |
- name: Additional aggregated junit report | |
if: always() | |
uses: javiertuya/[email protected] | |
with: | |
surefire-files: "**/target/surefire-reports/TEST-*.xml" | |
report-dir: target/site | |
report-title: "Test Report: ${{ matrix.scope }} - Branch: ${{ github.ref_name }}" | |
- name: Generate report checks | |
if: always() | |
uses: mikepenz/[email protected] | |
with: | |
check_name: "test-result-${{ matrix.scope }}" | |
report_paths: "**/surefire-reports/TEST-*.xml" | |
fail_on_failure: 'true' | |
- if: always() | |
name: Set unique jacoco.xml file names for each scope | |
#if not sonarqube will overwrite al jacoco files generated for the same module but different scopes | |
run: | | |
for file in */target/site/jacoco/jacoco.xml ; do mv $file ${file//jacoco.xml/jacoco-${{ matrix.scope }}.xml} ; done | |
ls -la */target/site/jacoco/*.xml | |
- name: Publish test report files | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: "test-report-files-${{ matrix.scope }}" | |
path: | | |
target/site | |
**/target/site/jacoco/jacoco*.xml | |
**/target/surefire-reports | |
**/target/*.html | |
**/target/*.log | |
test-net: | |
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/'))) | |
defaults: | |
run: | |
working-directory: net | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/[email protected] | |
with: | |
dotnet-version: '8.0.x' | |
- name: Launch Sqlserver | |
run: | | |
docker stop test-sqlserver && docker rm test-sqlserver | |
docker run -d -p 1433:1433 --name test-sqlserver --restart unless-stopped \ | |
-e SA_PASSWORD="$TEST_SQLSERVER_PWD" \ | |
-e TEST_SQLSERVER_PWD="$TEST_SQLSERVER_PWD" \ | |
-e "ACCEPT_EULA=Y" -e "MSSQL_PID=Developer" \ | |
-v ${GITHUB_WORKSPACE}/setup/sqlserver:/setup.d \ | |
mcr.microsoft.com/mssql/server:2019-latest | |
chmod u+x ../setup/wait-container-ready.sh && ../setup/wait-container-ready.sh test-sqlserver "SQL Server is now ready for client connections" | |
# SQLServer does not have an on startup script, run it now | |
docker exec --user root test-sqlserver bash -c "chmod u+x setup.d/sqlserver-setup.sh && ./setup.d/sqlserver-setup.sh" | |
- name: Run test | |
run: dotnet test --logger "trx;LogFileName=../../reports/tdrules-report.trx" TdRulesTest/TdRulesTest.csproj | |
- name: Junit html report | |
if: always() | |
uses: javiertuya/[email protected] | |
with: | |
net-trx-report: "net/reports/tdrules-report.trx" | |
net-surefire-folder: "net/target/surefire-reports" | |
surefire-files: "net/target/surefire-reports/TEST-*.xml" | |
report-dir: net/target/site | |
report-title: "Test Report: Net - Branch: ${{ github.ref_name }}" | |
- name: Generate report checks | |
if: always() | |
uses: mikepenz/[email protected] | |
with: | |
check_name: "test-result-Net" | |
report_paths: "net/surefire-reports/TEST-*.xml" | |
fail_on_failure: 'true' | |
- name: Publish test report files | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: "test-report-files-Net" | |
path: | | |
net/target/site | |
net/target/surefire-reports | |
net/reports/tdrules-report.trx | |
net/reports/*.html | |
net/reports/*.log | |
# As a last step, checks that conversion works to detect potential incompatible changes in the java side. | |
# Note that updates on the java side are still made in the develop environment and pushed. | |
- name: Validate Sharpen Conversion - Prepare Java envrionment | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: '11' | |
cache: 'maven' | |
- name: Validate Sharpen Conversion - Preprocess | |
if: always() | |
run: | | |
mvn -f ../pom.xml install -DskipTests=true -Dmaven.javadoc.skip=true -pl tdrules-model | |
mvn -f ../pom.xml generate-sources -am | |
ant clean sharpen.preprocess | |
- name: Validate Sharpen Conversion - Sharpen | |
uses: javiertuya/[email protected] | |
with: | |
working-dir: net | |
project-dir: sharpen-temp/java | |
sharpen-args: '@sharpen-all-options.txt' | |
- name: Validate Sharpen Conversion - Postprocess | |
if: always() | |
run: | | |
ls -la sharpen-temp/sharpen-temp.net | |
sudo chown -R $(id -u):$(id -g) sharpen-temp/sharpen-temp.net | |
ant sharpen.postprocess sharpen.openapi | |
dotnet build | |
test-report: | |
needs: [test-java, test-net] | |
#if: ${{ false }} # disable for now | |
#avoid publishing to Github pages PRs and dependabot branches | |
if: ${{ always() && github.event_name != 'pull_request' && !contains('/head/refs/dependabot/', github.ref) && !contains('/head/refs/dashgit/combined/', github.ref) }} | |
runs-on: ubuntu-latest | |
# Configuration to deploy at github pages | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
concurrency: | |
group: "pages" | |
cancel-in-progress: true | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
steps: | |
# Downloads java test report files | |
- uses: actions/[email protected] | |
if: always() | |
with: | |
name: "test-report-files-Core" | |
- uses: actions/[email protected] | |
if: always() | |
with: | |
name: "test-report-files-Postgres" | |
- uses: actions/[email protected] | |
if: always() | |
with: | |
name: "test-report-files-Sqlserver" | |
- uses: actions/[email protected] | |
if: always() | |
with: | |
name: "test-report-files-Oracle" | |
- uses: actions/[email protected] | |
if: always() | |
with: | |
name: "test-report-files-Cassandra" | |
# Net reports were zipped under a different root, specifies the path. | |
# Modifies the namespaces to allow differentiate from the java test results | |
- uses: actions/[email protected] | |
if: always() | |
with: | |
name: "test-report-files-Net" | |
path: "net" | |
- if: always() | |
run: sed -i 's/Test4giis/Test4NET/g' net/target/surefire-reports/* | |
# Generates and uploads the html reports and the individual surefire reports for further reference | |
- name: Aggregated junit html report | |
if: always() | |
uses: javiertuya/[email protected] | |
with: | |
surefire-files: "**/target/surefire-reports/TEST-*.xml" | |
report-dir: target-ALL/site | |
report-title: "Test Report: ALL - Branch: ${{ github.ref_name }} - Run #${{ github.run_number }}" | |
- name: Index file to html reports | |
run: | | |
echo "<html><head><title>Latest Test Reports</title></head><body>" > target-ALL/site/index.html | |
echo "<h2>Latest Test Reports - Branch: ${{ github.ref_name }} - Run #${{ github.run_number }}</h2>" >> target-ALL/site/index.html | |
echo "<p><a href=\"junit-noframes/junit-noframes.html\">Single page reports</a></p>" >> target-ALL/site/index.html | |
echo "<p><a href=\"junit-frames/index.html\">Multiple page reports with frames</a></p>" >> target-ALL/site/index.html | |
echo "</body></html>" >> target-ALL/site/index.html | |
- if: always() | |
name: Publish test report files | |
uses: actions/upload-artifact@v4 | |
with: | |
name: "test-report-ALL" | |
path: | | |
target-ALL/site | |
**/target/surefire-reports | |
**/target/*.html | |
**/target/*.log | |
**/reports/*.html | |
**/reports/*.log | |
# Deploy to GitHub Pages | |
# Some files (e.g. junit reports) have 600 permissions. | |
# As of [email protected], permissions must be set explicitly | |
# to 0755 (as indicated in warnings produced by v1.0.8) | |
- name: Fix permissions to actions/[email protected] | |
run: sudo chmod -c -R 0755 target-ALL/site | |
- name: Upload artifact | |
if: always() | |
uses: actions/[email protected] | |
with: | |
path: 'target-ALL/site' | |
- name: Deploy to GitHub Pages | |
if: always() | |
id: deployment | |
uses: actions/[email protected] | |
sonarqube: | |
needs: [test-java] | |
#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-Core" | |
restore-artifact-name2: "test-report-files-Sqlserver" | |
restore-artifact-name3: "test-report-files-Postgres" | |
restore-artifact-name4: "test-report-files-Oracle" | |
restore-artifact-name5: "test-report-files-Cassandra" | |
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: '11' | |
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: 4 | |
always-keep-regex: "\\d*\\.\\d*\\.\\d*-main-SNAPSHOT$" |