@@ -98,27 +98,50 @@ jobs:
9898 username : ${{ secrets.CGR_USERNAME }}
9999 password : ${{ secrets.CGR_PASSWORD }}
100100
101- - name : Init database
102- run : make init_db
103- working-directory : coprocessor/fhevm-engine/tfhe-worker
104-
105101 - name : Use Node.js
106102 uses : actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
107103 with :
108104 node-version : 20.x
109105
110- - name : Start localstack
106+ - name : Start database services (background)
111107 run : |
112- docker run --rm -d -p 4566:4566 --name localstack localstack/localstack:4.14.0
108+ nohup docker compose up -d --build db-migration > /tmp/db-init.log 2>&1 &
109+ working-directory : coprocessor/fhevm-engine/tfhe-worker
110+
111+ - name : Start localstack
112+ run : docker run --rm -d -p 4566:4566 --name localstack localstack/localstack:4.14.0
113113
114114 - name : Clean previous coverage data
115115 run : cargo llvm-cov clean --workspace --profile coverage
116116 working-directory : coprocessor/fhevm-engine
117117
118+ - name : Compile tests with coverage instrumentation
119+ run : |
120+ DATABASE_URL=postgresql://postgres:postgres@localhost:5432/coprocessor \
121+ SQLX_OFFLINE=true \
122+ cargo llvm-cov --no-run --no-report --workspace --profile coverage
123+ working-directory : coprocessor/fhevm-engine
124+
125+ - name : Wait for database migration
126+ run : |
127+ while ! docker container inspect db-migration > /dev/null 2>&1; do
128+ echo "Waiting for db-migration container to be created..."
129+ sleep 2
130+ done
131+ EXIT_CODE=$(docker wait db-migration)
132+ if [ "$EXIT_CODE" != "0" ]; then
133+ echo "Database migration failed with exit code $EXIT_CODE"
134+ docker logs db-migration
135+ cat /tmp/db-init.log
136+ exit 1
137+ fi
138+ echo "Database migration completed"
139+
118140 - name : Run tests with coverage
119141 run : |
120142 DATABASE_URL=postgresql://postgres:postgres@localhost:5432/coprocessor \
121143 TEST_GLOBAL_LOCALSTACK=1 \
144+ SQLX_OFFLINE=true \
122145 cargo llvm-cov --no-report --workspace --profile coverage
123146 working-directory : coprocessor/fhevm-engine
124147
0 commit comments