Skip to content

Commit 781b26a

Browse files
authored
Merge pull request #2033 from MIT-LCP/alistair/action_fixes
fix pathing by switching to `$GITHUB_WORKSPACE` in the actions
2 parents 872eefd + 9974818 commit 781b26a

5 files changed

Lines changed: 27 additions & 26 deletions

File tree

.github/actions/load-mimic-duckdb/action.yml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,26 @@ description: "Builds a DuckDB database from the demo hosp/icu data using import_
33

44
inputs:
55
mimic_data_dir:
6-
description: "Directory containing the hosp/ and icu/ demo data folders."
6+
description: "Directory containing the hosp/ and icu/ demo data folders. Defaults to $GITHUB_WORKSPACE."
77
required: false
8-
default: ${{ github.workspace }}
8+
default: ""
99
db_file:
10-
description: "Path to the DuckDB database file to create."
10+
description: "Path to the DuckDB database file to create. Defaults to $GITHUB_WORKSPACE/mimic4.db."
1111
required: false
12-
default: ${{ github.workspace }}/mimic4.db
12+
default: ""
1313

1414
runs:
1515
using: "composite"
1616
steps:
1717
- name: Build DuckDB database
1818
shell: bash
19-
# `echo n` answers the overwrite prompt defensively
19+
# Resolve paths at shell time so $GITHUB_WORKSPACE points at the
20+
# container-mounted path.
21+
# `echo n` answers the overwrite prompt defensively.
2022
run: |
23+
data_dir="${{ inputs.mimic_data_dir }}"
24+
data_dir="${data_dir:-$GITHUB_WORKSPACE}"
25+
db_file="${{ inputs.db_file }}"
26+
db_file="${db_file:-$GITHUB_WORKSPACE/mimic4.db}"
2127
cd "$GITHUB_WORKSPACE/mimic-iv/buildmimic/duckdb"
22-
echo n | ./import_duckdb.sh "${{ inputs.mimic_data_dir }}" "${{ inputs.db_file }}"
28+
echo n | ./import_duckdb.sh "$data_dir" "$db_file"

.github/actions/load-mimic-psql/action.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,21 @@ description: "Creates the MIMIC-IV schemas and loads the demo hosp/icu data. Req
33

44
inputs:
55
mimic_data_dir:
6-
description: "Directory containing the hosp/ and icu/ demo data folders."
6+
description: "Directory containing the hosp/ and icu/ demo data folders. Defaults to $GITHUB_WORKSPACE."
77
required: false
8-
default: ${{ github.workspace }}
8+
default: ""
99

1010
runs:
1111
using: "composite"
1212
steps:
1313
- name: Create schemas and load demo data
1414
shell: bash
15+
# Resolve the data dir at shell time so $GITHUB_WORKSPACE points at the
16+
# container-mounted path. The github.workspace context yields the host
17+
# path, which does not exist inside a container job.
1518
run: |
19+
data_dir="${{ inputs.mimic_data_dir }}"
20+
data_dir="${data_dir:-$GITHUB_WORKSPACE}"
1621
psql -q -v ON_ERROR_STOP=1 -f "$GITHUB_WORKSPACE/mimic-iv/buildmimic/postgres/create.sql"
17-
psql -q -v ON_ERROR_STOP=1 -v mimic_data_dir="${{ inputs.mimic_data_dir }}" \
22+
psql -q -v ON_ERROR_STOP=1 -v mimic_data_dir="$data_dir" \
1823
-f "$GITHUB_WORKSPACE/mimic-iv/buildmimic/postgres/load_gz.sql"

.github/workflows/build-duckdb.yml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@ name: build duckdb
44
on:
55
workflow_call:
66

7-
env:
8-
DUCKDB_FILE: ${{ github.workspace }}/mimic4.db
9-
107
jobs:
118
build:
129
runs-on: ubuntu-latest
@@ -25,13 +22,11 @@ jobs:
2522
- uses: ./.github/actions/download-demo
2623

2724
- uses: ./.github/actions/load-mimic-duckdb
28-
with:
29-
db_file: ${{ env.DUCKDB_FILE }}
3025

3126
- name: Validate row counts
3227
# validate_demo.sql is in postgres folder but also works for duckdb
3328
run: |
34-
duckdb -csv "$DUCKDB_FILE" < mimic-iv/buildmimic/postgres/validate_demo.sql | tee results
29+
duckdb -csv "$GITHUB_WORKSPACE/mimic4.db" < mimic-iv/buildmimic/postgres/validate_demo.sql | tee results
3530
if grep -F -q "FAILED" results; then
3631
echo "::error::DuckDB demo row-count validation failed:"
3732
grep "FAILED" results

.github/workflows/concepts-duckdb.yml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ name: concepts duckdb
55
on:
66
workflow_call:
77

8-
env:
9-
DUCKDB_FILE: ${{ github.workspace }}/mimic4.db
10-
118
jobs:
129
build:
1310
runs-on: ubuntu-latest
@@ -27,12 +24,10 @@ jobs:
2724
- uses: ./.github/actions/download-demo
2825

2926
- uses: ./.github/actions/load-mimic-duckdb
30-
with:
31-
db_file: ${{ env.DUCKDB_FILE }}
3227

3328
- name: Create derived schema
3429
run: |
35-
duckdb "$DUCKDB_FILE" -c "CREATE SCHEMA IF NOT EXISTS mimiciv_derived;"
30+
duckdb "$GITHUB_WORKSPACE/mimic4.db" -c "CREATE SCHEMA IF NOT EXISTS mimiciv_derived;"
3631
3732
- uses: ./.github/actions/transpile-concepts
3833
with:
@@ -41,9 +36,9 @@ jobs:
4136
- name: Build concepts
4237
working-directory: ./mimic-iv/concepts_duckdb
4338
run: |
44-
duckdb "$DUCKDB_FILE" -c ".read duckdb.sql"
39+
duckdb "$GITHUB_WORKSPACE/mimic4.db" -c ".read duckdb.sql"
4540
4641
- uses: actions/upload-artifact@v4
4742
with:
4843
name: duckdb-db
49-
path: ${{ env.DUCKDB_FILE }}
44+
path: mimic4.db

.github/workflows/equivalence.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ on:
77
env:
88
# Tables with known cross-engine differences
99
IGNORE_TABLES: "first_day_gcs,suspicion_of_infection,oxygen_delivery,bg,first_day_bg,first_day_bg_art,kdigo_uo,kdigo_stages,urine_output_rate"
10-
DUCKDB_FILE: ${{ github.workspace }}/mimic4.db
1110

1211
jobs:
1312
diff:
@@ -49,10 +48,11 @@ jobs:
4948
name: psql-derived
5049

5150
- name: Download DuckDB database
51+
# No path: defaults to the working directory ($GITHUB_WORKSPACE inside
52+
# the container), placing mimic4.db at $GITHUB_WORKSPACE/mimic4.db.
5253
uses: actions/download-artifact@v4
5354
with:
5455
name: duckdb-db
55-
path: ${{ github.workspace }}
5656

5757
- name: Restore PostgreSQL derived schema
5858
run: |
@@ -62,5 +62,5 @@ jobs:
6262
run: |
6363
mimic_utils compare_concepts \
6464
--pg "host=$PGHOST dbname=$PGDATABASE user=$PGUSER" \
65-
--duckdb "$DUCKDB_FILE" \
65+
--duckdb "$GITHUB_WORKSPACE/mimic4.db" \
6666
--ignore "$IGNORE_TABLES"

0 commit comments

Comments
 (0)