From 701d85f51a5359cc31d07e37b3e004ea205b9302 Mon Sep 17 00:00:00 2001 From: emileten Date: Wed, 27 Sep 2023 10:04:47 +0900 Subject: [PATCH] move the trigger of integration tests to distribute, right before release --- .github/workflows/deploy.yaml | 99 -------------------------- .github/workflows/distribute.yaml | 9 ++- integration_tests/cdk/README.md | 10 ++- integration_tests/cdk/requirements.txt | 1 - 4 files changed, 13 insertions(+), 106 deletions(-) delete mode 100644 .github/workflows/deploy.yaml diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml deleted file mode 100644 index bfc37be..0000000 --- a/.github/workflows/deploy.yaml +++ /dev/null @@ -1,99 +0,0 @@ -name: Deploy & Test Deployment - -permissions: - id-token: write # required for requesting the JWT - contents: read # required for actions/checkout - -on: - # run this workflow when the `Distribute` workflow completes - workflow_run: - workflows: [Distribute] - types: [completed] - # ... or manually. - workflow_dispatch: - - # remove later - push: - branches: - - "feat/add-integration-tests" - -jobs: - # run a job on a successful `Workflow` run. - on-successful-release: - 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: - - - name: Checkout repository # for runs after `Distribute`, pulling from main will always give the latest eoapi-cdk. - uses: actions/checkout@v3 - - - name: Set up python - uses: actions/setup-python@v2 - with: - cache: pip - - - name: Set up node - uses: actions/setup-node@v3 - with: - node-version: '18' - - - name: Install deployment environment - working-directory: integration_tests/cdk - run: | - python -m venv .deployment_venv - source .deployment_venv/bin/activate - pip install -r requirements.txt - pip install --upgrade eoapi-cdk # make sure to take the latest version of eoapi-cdk since we're integration-testing the newest release. - npm install - deactivate - - - name: Synthesize the stack - working-directory: integration_tests/cdk - run: | - source .deployment_venv/bin/activate - npx cdk synth --debug --all --require-approval never - deactivate - - # deploys and grabs URLs from the output for later tests - - name: Deploy the stack - id: deploy_step - working-directory: integration_tests/cdk - run: | - source .deployment_venv/bin/activate - 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: Install test environment - working-directory: integration_tests/tests - run: | - python -m venv .tests_venv - source .tests_venv/bin/activate - pip install -r requirements.txt - deactivate - - - name: Test the stack - 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: | - source .tests_venv/bin/activate - pytest eoapi_tests - deactivate - - - name: Always tear down the stack - if: always() - working-directory: integration_tests/cdk - run: | - source .deployment_venv/bin/activate - npx cdk destroy --ci --all --force - deactivate diff --git a/.github/workflows/distribute.yaml b/.github/workflows/distribute.yaml index e4600a3..e484b8f 100644 --- a/.github/workflows/distribute.yaml +++ b/.github/workflows/distribute.yaml @@ -9,15 +9,14 @@ 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 steps: - - uses: actions/download-artifact@v3 - with: - name: python - path: dist - - run: pip install twine - run: twine upload dist/* diff --git a/integration_tests/cdk/README.md b/integration_tests/cdk/README.md index 1c7ad49..3711c67 100644 --- a/integration_tests/cdk/README.md +++ b/integration_tests/cdk/README.md @@ -22,7 +22,15 @@ source .venv/bin/activate python -m pip install -r requirements.txt ``` -Note that `eoapi-cdk` isn't pinned, so that the latest version is always installed. Also install node dependencies with +Install the latest `eoapi-cdk` either from PyPI: + +``` +pip install eoapi-cdk +``` + +Or alternatively, compile and package from the root of this repository to get the python version of the constructs locally. + +Also install node dependencies with ``` npm install diff --git a/integration_tests/cdk/requirements.txt b/integration_tests/cdk/requirements.txt index f628d3f..53f55e7 100644 --- a/integration_tests/cdk/requirements.txt +++ b/integration_tests/cdk/requirements.txt @@ -1,7 +1,6 @@ aws-cdk-lib>=2.75.0 aws_cdk.aws_cognito_identitypool_alpha>=2.75.0a0 aws-cdk.aws-apigatewayv2-alpha==2.95.1a0 -eoapi-cdk constructs>=10.0.0,<11.0.0 pydantic==2.0.2 pydantic-settings==2.0.1