Skip to content

Canary

Canary #4753

Workflow file for this run

name: Canary
on:
workflow_dispatch:
schedule:
- cron: '10 */4 * * *' # At 10 minutes past the hour, every 4 hours
env:
AWS_REGION : "us-west-2"
# permission can be added at job level or workflow level
permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout
jobs:
canary-runs-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup .NET Versions
uses: actions/setup-dotnet@v1
with:
dotnet-version: |
6.0.x
7.0.x
8.0.x
- name: Install dependencies
run: |
dotnet restore
dotnet tool restore
- name: Build
run: dotnet build --configuration Release --no-restore
- name: configure aws credentials
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: ${{ secrets.AWS_INTEGRATION_TEST_ROLE }}
role-session-name: github-canary
aws-region: ${{ env.AWS_REGION }}
- name: Test
# runs all automated tests
run: dotnet test --configuration Release --no-restore --verbosity normal
- name: Send metric success
if: success()
run: |
aws cloudwatch put-metric-data --namespace TuxNetOps --metric-name corewcf-sqs-canary --value 1
- name: Send metric failure
if: ${{ !success() }}
run: |
aws cloudwatch put-metric-data --namespace TuxNetOps --metric-name corewcf-sqs-canary --value 0
canary-benchmark:
# disabled pending update to benachmark tool
if: false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup .NET Versions
uses: actions/setup-dotnet@v1
with:
dotnet-version: |
6.0.x
8.0.x
- name: Install dependencies
run: |
dotnet restore
dotnet tool restore
dotnet tool install --add-source ${{ secrets.AWS_BENCHMARK_TOOL_PRIVATE_FEED }} BenchmarkDotnetCliTool
- name: Prepare Benchmark AWS Config Json
shell: pwsh
run: |
Get-Content benchmark-aws-config.json
# update config file with values from secrets
$awsConfigJson = Get-Content benchmark-aws-config.json
$awsConfigJson = $awsConfigJson.Replace("BENCHMARK_EC2_INSTANCE_PROFILE_ARN", "${{ secrets.AWS_BENCHMARK_EC2_INSTANCE_PROFILE_ARN }}")
$awsConfigJson = $awsConfigJson.Replace("BENCHMARK_BUCKET_NAME", "${{ secrets.AWS_BENCHMARK_BUCKET_NAME }}")
$awsConfigJson = $awsConfigJson.Replace("BENCHMARK_TOOL_PRIVATE_FEED", "${{ secrets.AWS_BENCHMARK_TOOL_PRIVATE_FEED }}")
$awsConfigJson | Out-File benchmark-aws-config.json
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: ${{ secrets.AWS_BENCHMARK_TEST_ROLE }}
role-session-name: github-cicd
aws-region: ${{ env.AWS_REGION }}
- name: Run Benchmarking
shell: pwsh
run: |
# baseline is the most recent git tag
$baseline=(git tag -l --sort=-v:refname)[0]
#performance must degrade by atleast 50% to trigger alarm
$threshold=50.0
echo "baseline: $baseline"
echo "threshold: $threshold"
dotnet benchmark run aws native ./test/AWS.Extensions.PerformanceTests/AWS.Extensions.PerformanceTests.csproj --targetApplicationRoot . -o . --tag vNext --baseline $baseline --threshold $threshold -ac ./benchmark-aws-config.json