Skip to content

Commit 2516304

Browse files
committed
ci(workflows): adopt GitHub-hosted runner
1 parent fad1c24 commit 2516304

File tree

1 file changed

+53
-13
lines changed

1 file changed

+53
-13
lines changed

.github/workflows/coverage.yml

Lines changed: 53 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,54 @@ on:
1111
jobs:
1212
codecov:
1313
name: codecov
14-
runs-on: ubuntu-24.04-8core-amd64
14+
runs-on: ubuntu-latest
1515
permissions:
1616
contents: read
1717
pull-requests: write
18-
services:
19-
postgres:
20-
image: postgres
21-
env:
22-
POSTGRES_PASSWORD: password
23-
options: >-
24-
--health-cmd pg_isready
25-
--health-interval 10s
26-
--health-timeout 5s
27-
--health-retries 5
28-
ports:
29-
- 5432:5432
3018
steps:
19+
# Tests can fail due to insufficient disk space, so we optimize the disk
20+
# usage.
21+
- name: Maximize build space
22+
uses: easimon/maximize-build-space@master
23+
with:
24+
root-reserve-mb: 10240
25+
remove-dotnet: "true"
26+
remove-android: "true"
27+
remove-haskell: "true"
28+
remove-codeql: "true"
29+
remove-docker-images: "true"
30+
build-mount-path: "/var/lib/docker"
31+
32+
- name: Restart docker
33+
run: sudo service docker restart
34+
3135
- uses: actions/checkout@v4
3236
with:
3337
token: ${{ secrets.GITHUB_TOKEN }}
3438

39+
# Start PostgreSQL as a container after disk optimization
40+
- name: Start PostgreSQL
41+
run: |
42+
docker run -d \
43+
--name postgres \
44+
-e POSTGRES_USER=postgres \
45+
-e POSTGRES_PASSWORD=password \
46+
-e POSTGRES_DB=pipeline_test \
47+
-p 5432:5432 \
48+
--health-cmd="pg_isready -U postgres" \
49+
--health-interval=10s \
50+
--health-timeout=5s \
51+
--health-retries=5 \
52+
postgres:15
53+
54+
# Wait for PostgreSQL to be healthy
55+
echo "Waiting for PostgreSQL to be ready..."
56+
while [ "$(docker inspect --format='{{.State.Health.Status}}' postgres)" != "healthy" ]; do
57+
echo "Waiting for PostgreSQL health check..."
58+
sleep 2
59+
done
60+
echo "PostgreSQL is ready!"
61+
3562
- name: Load .env file
3663
uses: cardinalby/export-env-action@v2
3764
with:
@@ -94,6 +121,12 @@ jobs:
94121
type=gha,mode=max,scope=model-artifacts
95122
96123
- name: Generate coverage report
124+
env:
125+
CFG_DATABASE_HOST: localhost
126+
CFG_DATABASE_NAME: pipeline_test
127+
CFG_DATABASE_USERNAME: postgres
128+
CFG_DATABASE_PASSWORD: password
129+
CFG_DATABASE_PORT: 5432
97130
run: |
98131
make coverage DBTEST=true OCR=true ONNX=true
99132
@@ -103,3 +136,10 @@ jobs:
103136
file: ./coverage.out
104137
flags: unittests
105138
name: codecov-umbrella
139+
140+
# Cleanup PostgreSQL container
141+
- name: Cleanup PostgreSQL
142+
if: always()
143+
run: |
144+
docker stop postgres || true
145+
docker rm postgres || true

0 commit comments

Comments
 (0)