Skip to content

Commit

Permalink
move integration tests to step before release, improve naming of work…
Browse files Browse the repository at this point in the history
…flows
  • Loading branch information
emileten committed Feb 19, 2024
1 parent b973fbc commit 6887e3e
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 111 deletions.
59 changes: 57 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,16 @@ jobs:
build_and_package:
name: Build and package
runs-on: ubuntu-latest
env:
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION_DEPLOY }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID_DEPLOY }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY_DEPLOY }}
steps:
- uses: actions/checkout@v3

- uses: actions/setup-node@v3
with:
node-version: 16
node-version: 18
cache: "npm"

- name: Install Dependencies
Expand Down Expand Up @@ -65,8 +69,59 @@ jobs:
app_id: ${{ secrets.DS_RELEASE_BOT_ID }}
private_key: ${{ secrets.DS_RELEASE_BOT_PRIVATE_KEY }}

- name: Maybe Release 🚀
- name: Check release
id: check_release
if: ${{ inputs.release }}
run: |
SHOULD_RELEASE=false
npm run semantic-release --dry-run > check_release_output.txt \
&& grep "Published release" check_release_output.txt \
&& echo "SHOULD_RELEASE=true" >> $GITHUB_OUTPUT
- name: Deploy test stack
if: "${{ inputs.release && steps.check_release.outputs.SHOULD_RELEASE }}"
id: deploy_step
working-directory: integration_tests/cdk
run: |
# install eoapi-cdk from build
pip install dist/python/*.gz
# install deployment environment
python -m venv .deployment_venv
source .deployment_venv/bin/activate
pip install -r requirements.txt
npm install
# synthesize the stack
npx cdk synth --debug --all --require-approval never
deactivate
# deploy
npx cdk deploy --ci --all --require-approval never
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
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
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
deactivate
- name: Run integration tests and tear down stack
if: "${{ inputs.release && steps.check_release.outputs.SHOULD_RELEASE }}"
working-directory: integration_tests/tests
env:
ingestor_url: ${{ steps.deploy_step.outputs.ingestor_url }}
stac_api_url: ${{ steps.deploy_step.outputs.stac_api_url }}
titiler_pgstac_api_url: ${{ steps.deploy_step.outputs.titiler_pgstac_api_url }}
run: |
python -m venv .tests_venv
source .tests_venv/bin/activate
pip install -e .
source .tests_venv/bin/activate
pytest eoapi_tests
deactivate
source .deployment_venv/bin/activate
npx cdk destroy --ci --all --force
deactivate
# run if the previous step set SHOULD_RELEASE to true
- name: Maybe Release 🚀
# only run if the previous step set SHOULD_RELEASE to true
if: "${{ inputs.release && steps.check_release.outputs.SHOULD_RELEASE }}"
run: |
npm run semantic-release
env:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Test & Build
name: Build & try to release

on:
push:
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/distribute.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ jobs:
package:
uses: ./.github/workflows/build.yaml

integration-test:
uses: ./.github/workflows/integration-test.yaml
needs: package

distribute-python:
runs-on: ubuntu-latest
needs: package
Expand Down
104 changes: 0 additions & 104 deletions .github/workflows/integration-test.yaml

This file was deleted.

0 comments on commit 6887e3e

Please sign in to comment.