Skip to content

[phase 2-4: CICD] adding the post process job for cancellation. [yet to check the issues with core.] #227

[phase 2-4: CICD] adding the post process job for cancellation. [yet to check the issues with core.]

[phase 2-4: CICD] adding the post process job for cancellation. [yet to check the issues with core.] #227

name: pr build check for some E2E tests
on:
push:
branches:
- releases/*
- main
paths-ignore:
- '**.md'
pull_request:
branches:
- releases/*
- main
# NOTE : This workflow doesn't run on PRs against forks of this repositories
# Since they won't have access to the repository secrets. Ref: https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
# CONFIGURATION
# For help, go to https://github.com/Azure/Actions
#
# 1. Set up the following secrets in your repository:
# AZURE_CREDENTIALS
#
# 2. Change these variables for your configuration:
env:
LOAD_TEST_RESOURCE: ${{ secrets.LOAD_TEST_RESOURCE_NAME }}
LOAD_TEST_RESOURCE_GROUP: ${{ secrets.LOAD_TEST_RESOURCE_GROUP_NAME }}
permissions:
id-token: write # This is required for requesting the JWT
contents : read # This is required for actions/checkout
jobs:
run-integration-test:
environment: automation test
name: Validate PR
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
configFile: ['sample-test-url.yaml', 'sample-test-jmx.yaml', 'sample-test-locust.yaml']
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: '20'
- name: Installing dependencies and building latest changes
run: |
npm install --include=dev -f
npm ci
npm install typescript -g
tsc
# (note:mohit) - generally typescript is ignored somehow in the installation and now we want to ignore the js files for main branch hence we need tsc and npm install seperately.
- name: Azure authentication
uses: azure/login@v1
continue-on-error: false
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- name: Generate GUID
id: guid
run: |
if [[ "${{ runner.os }}" == "Windows" ]]; then
echo "::set-output name=GUID::$(powershell -Command "[guid]::NewGuid().ToString()")"
else
echo "::set-output name=GUID::$(uuidgen)"
fi
shell : bash
- name: Set up testName
shell: bash
run: |
# copying the files to a new file and editing the testId for each file in the copied file.
# replacing 'testId'(the thing present in the file.) with the new testId ('${{ steps.guid.outputs.GUID }}') in the copied file.
cp ${{ matrix.configFile }} test-config-${{ steps.guid.outputs.GUID }}.yaml
sed -i 's/testId/${{ steps.guid.outputs.GUID }}/g' test-config-${{ steps.guid.outputs.GUID }}.yaml
- name: 'Azure Load Testing'
uses: ./
with:
loadTestConfigFile: test-config-${{ steps.guid.outputs.GUID }}.yaml
loadTestResource: ${{ env.LOAD_TEST_RESOURCE }}
resourceGroup: ${{ env.LOAD_TEST_RESOURCE_GROUP }}
continue-on-error: true
- name: Check for results and report files
run: |
if [[ -d "./loadTest" ]]; then
if [[ -f "./loadTest/results.zip" && -f "./loadTest/report.zip" ]]; then
echo "Both results.zip and report.zip files are present."
else
echo "One or both of the files are missing."
exit 1
fi
else
echo "loadTest directory is missing."
exit 1
fi
shell: bash