default local ENV #217
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: dev-integration | |
on: | |
push: | |
paths: | |
- 'services/graphql/**' | |
- 'services/rule/**' | |
- 'services/request-create/**' | |
- 'services/request-approve/**' | |
- 'services/balance-by-account/**' | |
- 'services/request-by-id/**' | |
- 'services/requests-by-account/**' | |
- 'services/transaction-by-id/**' | |
- 'services/transactions-by-account/**' | |
- 'migrations/schema/*' | |
- 'tests/**' | |
branches: | |
- 'develop' | |
jobs: | |
integration_test: | |
name: cloud integration test | |
runs-on: ubuntu-latest | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_DEFAULT_REGION: us-east-1 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: mask values | |
run: echo "::add-mask::${{ secrets.AWS_ACCOUNT_ID }}" | |
- name: install latest psql client | |
run: | | |
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' | |
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - | |
sudo apt-get update | |
sudo apt-get install --yes --no-install-recommends postgresql-client | |
- name: install golang-migrate | |
run: | | |
curl -LO https://github.com/golang-migrate/migrate/releases/download/v4.15.2/migrate.linux-amd64.deb | |
sudo dpkg -i migrate.linux-amd64.deb | |
rm migrate.linux-amd64.deb | |
- name: deploy to dev cloud environment | |
run: | | |
for app in $(bash scripts/list-deployments.sh | grep -v client | xargs basename -a); do | |
# tag newly pushed dev images with develop merge commit sha | |
bash scripts/tag-merge-commit.sh --app-name $app --env dev --env-id ${{ secrets.DEV_ENV_ID }}; | |
# deploy newly tagged images to dev cloud | |
bash scripts/deploy-last-image.sh --app-name $app --env dev --env-id ${{ secrets.DEV_ENV_ID }}; | |
done | |
- name: reset rds database for integration tests | |
run: ENV_ID=${{ secrets.DEV_ENV_ID }} make --no-print-directory -C ./migrations resetrds ENV=dev DB=test | |
- name: dump rds database locally for restore between integration tests | |
run: make --no-print-directory -C ./migrations/dumps dump-rds-testseed | |
- name: get secrets for dev integration tests | |
run: ENV_ID=${{ secrets.DEV_ENV_ID }} make --no-print-directory -C ./tests get-secrets ENV=dev | |
- name: run dev cloud integration tests | |
run: ENV_ID=${{ secrets.DEV_ENV_ID }} cargo test --manifest-path ./tests/Cargo.toml --features integration_tests -- --test-threads=1 | |
- name: tag and push dev images to prod ecr | |
run: | | |
for app in $(bash scripts/list-deployments.sh | grep -v client | xargs basename -a); do | |
# tag newly tested dev images with prod and push to prod ecr | |
bash scripts/push-prod-image.sh --app-name $app --env dev --env-id ${{ secrets.DEV_ENV_ID }}; | |
done |