Skip to content

Commit fb04f8f

Browse files
committed
ci: add postgres-test job to main workflow
1 parent c84deee commit fb04f8f

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed

.github/workflows/main.yml

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,10 +226,40 @@ jobs:
226226
path: dist/${{ matrix.name == 'apple-xcframework' && 'CloudSync.*' || 'cloudsync.*'}}
227227
if-no-files-found: error
228228

229+
postgres-test:
230+
runs-on: ubuntu-22.04
231+
name: postgresql build + test
232+
timeout-minutes: 10
233+
234+
steps:
235+
236+
- uses: actions/checkout@v4.2.2
237+
238+
- name: build and start postgresql container
239+
run: make postgres-docker-rebuild
240+
241+
- name: wait for postgresql to be ready
242+
run: |
243+
for i in $(seq 1 30); do
244+
if docker exec cloudsync-postgres pg_isready -U postgres > /dev/null 2>&1; then
245+
echo "PostgreSQL is ready"
246+
exit 0
247+
fi
248+
sleep 2
249+
done
250+
echo "PostgreSQL failed to start within 60s"
251+
docker logs cloudsync-postgres
252+
exit 1
253+
254+
- name: run postgresql tests
255+
run: |
256+
docker cp test/postgresql cloudsync-postgres:/tmp/cloudsync/test/postgresql
257+
docker exec cloudsync-postgres psql -U postgres -d postgres -f /tmp/cloudsync/test/postgresql/full_test.sql
258+
229259
release:
230260
runs-on: ubuntu-22.04
231261
name: release
232-
needs: build
262+
needs: [build, postgres-test]
233263
if: github.ref == 'refs/heads/main'
234264

235265
env:

0 commit comments

Comments
 (0)