Skip to content

build: speed up destroy step in CI/CD #419

build: speed up destroy step in CI/CD

build: speed up destroy step in CI/CD #419

Workflow file for this run

name: 'Build and Test OSML'
on:
pull_request:
branches:
- dev
- main
env:
AWS_REGION: "us-west-2"
AWS_PAGER: ""
permissions:
id-token: write
contents: read
jobs:
CheckPendingWorkflow:
runs-on: ubuntu-latest
steps:
- uses: ahmadnassri/action-workflow-queue@v1
with:
delay: 300000
timeout: 7200000
BuildOSML:
needs: CheckPendingWorkflow
runs-on: ubuntu-latest
steps:
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: us-west-2
role-to-assume: arn:aws:iam::${{ secrets[format('OSML_{0}', github.base_ref)] }}:role/GithubAction-AssumeRoleWithAction
role-session-name: GitHub_to_AWS_via_FederatedOIDC
role-duration-seconds: 7200
- name: Deploy and Build OSML
uses: aws-actions/aws-codebuild-run-build@v1
with:
project-name: CodeBuild-BuildGithubOSML
buildspec-override: .github/codebuild/build.yml
env-vars-for-codebuild: |
BASE_REF
env:
BASE_REF: ${{ github.base_ref }}
RunModelRunnerTest:
runs-on: ubuntu-latest
needs: BuildOSML
steps:
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: us-west-2
role-to-assume: arn:aws:iam::${{ secrets[format('OSML_{0}', github.base_ref)] }}:role/GithubAction-AssumeRoleWithAction
role-session-name: GitHub_to_AWS_via_FederatedOIDC
- name: Model Runner Integration Tests
uses: aws-actions/aws-codebuild-run-build@v1
with:
project-name: CodeBuild-TestGithubOSML
buildspec-override: .github/codebuild/model_runner_test.yml
RunTileServerTest:
runs-on: ubuntu-latest
needs: BuildOSML
steps:
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: us-west-2
role-to-assume: arn:aws:iam::${{ secrets[format('OSML_{0}', github.base_ref)] }}:role/GithubAction-AssumeRoleWithAction
role-session-name: GitHub_to_AWS_via_FederatedOIDC
- name: Tile Server Integration Tests
uses: aws-actions/aws-codebuild-run-build@v1
with:
project-name: CodeBuild-TestGithubOSML
buildspec-override: .github/codebuild/tile_server_test.yml
DestroyOSML:
if: ${{ always() && ( needs.CheckPendingWorkflow.result == 'success' )}}
needs: [ CheckPendingWorkflow, BuildOSML, RunTileServerTest, RunModelRunnerTest ]
runs-on: ubuntu-latest
steps:
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: us-west-2
role-to-assume: arn:aws:iam::${{ secrets[format('OSML_{0}', github.base_ref)] }}:role/GithubAction-AssumeRoleWithAction
role-session-name: GitHub_to_AWS_via_FederatedOIDC
role-duration-seconds: 14400
- name: Destroy OSML stack(s)
uses: aws-actions/aws-codebuild-run-build@v1
with:
project-name: CodeBuild-DestroyGithubOSML
buildspec-override: .github/codebuild/destroy.yml
env-vars-for-codebuild: |
BASE_REF
env:
BASE_REF: ${{ github.base_ref }}