Skip to content

Temporarily reverting perf test for a quiet weekend (#2037) #269

Temporarily reverting perf test for a quiet weekend (#2037)

Temporarily reverting perf test for a quiet weekend (#2037) #269

name: Build and Push Performance Testing Container to ECR, deploy to lambda
on:
workflow_dispatch:
push:
branches: [ "main" ]
paths:
- 'tests-perf/locust/**'
- 'tests-perf/ops/**'
env:
GITHUB_SHA: ${{ github.sha }}
REGISTRY: ${{ secrets.AWS_ACCOUNT }}.dkr.ecr.ca-central-1.amazonaws.com/notify
jobs:
changes:
runs-on: ubuntu-latest
outputs:
images: ${{ steps.filter.outputs.changes }}
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: dorny/paths-filter@4512585405083f25c027a35db413c2b3b9006d50 # v2.11.1
id: filter
with:
filters: |
performance-test:
- 'tests-perf/**'
- 'tests_smoke/**'
build-push-and-deploy:
if: ${{ needs.changes.outputs.images != '[]' }}
runs-on: ubuntu-latest
needs: changes
strategy:
fail-fast: false
matrix:
image: ${{ fromJSON(needs.changes.outputs.images) }}
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Build container
run: |
docker build \
--build-arg git_sha=$GITHUB_SHA \
-t $REGISTRY/${{ matrix.image }}:$GITHUB_SHA \
-t $REGISTRY/${{ matrix.image }}:latest . \
-f tests-perf/ops/Dockerfile
- name: Configure AWS credentials
id: aws-creds
uses: aws-actions/configure-aws-credentials@5fd3084fc36e372ff1fff382a39b10d03659f355 # v2.2.0
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ca-central-1
- name: Login to ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@5a88a04c91d5c6f97aae0d9be790e64d9b1d47b7 # v1.7.1
- name: Push containers to ECR
run: |
docker push $REGISTRY/${{ matrix.image }}:$GITHUB_SHA
docker push $REGISTRY/${{ matrix.image }}:latest
- name: Logout of Amazon ECR
run: docker logout ${{ steps.login-ecr.outputs.registry }}
- name: Notify Slack channel if this job failed
if: ${{ failure() }}
run: |
json="{'text':'<!here> CI is failing in <https://github.com/cds-snc/notification-api/actions/runs/${GITHUB_RUN_ID}|notification-api> !'}"
curl -X POST -H 'Content-type: application/json' --data "$json" ${{ secrets.SLACK_WEBHOOK }}