Repository navigation
89 lines (77 loc) · 2.92 KB
/
Copy pathdocker-build.yml
File metadata and controls
89 lines (77 loc) · 2.92 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
# Build and run the containerized MIMIC-IV builds against the demo dataset.
name: docker build
on:
pull_request:
paths:
- 'mimic-iv/buildmimic/postgres/**'
- 'mimic-iv/buildmimic/duckdb/**'
- 'mimic-iv/buildmimic/download_data.sh'
- '.github/workflows/docker-build.yml'
push:
branches:
- main
paths:
- 'mimic-iv/buildmimic/postgres/**'
- 'mimic-iv/buildmimic/duckdb/**'
- '.github/workflows/docker-build.yml'
# Cancel superseded runs when a PR is pushed again.
concurrency:
group: docker-build-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
defaults:
run:
# Name bash explicitly to get `-eo pipefail`.
shell: bash
env:
DUCKDB_DOCKER: mimic-iv/buildmimic/duckdb/docker
POSTGRES_DOCKER: mimic-iv/buildmimic/postgres/docker
MIMIC_DATA_DIR: ${{ github.workspace }}
MIMIC_OUTPUT_DIR: ${{ github.workspace }}/duckdb-out
steps:
- uses: actions/checkout@v7
- uses: ./.github/actions/download-demo
- uses: ./.github/actions/setup-duckdb
- name: Build both images
run: |
docker compose -f "$DUCKDB_DOCKER/docker-compose.yml" build
docker compose -f "$POSTGRES_DOCKER/docker-compose.yml" build
# --exit-code-from implies --abort-on-container-exit and returns the build
# job's own status, so a failed build fails the step.
- name: Build MIMIC-IV in DuckDB
run: |
mkdir -p "$MIMIC_OUTPUT_DIR"
docker compose -f "$DUCKDB_DOCKER/docker-compose.yml" \
up --exit-code-from mimic-build | tee duckdb.log
if grep -F -q "FAILED" duckdb.log; then
echo "::error::DuckDB container row-count validation failed:"
grep -F "FAILED" duckdb.log
exit 1
fi
- name: Read the built database with the runner's own duckdb
run: |
rows=$(duckdb "$MIMIC_OUTPUT_DIR/mimic4.db" -noheader -list \
-c "SELECT count(*) FROM mimiciv_derived.sepsis3")
echo "mimiciv_derived.sepsis3: ${rows} rows"
if [ -z "${rows}" ] || [ "${rows}" -eq 0 ]; then
echo "::error::The concepts are missing from the container-built database."
exit 1
fi
- name: Build MIMIC-IV in PostgreSQL
run: |
docker compose -f "$POSTGRES_DOCKER/docker-compose.yml" \
up --exit-code-from mimic-build | tee psql.log
if grep -F -q "FAILED" psql.log; then
echo "::error::PostgreSQL container row-count validation failed:"
grep -F "FAILED" psql.log
exit 1
fi
- name: Tear down
if: always()
run: |
docker compose -f "$DUCKDB_DOCKER/docker-compose.yml" down -v || true
docker compose -f "$POSTGRES_DOCKER/docker-compose.yml" down -v || true