Skip to content
This repository was archived by the owner on Jan 1, 2026. It is now read-only.

Commit 13da952

Browse files
author
Vianpyro
committed
Refactor unit tests workflow: streamline SQL file flattening and loading process
1 parent d65070c commit 13da952

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

.github/workflows/unit-tests.yml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -80,17 +80,14 @@ jobs:
8080
run: |
8181
sudo -u "$PG_USER" psql -p "$PGPORT" -d "$PG_DATABASE" -c "CREATE EXTENSION IF NOT EXISTS pgtap;"
8282
83-
- name: Flatten and load schema SQL files
83+
- name: Flatten SQL files
8484
run: |
85-
mkdir flattened-sql
86-
find database -type f -name "*.sql" ! -name "*.session.sql" ! -name "*.test.sql" | while read -r file; do
87-
clean_path="${file#./}"
88-
new_name="${clean_path//\//_}"
89-
cp "$file" "flattened-sql/$new_name"
90-
echo "✅ Copied: $file → flattened-sql/$new_name"
91-
done
85+
chmod +x scripts/flatten-sql.sh
86+
./scripts/flatten-sql.sh database flattened-sql
9287
93-
find flattened-sql -maxdepth 1 -name "*.sql" | while read -r file; do
88+
- name: Load schema and seed data
89+
run: |
90+
find flattened-sql -maxdepth 1 -name "*.sql" | sort | while read -r file; do
9491
echo "➡️ Running $file..."
9592
sudo -u postgres psql -p "$PGPORT" -d "$PG_DATABASE" -f "$file"
9693
done

0 commit comments

Comments
 (0)