Skip to content

Commit b8c14a8

Browse files
committed
update workflow
1 parent d9749de commit b8c14a8

File tree

1 file changed

+40
-26
lines changed

1 file changed

+40
-26
lines changed

.github/workflows/deploy.yaml

Lines changed: 40 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ permissions:
55
contents: read # required for actions/checkout
66

77
on:
8-
workflow_dispatch:
8+
9+
push:
10+
branches:
11+
- "feat/add-integration-tests"
12+
913

1014
jobs:
1115
deploy-and-integration-test:
@@ -22,59 +26,69 @@ jobs:
2226
- name: Set up python
2327
uses: actions/setup-python@v2
2428
with:
25-
python-version: 3.10
2629
cache: pip
27-
28-
- name: Install dependencies to deploy the stack
30+
31+
- name: Install deployment environment
32+
working-directory: eoapi-template
2933
run: |
30-
cd eoapi-template
3134
python -m venv .deployment_venv
3235
source .deployment_venv/bin/activate
3336
pip install -r requirements.txt
3437
pip install --upgrade eoapi-cdk
3538
npm install -g aws-cdk
3639
deactivate
37-
cd ..
40+
41+
- name: Synthesize the stack
42+
working-directory: eoapi-template
43+
env:
44+
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION_DEPLOY }}
45+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID_DEPLOY }}
46+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY_DEPLOY }}
47+
run: |
48+
source .deployment_venv/bin/activate
49+
cdk synth --debug --all --require-approval never
50+
deactivate
51+
3852
3953
- name: Deploy the stack
54+
id: deploy_step
55+
working-directory: eoapi-template
4056
env:
41-
AWS_DEFAULT_REGION: us-east-1
42-
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
43-
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
57+
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION_DEPLOY }}
58+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID_DEPLOY }}
59+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY_DEPLOY }}
4460
run: |
45-
cd eoapi-template
4661
source .deployment_venv/bin/activate
47-
cdk deploy --all --require-approval never
48-
echo "ingestor_url=$(aws cloudformation describe-stacks --stack-name eoapi-template-demo-test-pgSTAC-infra --query "Stacks[0].Outputs[?contains(OutputKey, 'stacingestor')].OutputValue | [0]" --output text)" >> $GITHUB_OUTPUT
49-
echo "stac_api_url=$(aws cloudformation describe-stacks --stack-name eoapi-template-demo-test-pgSTAC-infra --query "Stacks[0].Outputs[?contains(OutputKey, 'stacapi')].OutputValue | [0]" --output text)" >> $GITHUB_OUTPUT
50-
echo "titiler_pgstac_api_url=$(aws cloudformation describe-stacks --stack-name eoapi-template-demo-test-pgSTAC-infra --query "Stacks[0].Outputs[?contains(OutputKey, 'titiler')].OutputValue | [0]" --output text)" >> $GITHUB_OUTPUT
62+
cdk deploy --ci --all --require-approval never
63+
echo "ingestor_url=$(aws cloudformation describe-stacks --stack-name eoapi-template-demo-test-pgSTAC-infra --query "Stacks[0].Outputs[?starts_with(OutputKey, 'stacingestor')].OutputValue | [0]" --output text)" >> $GITHUB_OUTPUT
64+
echo "stac_api_url=$(aws cloudformation describe-stacks --stack-name eoapi-template-demo-test-pgSTAC-infra --query "Stacks[0].Outputs[?starts_with(OutputKey, 'pgstacapi')].OutputValue | [0]" --output text)" >> $GITHUB_OUTPUT
65+
echo "titiler_pgstac_api_url=$(aws cloudformation describe-stacks --stack-name eoapi-template-demo-test-pgSTAC-infra --query "Stacks[0].Outputs[?starts_with(OutputKey, 'titilerpgstac')].OutputValue | [0]" --output text)" >> $GITHUB_OUTPUT
5166
deactivate
52-
cd ..
5367
5468
- name: Checkout the repo with the tests
5569
uses: actions/checkout@v3
5670
with:
5771
repository: developmentseed/eoapi-tests
72+
ref: initial-PR
5873
path: tests
5974

6075
- name: Test the stack
76+
working-directory: tests
6177
env:
62-
ingestor_url: ${{ steps.deploy_the_stack.outputs.ingestor_url }}
63-
stac_api_url: ${{ steps.deploy_the_stack.outputs.stac_api_url }}
64-
titiler_pgstac_api_url: ${{ steps.deploy_the_stack.outputs.titiler_api_url }}
78+
ingestor_url: ${{ steps.deploy_step.outputs.ingestor_url }}
79+
stac_api_url: ${{ steps.deploy_step.outputs.stac_api_url }}
80+
titiler_pgstac_api_url: ${{ steps.deploy_step.outputs.titiler_pgstac_api_url }}
6581
run: |
66-
cd tests
6782
python -m venv .tests_venv
6883
source .tests_venv/bin/activate
69-
pip install -e tests
70-
pytest eoapi-tests
84+
pip install -e .
85+
pytest eoapi_tests
7186
deactivate
72-
cd ..
7387
74-
- name: Tear down the stack
88+
- name: Always tear down the stack
89+
if: always()
90+
working-directory: eoapi-template
7591
run: |
76-
cd eoapi-template
7792
source .deployment_venv/bin/activate
78-
cdk destroy --all --require-approval never
93+
cdk destroy --ci --all --force
7994
deactivate
80-
cd ..

0 commit comments

Comments
 (0)