Skip to content

Run Tests in GitHub Actions using the Production DEA ODC Database #1100

Run Tests in GitHub Actions using the Production DEA ODC Database

Run Tests in GitHub Actions using the Production DEA ODC Database #1100

name: Test DEA Notebooks with RDS Connection
on:
push:
branches: [ develop, stable, nbtests ]
paths-ignore:
- '**/*.md' # ignore markdown files
- '**/*.rst' # ignore restructured text files
- '.github/**' # ignore anything in .github folder
- '!.github/workflows/test_notebooks.yml' # except test_notebooks.yml
pull_request:
branches: [ develop, stable ]
paths-ignore:
- '**/*.md'
- '**/*.rst'
- '.github/**'
- '!.github/workflows/test_notebooks.yml'
# on:
# schedule:
# # Runs at 5:25 AM UTC every day
# - cron: '25 5 * * *'
# # Optional: Allow manual triggering through GitHub UI
# workflow_dispatch:
permissions:
id-token: write # Required for OIDC authentication to AWS
contents: read
jobs:
test-notebooks:
runs-on: ubuntu-latest
# Automatically activate our mamba environment when it's ready
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v4
with:
path: dea-notebooks
- name: Set up database access and tests
uses: ./dea-notebooks/.github/actions/test_setup
- name: Open Port Forward to RDS
run: |
npx basti connect \
--custom-target-vpc vpc-086904199e505c1f6 \
--custom-target-host db-aurora-dea-sandbox-eks-1.cos5zfpkso9m.ap-southeast-2.rds.amazonaws.com \
--custom-target-port 5432 \
--local-port 5432 &
# Wait until the connection comes up, but, if it doesn't, don't hang forever.
npx wait-on --timeout 120000 --interval 1000 tcp:127.0.0.1:5432
echo "PGPORT=5432" >> $GITHUB_ENV
echo "PGHOST=localhost" >> $GITHUB_ENV
- name: Run the Notebook tests
run: |
sudo chown -R 1000:100 ./dea-notebooks
cd ./dea-notebooks
docker run --rm \
--net=host \
--env DATACUBE_DB_URL \
--env AWS_SESSION_TOKEN \
--env AWS_REGION \
--env AWS_ACCESS_KEY_ID \
--env AWS_SECRET_ACCESS_KEY \
--env AWS_SESSION_TOKEN \
--volume ${GITHUB_WORKSPACE}/dea-notebooks:/home/jovyan/dea-notebooks \
--volume ${GITHUB_WORKSPACE}/tide_models:/var/share/tide_models \
--env GDAL_HTTP_MAX_RETRY=3 \
--entrypoint /bin/bash \
538673716275.dkr.ecr.ap-southeast-2.amazonaws.com/geoscienceaustralia/sandbox:stable \
/home/jovyan/dea-notebooks/Tests/test_notebooks.sh