Aurora tests #94
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: Aurora tests | |
on: | |
push: | |
tags: | |
- '[0-9]+.[0-9]+.[0-9]+' | |
- '[0-9]+.[0-9]+.[0-9]+-*' | |
schedule: | |
- cron: 0 22 * * 0 # run workflow every sunday | |
workflow_dispatch: | |
env: | |
DOTNET_NOLOGO: true | |
permissions: | |
id-token: write # This is required for requesting the JWT | |
concurrency: aurora_tests | |
jobs: | |
build: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Check for secrets | |
env: | |
SECRETS_AVAILABLE: ${{ secrets.SECRETS_AVAILABLE }} | |
shell: pwsh | |
run: exit $(If ($env:SECRETS_AVAILABLE -eq 'true') { 0 } Else { 1 }) | |
- name: Checkout | |
uses: actions/checkout@v4.2.1 | |
with: | |
fetch-depth: 0 | |
- name: Setup .NET SDK | |
uses: actions/setup-dotnet@v4.0.1 | |
with: | |
dotnet-version: 8.0.x | |
dotnet-quality: 'preview' | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
role-to-assume: ${{ secrets.AURORA_CI_ROLE }} | |
role-session-name: AuroraCI | |
aws-region: us-east-2 | |
role-duration-seconds: 7200 | |
- name: Build | |
run: dotnet build src --configuration Release | |
- name: Upload packages | |
uses: actions/upload-artifact@v4.4.3 | |
with: | |
name: NuGet packages | |
path: nugets/ | |
retention-days: 7 | |
- name: Install CDK | |
id: install-cdk | |
run: npm install -g aws-cdk | |
- name: Setup Aurora | |
id: aurora-setup | |
shell: pwsh | |
run: | | |
cd src/AuroraSetup | |
cdk deploy | |
$postgresSecrets = aws secretsmanager get-secret-value --secret-id aurora_postgres_secrets --region us-east-2 --query SecretString --output text | ConvertFrom-Json | |
$postgresHost = $postgresSecrets.host | |
$postgresUser = $postgresSecrets.username | |
$postgresPassword = $postgresSecrets.password | |
$postgresConnectionString = "Host=$postgresHost;User ID=$postgresUser;Password=$postgresPassword;Port=5432;Database=postgres;" | |
echo "PostgreSqlConnectionString=$postgresConnectionString" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append | |
$mysqlSecrets = aws secretsmanager get-secret-value --secret-id aurora_mysql_secrets --region us-east-2 --query SecretString --output text | ConvertFrom-Json | |
$mysqlHost = $mysqlSecrets.host | |
$mysqlUser = $mysqlSecrets.username | |
$mysqlPassword = $mysqlSecrets.password | |
$mysqlConnectionString = "Server=$mysqlHost;Uid=$mysqlUser;Pwd=$mysqlPassword;Port=3306;Database=postgres;Initial Catalog=nservicebus;AllowUserVariables=True;AutoEnlist=false;Connect Timeout=60" | |
echo "MySQLConnectionString=$mysqlConnectionString" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append | |
echo "Creating nservicebus database" | |
mysql --host=$mysqlHost --user=$mysqlUser --password=$mysqlPassword -D mysql -e "create database if not exists nservicebus ;" | |
- name: Run tests | |
uses: Particular/run-tests-action@v1.7.0 | |
- name: Teardown infrastructure | |
if: ${{ always() }} | |
shell: pwsh | |
run: | | |
cd src/AuroraSetup | |
cdk destroy --force |