|
53 | 53 | psql -h $POSTGRES_HOST -U postgres -f mimic-iv/buildmimic/postgres/validate_demo.sql > validate_results.txt |
54 | 54 | cat validate_results.txt |
55 | 55 |
|
| 56 | + env: |
| 57 | + # The hostname used to communicate with the PostgreSQL service container |
| 58 | + POSTGRES_HOST: postgres |
| 59 | + PGPASSWORD: postgres |
| 60 | + # The default PostgreSQL port |
| 61 | + POSTGRES_PORT: 5432 |
| 62 | + PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }} |
| 63 | + |
| 64 | + build-mimic-iv-ed-psql: |
| 65 | + # Containers must run in Linux based operating systems |
| 66 | + runs-on: ubuntu-latest |
| 67 | + # Docker Hub image that `container-job` executes in |
| 68 | + container: node:latest |
| 69 | + |
| 70 | + # Service containers to run with `container-job` |
| 71 | + services: |
| 72 | + # Label used to access the service container |
| 73 | + postgres: |
| 74 | + # Docker Hub image |
| 75 | + image: postgres |
| 76 | + # Provide the password for postgres |
| 77 | + env: |
| 78 | + POSTGRES_PASSWORD: postgres |
| 79 | + # Set health checks to wait until postgres has started |
| 80 | + options: >- |
| 81 | + --health-cmd pg_isready |
| 82 | + --health-interval 10s |
| 83 | + --health-timeout 5s |
| 84 | + --health-retries 5 |
| 85 | +
|
| 86 | + steps: |
| 87 | + - name: Check out repository code |
| 88 | + uses: actions/checkout@v3 |
| 89 | + |
| 90 | + - name: Install psql command |
| 91 | + run: | |
| 92 | + apt-get update |
| 93 | + apt-get install --yes --no-install-recommends postgresql-client |
| 94 | +
|
| 95 | + - id: 'auth' |
| 96 | + uses: 'google-github-actions/auth@v0' |
| 97 | + with: |
| 98 | + project_id: ${{ secrets.GCP_PROJECT_ID }} |
| 99 | + credentials_json: ${{ secrets.GCP_SA_KEY }} |
| 100 | + |
| 101 | + - name: 'Set up Cloud SDK' |
| 102 | + uses: 'google-github-actions/setup-gcloud@v0' |
| 103 | + |
| 104 | + - name: Download demo and create tables on PostgreSQL |
| 105 | + run: | |
| 106 | + echo "Downloading MIMIC-IV demo from GCP." |
| 107 | + gsutil -q -u $PROJECT_ID -m cp -r gs://mimic-iv-archive/v2.0/demo/ed ./ |
| 108 | + MIMIC_DATA_DIR=`pwd`/ed |
| 109 | + echo "Building and loading data into psql." |
| 110 | + cd mimic-iv-ed/buildmimic/postgres |
| 111 | + psql -q -h $POSTGRES_HOST -U postgres -f create.sql |
| 112 | + psql -q -h $POSTGRES_HOST -U postgres -v mimic_data_dir=$MIMIC_DATA_DIR -f load_gz.sql |
| 113 | + echo "Validating build." |
| 114 | + psql -h $POSTGRES_HOST -U postgres -f validate_demo.sql > validate_results.txt |
| 115 | + cat validate_results.txt |
| 116 | +
|
56 | 117 | env: |
57 | 118 | # The hostname used to communicate with the PostgreSQL service container |
58 | 119 | POSTGRES_HOST: postgres |
|
0 commit comments