Database Integration Tests #1786
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: Database Integration Tests | |
on: | |
workflow_dispatch: | |
inputs: | |
java_version: | |
description: 'Java version' | |
required: true | |
type: choice | |
options: | |
- 8 | |
- 21 | |
push: | |
pull_request: | |
branches: | |
- main | |
schedule: | |
- cron: '21 21 * * *' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
permissions: read-all | |
jobs: | |
build: | |
name: Database Integration Tests | |
strategy: | |
fail-fast: false | |
matrix: | |
database: | |
- oracle | |
- sqlserver | |
- postgresql | |
- mysql | |
- db2 | |
- mariadb | |
- cassandra | |
- cockroachdb | |
- firebird | |
- informix | |
- trino | |
runs-on: ubuntu-latest | |
steps: | |
# SETUP BUILD ENVIRONMENT | |
- id: maximize-build-space | |
name: Maximize build space | |
uses: easimon/maximize-build-space@master | |
with: | |
root-reserve-mb: '8192' | |
remove-dotnet: 'true' | |
remove-android: 'true' | |
remove-haskell: 'true' | |
remove-codeql: 'true' | |
remove-docker-images: 'true' | |
- id: restart-docker | |
name: Restart Docker | |
shell: bash | |
run: | | |
# Restart Docker to take into account additional disk space | |
# https://stackoverflow.com/a/71113148/100856 | |
sudo systemctl stop docker | |
sudo rm -rf /var/lib/docker | |
sudo systemctl start docker | |
echo "Docker used space:" | |
sudo du -sh /var/lib/docker | |
echo "Available storage:" | |
df -h | |
- id: prepare-maven-build | |
name: Prepare Maven build | |
uses: sualeh/prepare-maven-build@v1.4.0 | |
with: | |
java-version: ${{ github.event.inputs.java_version || '8' }} | |
- id: install-graphviz | |
name: Install Graphviz | |
uses: sualeh/install-graphviz@v1.0.3 | |
# RUN DATABASE TESTS | |
- id: build-test-databases | |
name: Build and run database tests | |
shell: bash | |
run: | | |
# Build | |
echo "Building code" | |
echo "Downloading Docker image" | |
if [ "${{ matrix.database }}" == "oracle" ]; then | |
docker pull gvenzl/oracle-free:23.5-slim-faststart | |
dbproject="${{ matrix.database }}" | |
elif [ "${{ matrix.database }}" == "sqlserver" ]; then | |
docker pull mcr.microsoft.com/mssql/server:2022-CU9-ubuntu-20.04 | |
dbproject="${{ matrix.database }}" | |
elif [ "${{ matrix.database }}" == "db2" ]; then | |
docker pull icr.io/db2_community/db2:11.5.9.0 | |
dbproject="${{ matrix.database }}" | |
elif [ "${{ matrix.database }}" == "postgresql" ]; then | |
docker pull postgres:11.16-alpine | |
docker pull postgres:16.4-bookworm | |
dbproject="${{ matrix.database }}" | |
elif [ "${{ matrix.database }}" == "mysql" ]; then | |
docker pull mysql:9.1.0 | |
dbproject="${{ matrix.database }}" | |
elif [ "${{ matrix.database }}" == "mariadb" ]; then | |
docker pull mariadb:11.6.2-noble | |
dbproject="dbtest" | |
elif [ "${{ matrix.database }}" == "cassandra" ]; then | |
docker pull cassandra:5.0.2 | |
dbproject="dbtest" | |
elif [ "${{ matrix.database }}" == "cockroachdb" ]; then | |
docker pull cockroachdb/cockroach:v20.2.9 | |
dbproject="dbtest" | |
elif [ "${{ matrix.database }}" == "firebird" ]; then | |
docker pull jacobalberty/firebird:v4.0.2 | |
dbproject="dbtest" | |
elif [ "${{ matrix.database }}" == "informix" ]; then | |
docker pull ibmcom/informix-developer-database:14.10.FC7W1DE | |
dbproject="dbtest" | |
elif [ "${{ matrix.database }}" == "trino" ]; then | |
docker pull trinodb/trino:468 | |
dbproject="dbtest" | |
else | |
dbproject="dbtest" | |
fi | |
echo "dbproject=$dbproject" | |
mvn \ | |
--no-transfer-progress \ | |
--batch-mode \ | |
-D${{ matrix.database }} \ | |
--projects schemacrawler-dbtest,schemacrawler-$dbproject \ | |
--also-make \ | |
clean package | |
- id: gather-expected-results | |
name: Gather expected results for failed tests | |
if: always() | |
shell: bash | |
run: | | |
# Gather expected results | |
echo "Gather expected results" | |
# DEBUG | |
echo "Current working directory:" | |
pwd | |
echo "Show expected results directories:" | |
find . -type d -name "unit_tests_results_output" -exec echo {} \; | |
# Save expected results files | |
echo "Zip expected results:" | |
.github/scripts/unit-tests-results-output.sh $(realpath .) | |
- id: upload-unit-tests-results-output | |
name: Upload expected results files | |
uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: expected-results-${{ matrix.database }} | |
path: ./unit_tests_results_output.zip | |
retention-days: 5 |