Skip to content

Commit 3b5a47c

Browse files
feat: onboard the repo to the testing infra
1 parent 9156ebd commit 3b5a47c

File tree

3 files changed

+68
-3
lines changed

3 files changed

+68
-3
lines changed

.github/workflows/aws-ci.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
2+
name: AWS CI
3+
4+
on:
5+
workflow_dispatch:
6+
pull_request:
7+
branches:
8+
- main
9+
- dev
10+
- 'feature/**'
11+
12+
permissions:
13+
id-token: write
14+
15+
jobs:
16+
run-ci:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Configure AWS Credentials
20+
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 #v4
21+
with:
22+
role-to-assume: ${{ secrets.CI_MAIN_TESTING_ACCOUNT_ROLE_ARN }}
23+
role-duration-seconds: 7200
24+
aws-region: us-west-2
25+
- name: Invoke Load Balancer Lambda
26+
id: lambda
27+
shell: pwsh
28+
run: |
29+
aws lambda invoke response.json --function-name "${{ secrets.CI_TESTING_LOAD_BALANCER_LAMBDA_NAME }}" --cli-binary-format raw-in-base64-out --payload '{"Roles": "${{ secrets.CI_TEST_RUNNER_ACCOUNT_ROLES }}", "ProjectName": "${{ secrets.CI_TESTING_CODE_BUILD_PROJECT_NAME }}", "Branch": "${{ github.sha }}"}'
30+
$roleArn=$(cat ./response.json)
31+
"roleArn=$($roleArn -replace '"', '')" >> $env:GITHUB_OUTPUT
32+
- name: Configure Test Runner Credentials
33+
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 #v4
34+
with:
35+
role-to-assume: ${{ steps.lambda.outputs.roleArn }}
36+
role-duration-seconds: 7200
37+
aws-region: us-west-2
38+
- name: Run Tests on AWS
39+
id: codebuild
40+
uses: aws-actions/aws-codebuild-run-build@v1
41+
with:
42+
project-name: ${{ secrets.CI_TESTING_CODE_BUILD_PROJECT_NAME }}
43+
- name: CodeBuild Link
44+
shell: pwsh
45+
run: |
46+
$buildId = "${{ steps.codebuild.outputs.aws-build-id }}"
47+
echo $buildId

buildtools/build.proj

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,11 @@
3838
<Exec Command="dotnet restore BlueprintPackager.sln" WorkingDirectory="..\Blueprints\BlueprintPackager"/>
3939
</Target>
4040
<Target Name="package-blueprints" DependsOnTargets="init;run-blueprint-packager">
41-
<Exec Command="$(MSBuildThisFileDirectory)nuget.exe pack template.nuspec -OutputDirectory ../../../Deployment/nuget-packages" WorkingDirectory="../Blueprints/BlueprintDefinitions/vs2022"/>
42-
43-
<Exec Command="$(MSBuildThisFileDirectory)nuget.exe pack template.nuspec -OutputDirectory ../../../Deployment/nuget-packages" WorkingDirectory="../Blueprints/BlueprintDefinitions/vs2019"/>
41+
<Exec Condition=" '$(OS)' != 'Windows_NT' " Command="mono $(MSBuildThisFileDirectory)nuget.exe pack template.nuspec -OutputDirectory ../../../Deployment/nuget-packages" WorkingDirectory="../Blueprints/BlueprintDefinitions/vs2022"/>
42+
<Exec Condition=" '$(OS)' != 'Windows_NT' " Command="mono $(MSBuildThisFileDirectory)nuget.exe pack template.nuspec -OutputDirectory ../../../Deployment/nuget-packages" WorkingDirectory="../Blueprints/BlueprintDefinitions/vs2019"/>
43+
44+
<Exec Condition=" '$(OS)' == 'Windows_NT' " Command="$(MSBuildThisFileDirectory)nuget.exe pack template.nuspec -OutputDirectory ../../../Deployment/nuget-packages" WorkingDirectory="../Blueprints/BlueprintDefinitions/vs2022"/>
45+
<Exec Condition=" '$(OS)' == 'Windows_NT' " Command="$(MSBuildThisFileDirectory)nuget.exe pack template.nuspec -OutputDirectory ../../../Deployment/nuget-packages" WorkingDirectory="../Blueprints/BlueprintDefinitions/vs2019"/>
4446
</Target>
4547
<Target Name="run-blueprint-packager">
4648
<Exec Command="dotnet run -c $(Configuration) $(BlueprintPackagerArguments)" WorkingDirectory="..\Blueprints\BlueprintPackager"/>

buildtools/ci.buildspec.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
version: 0.2
2+
3+
phases:
4+
install:
5+
runtime-versions:
6+
dotnet: 8.x
7+
commands:
8+
# The tests need .NET 3.1, 6 and 8. .NET6 is installed by default. .NET8 is added in the runtime-versions. .NET 3.1 is installed manually.
9+
- curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin --channel 3.1
10+
# Mono is needed to run the unit tests on Linux
11+
- curl https://download.mono-project.com/repo/centos8-stable.repo | tee /etc/yum.repos.d/mono-stable.repo
12+
- dnf install -y mono-complete mono-devel
13+
build:
14+
commands:
15+
- dotnet msbuild buildtools/build.proj /t:unit-tests /p:Cicd=true
16+
- dotnet msbuild buildtools/build.proj /t:integ-tests /p:Cicd=true

0 commit comments

Comments
 (0)