Skip to content

Latest update

Latest update #1

name: Test Migrations for Determinism
on:
workflow_dispatch:
pull_request:
push:
branches:
- main
- release/*
env:
NODE_OPTIONS: "--max-old-space-size=6144"
NODE_ENV: test
NODE_MODULES_PATHS: |
node_modules
packages/*/node_modules
!packages/mobile/node_modules
jobs:
test-for-non-determinism:
permissions:
id-token: write # allow accessing OIDC token for AWS
contents: read
strategy:
fail-fast: false
matrix:
postgres:
- "12"
- "14"
- "15"
- "16"
name: Test Migrations for Determinism on pg${{ matrix.postgres }}
runs-on: ubuntu-latest
steps:
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v3
with:
aws-region: ap-southeast-2
role-to-assume: arn:aws:iam::143295493206:role/gha-tamanu-test-data-snapshots-s3
role-session-name: GHA@fake=generate
- uses: actions/checkout@v4
with:
fetch-depth: 4000
- uses: actions/setup-node@v4
with:
node-version: 20.x
cache: yarn
- uses: actions/cache/restore@v3
with:
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
path: ${{ env.NODE_MODULES_PATHS }}
- run: yarn
- run: yarn build-shared
- name: Install and start postgres ${{ matrix.postgres }}
run: |
source .github/scripts/install-postgres-ubuntu.sh ${{ matrix.postgres }}
.github/scripts/setup-postgres-for-one-package.sh fake
- run: python3 -m pip install boto3
- id: commit-finder
run: |
commit=$(.github/scripts/find-dumped.py)
(( $? == 0 )) || exit 1
echo "commit=$commit" >> $GITHUB_OUTPUT
- run: aws s3 cp s3://bes-tamanu-test-data-snapshots/${{ steps.commit-finder.outputs.commit }}/fake-pg${{ matrix.postgres }}.dump ./ --no-progress
- run: yarn workspace scripts run test-determinism --dump-path $(realpath fake-pg${{ matrix.postgres }}.dump)
# Dummy job to have a stable name for PR requirements
tests-pass:
if: always() # always run even if dependencies fail
name: Non-determinism pass
needs: [test-for-non-determinism]
runs-on: ubuntu-latest
steps:
- uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}