-
-
Notifications
You must be signed in to change notification settings - Fork 207
212 lines (204 loc) · 6.88 KB
/
Copy pathdatabase-integration-tests.yml
File metadata and controls
212 lines (204 loc) · 6.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
name: Database Integration Tests
on:
workflow_dispatch:
inputs:
java_version:
description: 'Java version'
required: true
type: choice
options:
- 17
- 25
push:
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
- firebird
- informix
- trino
- clickhouse
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: '6144'
remove-dotnet: 'true'
remove-android: 'true'
remove-haskell: 'true'
remove-codeql: 'true'
remove-docker-images: 'true'
- id: checkout-code
name: Checkout code
uses: actions/checkout@v7
- id: move-m2-to-workspace
name: Move Maven local repository to workspace
shell: bash
run: |
mkdir -p "$GITHUB_WORKSPACE/.m2"
rm -rf "$HOME/.m2"
ln -s "$GITHUB_WORKSPACE/.m2" "$HOME/.m2"
- id: setup-java
name: Set up JDK
uses: actions/setup-java@v5
with:
distribution: temurin
java-version: ${{ github.event.inputs.java_version || '17' }}
cache: maven
- id: install-graphviz
name: Install Graphviz
shell: bash
# Skip apt update — runner image already has a current apt cache,
# and apt update writes large index files to root that trigger ENOSPC
run: sudo apt-get install -y --no-install-recommends graphviz
- id: restart-docker
name: Configure Docker .data-root on workspace volume
shell: bash
run: |
set -euxo pipefail
# Stop Docker
sudo systemctl stop docker
sudo rm -rf /var/lib/docker
# Put Docker storage on the large workspace mount
sudo mkdir -p "$GITHUB_WORKSPACE/.docker-root"
sudo chown root:root "$GITHUB_WORKSPACE/.docker-root"
sudo chmod -R ugo+rwx /home/runner/work/SchemaCrawler/SchemaCrawler/.docker-root || true
# Configure daemon and start Docker
echo "{ \"data-root\": \"$GITHUB_WORKSPACE/.docker-root\" }" | sudo tee /etc/docker/daemon.json
sudo systemctl start docker
# Check configured space
echo "Confirm Docker root directory:"
docker info | grep -E 'Docker Root Dir'
echo "Confirm Docker root free space:"
df -h "$GITHUB_WORKSPACE/.docker-root"
echo "Available storage:"
df -h
# BUILD DEPENDENCIES
- id: build-schemacrawler-core
name: Build SchemaCrawler-Core
uses: sualeh/build-maven-dependency@v1.0.8
with:
repository: schemacrawler/SchemaCrawler-Core
artifact: us.fatehi:schemacrawler:17.11.4
# RUN DATABASE TESTS
- id: pull-images
name: Pull database Docker images
shell: bash
run: |
# Pull database Docker images
echo "Downloading Docker image"
if [ "${{ matrix.database }}" == "oracle" ]; then
docker pull gvenzl/oracle-free:23.9-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:17.6-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.8.5-noble
dbproject="dbtest"
elif [ "${{ matrix.database }}" == "cassandra" ]; then
docker pull cassandra:5.0.2
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:470
dbproject="dbtest"
elif [ "${{ matrix.database }}" == "clickhouse" ]; then
docker pull clickhouse/clickhouse-server:26.2
dbproject="dbtest"
else
dbproject="dbtest"
fi
echo "dbproject=$dbproject"
echo "dbproject=$dbproject" >> "$GITHUB_OUTPUT"
- id: disk-space-after
name: Show disk space
shell: bash
run: |
# Check configured space
docker system df
sudo du -sh "$GITHUB_WORKSPACE/.docker-root" || true
ls -ld "$GITHUB_WORKSPACE/.docker-root"
- id: build-test-databases
name: Build and run database tests
shell: bash
run: |
# Build
dbproject="${{ steps.pull-images.outputs.dbproject }}"
echo "dbproject=$dbproject"
mvn \
--no-transfer-progress \
--batch-mode \
-D${{ matrix.database }} \
-Dreactor.printOrder \
--projects schemacrawler-dbtest,schemacrawler-$dbproject \
--also-make \
clean verify
- id: docker-cleanup
name: Cleanup Docker artifacts
if: always()
run: |
docker stop $(docker ps -q) || true
docker system prune -a --volumes -f
- 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 . \
-path './.docker-root' -prune -o \
-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@v7
if: always()
with:
name: expected-results-${{ matrix.database }}
path: ./unit_tests_results_output.zip
retention-days: 5
if-no-files-found: ignore