Test action #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Migrations performance test | |
on: | |
pull_request: | |
types: [labeled, unlabeled, opened, closed] | |
jobs: | |
run: | |
name: Run migrations performance test | |
if: ${{ (((github.event.action == 'labeled') && (github.event.label.name == 'migrations perf test')) || ((github.event.action == 'opened') && contains(github.event.pull_request.labels.*.name, 'migrations perf test')) && github.repository == 'saleor/saleor') }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: rlespinasse/github-slug-action@e4699e49fcf890a3172a02c56ba78d867dbb9fd5 | |
- name: Build and push | |
uses: kciter/aws-ecr-action@79255b7c5aa03dbf6d7c46cff2bfd049874cd98d # v4 | |
with: | |
access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
account_id: ${{ secrets.AWS_ACCOUNT_ID }} | |
repo: saleor-testenvs | |
region: us-east-1 | |
tags: ${{ env.GITHUB_HEAD_REF_SLUG_URL }},${{ github.sha }} | |
- name: Get pull number | |
run: | | |
echo "PULL_ID=$(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH")" >> $GITHUB_ENV | |
- name: Invoke deployment lambda | |
uses: gagoar/invoke-aws-lambda@d3a63ccabbed6ef817604ef6320096bde576ad40 | |
with: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
REGION: us-east-1 | |
FunctionName: migrations-perf-test-manager | |
Payload: >- | |
{ | |
"action": "${{ github.event.action }}", | |
"label": "${{ env.GITHUB_HEAD_REF_SLUG_URL }}", | |
"image": "${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.us-east-1.amazonaws.com/saleor-testenvs:${{ github.sha }}", | |
"pr_id": "${{ env.PULL_ID }}", | |
"commit_hash": "${{ github.sha }}" | |
} | |
LogType: Tail | |
cleanup: | |
name: Cleanup after migrations performance test | |
if: ${{ (((github.event.action == 'unlabeled') && (github.event.label.name == 'migrations perf test')) || ((github.event.action == 'closed') && contains(github.event.pull_request.labels.*.name, 'migrations perf test')) && github.repository == 'saleor/saleor') }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: rlespinasse/github-slug-action@e4699e49fcf890a3172a02c56ba78d867dbb9fd5 | |
- name: Get pull number | |
run: | | |
echo "PULL_ID=$(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH")" >> $GITHUB_ENV | |
- name: Invoke deployment lambda | |
uses: gagoar/invoke-aws-lambda@d3a63ccabbed6ef817604ef6320096bde576ad40 | |
with: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
REGION: us-east-1 | |
FunctionName: migrations-perf-test-manager | |
Payload: >- | |
{ | |
"action": "${{ github.event.action }}", | |
"label": "${{ env.GITHUB_HEAD_REF_SLUG_URL }}", | |
"image": "${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.us-east-1.amazonaws.com/saleor-testenvs:${{ github.sha }}", | |
"pr_id": "${{ env.PULL_ID }}", | |
"commit_hash": "${{ github.sha }}" | |
} | |
LogType: Tail |