Skip to content

Commit 64e67b7

Browse files
committed
move integration tests to step before release, improve naming of workflows
1 parent b973fbc commit 64e67b7

22 files changed

+136
-930
lines changed

.github/workflows/build.yaml

Lines changed: 78 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,30 @@ on:
1212
required: false
1313
DS_RELEASE_BOT_PRIVATE_KEY:
1414
required: false
15-
15+
AWS_DEFAULT_REGION_DEPLOY:
16+
required: false
17+
AWS_ACCESS_KEY_ID_DEPLOY:
18+
required: false
19+
AWS_SECRET_ACCESS_KEY_DEPLOY:
20+
required: false
21+
AWS_ACCOUNT_ID:
22+
required: false
1623
jobs:
1724
build_and_package:
1825
name: Build and package
1926
runs-on: ubuntu-latest
27+
timeout-minutes: 60
28+
env:
29+
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION_DEPLOY }}
30+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID_DEPLOY }}
31+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY_DEPLOY }}
32+
AWS_DEFAULT_ACCOUNT: ${{ secrets.AWS_ACCOUNT_ID }}
2033
steps:
2134
- uses: actions/checkout@v3
2235

2336
- uses: actions/setup-node@v3
2437
with:
25-
node-version: 16
38+
node-version: 18
2639
cache: "npm"
2740

2841
- name: Install Dependencies
@@ -65,8 +78,70 @@ jobs:
6578
app_id: ${{ secrets.DS_RELEASE_BOT_ID }}
6679
private_key: ${{ secrets.DS_RELEASE_BOT_PRIVATE_KEY }}
6780

68-
- name: Maybe Release 🚀
81+
- name: Check release
82+
id: check_release
6983
if: ${{ inputs.release }}
84+
run: |
85+
SHOULD_RELEASE=false
86+
npm run semantic-release --dry-run > check_release_output.txt
87+
if grep -q "Published release" check_release_output.txt; then
88+
echo "SHOULD_RELEASE=true" >> $GITHUB_OUTPUT
89+
else
90+
echo "SHOULD_RELEASE=false" >> $GITHUB_OUTPUT
91+
fi
92+
93+
- name: Install deployment environment
94+
if: "${{ inputs.release && steps.check_release.outputs.SHOULD_RELEASE }}"
95+
id: install_deploy_env
96+
run: |
97+
# install deployment environment with eoapi-cdk from build
98+
python -m venv .deployment_venv
99+
source .deployment_venv/bin/activate
100+
pip install dist/python/*.gz
101+
cd integration_tests/cdk
102+
pip install -r requirements.txt
103+
npm install
104+
deactivate
105+
cd -
106+
107+
108+
- name: Deploy test stack
109+
if: "${{ inputs.release && steps.check_release.outputs.SHOULD_RELEASE }}"
110+
id: deploy_step
111+
run: |
112+
source .deployment_venv/bin/activate
113+
114+
# synthesize the stack
115+
cd integration_tests/cdk
116+
npx cdk synth --debug --all --require-approval never
117+
118+
# deploy the stack and grab URLs for testing
119+
npx cdk deploy --ci --all --require-approval never
120+
echo "ingestor_url=$(aws cloudformation describe-stacks --stack-name eoapi-cdk-integration-test-pgSTAC-infra --query "Stacks[0].Outputs[?starts_with(OutputKey, 'stacingestor')].OutputValue | [0]" --output text)" >> $GITHUB_OUTPUT
121+
echo "stac_api_url=$(aws cloudformation describe-stacks --stack-name eoapi-cdk-integration-test-pgSTAC-infra --query "Stacks[0].Outputs[?starts_with(OutputKey, 'pgstacapi')].OutputValue | [0]" --output text)" >> $GITHUB_OUTPUT
122+
echo "titiler_pgstac_api_url=$(aws cloudformation describe-stacks --stack-name eoapi-cdk-integration-test-pgSTAC-infra --query "Stacks[0].Outputs[?starts_with(OutputKey, 'titilerpgstac')].OutputValue | [0]" --output text)" >> $GITHUB_OUTPUT
123+
deactivate
124+
cd -
125+
126+
- name: Tear down any infrastructure
127+
if: always()
128+
run: |
129+
cd integration_tests/cdk
130+
# run this only if we find a 'cdk.out' directory, which means there might be things to tear down
131+
if [ -d "cdk.out" ]; then
132+
cd -
133+
source .deployment_venv/bin/activate
134+
cd integration_tests/cdk
135+
# see https://github.com/aws/aws-cdk/issues/24946
136+
rm -f cdk.out/synth.lock
137+
npx cdk destroy --ci --all --force
138+
fi
139+
140+
141+
# run if the previous step set SHOULD_RELEASE to true
142+
- name: Maybe Release 🚀
143+
# only run if the previous step set SHOULD_RELEASE to true
144+
if: "${{ inputs.release && steps.check_release.outputs.SHOULD_RELEASE }}"
70145
run: |
71146
npm run semantic-release
72147
env:
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Build & try to release
2+
3+
on:
4+
push:
5+
6+
jobs:
7+
package:
8+
uses: ./.github/workflows/build.yaml
9+
with:
10+
release: true
11+
secrets:
12+
DS_RELEASE_BOT_ID: ${{ secrets.DS_RELEASE_BOT_ID }}
13+
DS_RELEASE_BOT_PRIVATE_KEY: ${{ secrets.DS_RELEASE_BOT_PRIVATE_KEY }}
14+
AWS_DEFAULT_REGION_DEPLOY: ${{ secrets.AWS_DEFAULT_REGION_DEPLOY }}
15+
AWS_ACCESS_KEY_ID_DEPLOY: ${{ secrets.AWS_ACCESS_KEY_ID_DEPLOY }}
16+
AWS_SECRET_ACCESS_KEY_DEPLOY: ${{ secrets.AWS_SECRET_ACCESS_KEY_DEPLOY }}
17+
AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }}

.github/workflows/distribute.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@ jobs:
99
package:
1010
uses: ./.github/workflows/build.yaml
1111

12-
integration-test:
13-
uses: ./.github/workflows/integration-test.yaml
14-
needs: package
15-
1612
distribute-python:
1713
runs-on: ubuntu-latest
1814
needs: package

.github/workflows/integration-test.yaml

Lines changed: 0 additions & 104 deletions
This file was deleted.

.github/workflows/test.yaml

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)