Skip to content

Database Integration Tests #1435

Database Integration Tests

Database Integration Tests #1435

name: Database Integration Tests
on:
workflow_dispatch:
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/[email protected]
with:
java-version: 8
- id: install-graphviz
name: Install Graphviz
uses: sualeh/[email protected]
# 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-slim-faststart
dbproject="${{ matrix.database }}"
elif [ "${{ matrix.database }}" == "sqlserver" ]; then
docker pull mcr.microsoft.com/mssql/server:2019-CU9-ubuntu-18.04
dbproject="${{ matrix.database }}"
elif [ "${{ matrix.database }}" == "db2" ]; then
docker pull ibmcom/db2:11.5.7.0
dbproject="${{ matrix.database }}"
elif [ "${{ matrix.database }}" == "postgresql" ]; then
docker pull postgres:12.16-alpine
docker pull postgres:15.4-alpine
dbproject="${{ matrix.database }}"
elif [ "${{ matrix.database }}" == "mysql" ]; then
docker pull mysql:8.0.31
dbproject="${{ matrix.database }}"
elif [ "${{ matrix.database }}" == "mariadb" ]; then
docker pull mariadb:10.7.3
dbproject="dbtest"
elif [ "${{ matrix.database }}" == "cassandra" ]; then
docker pull cassandra:4.1.0
dbproject="dbtest"
elif [ "${{ matrix.database }}" == "cockroachdb" ]; then
docker pull cockroachdb/cockroach:v19.2.12
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:421
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
# Save expected results files
.github/scripts/unit-tests-results-output.sh
- id: upload-unit-tests-results-output
name: Upload expected results files
uses: actions/upload-artifact@v4
if: always()
with:
name: unit-tests-results-output
path: ./unit-tests-results-output.zip
retention-days: 5