Skip to content

Commit

Permalink
Update staging-pipeline.yml
Browse files Browse the repository at this point in the history
Revert Changes to CI
  • Loading branch information
mhmdksh authored Feb 12, 2024
1 parent 9b923b9 commit 5419915
Showing 1 changed file with 39 additions and 1 deletion.
40 changes: 39 additions & 1 deletion .github/workflows/staging-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
pull_request:
branches:
- staging

jobs:
test:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -38,20 +39,56 @@ jobs:
--health-retries 5
ports:
- 5443:5432

steps:
- uses: actions/checkout@v1
- name: Checkout
uses: actions/checkout@v1
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_S3_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_S3_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_S3_REGION }}

- name: Download latest DB backup from S3
run: |
FILENAME=$(aws s3 ls ${{ secrets.AWS_S3_BUCKET_PATH_STAGING }}/ | sort | tail -n 1 | awk '{print $4}')
aws s3 cp ${{ secrets.AWS_S3_BUCKET_PATH_STAGING }}/$FILENAME /tmp/db_backup.zip
- name: Unzip DB backup
run: |
unzip /tmp/db_backup.zip -d /tmp
mv /tmp/backups/givethio-staging/*.sql /tmp/backups/givethio-staging/db_backup.sql
- name: Wait for PostgreSQL to become ready
run: |
for i in {1..10}
do
pg_isready -h localhost -p 5443 -U postgres && echo Success && break
echo -n .
sleep 1
done
- name: Restore DB backup
run: PGPASSWORD=postgres psql -h localhost -p 5443 -U postgres -d givethio < /tmp/backups/givethio-staging/db_backup.sql

- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: 20.11.0

- name: Install dependencies
run: npm ci

- name: Run tslint
run: npm run tslint

- name: Run build
run: npm run build

- name: Run migrations
run: npm run db:migrate:run:test

- name: Run tests
run: npm run test
env:
Expand All @@ -65,6 +102,7 @@ jobs:
CELO_ALFAJORES_SCAN_API_KEY: ${{ secrets.CELO_ALFAJORES_SCAN_API_KEY }}
MORDOR_ETC_TESTNET: ${{ secrets.MORDOR_ETC_TESTNET }}
ETC_NODE_HTTP_URL: ${{ secrets.ETC_NODE_HTTP_URL }}
DROP_DATABASE: ${{ secrets.DROP_DATABASE }}
SOLANA_TEST_NODE_RPC_URL: ${{ secrets.SOLANA_TEST_NODE_RPC_URL }}
SOLANA_DEVNET_NODE_RPC_URL: ${{ secrets.SOLANA_DEVNET_NODE_RPC_URL }}
SOLANA_MAINNET_NODE_RPC_URL: ${{ secrets.SOLANA_MAINNET_NODE_RPC_URL }}
Expand Down

0 comments on commit 5419915

Please sign in to comment.