From 4135625beb2807ba6be6ff31a02ac0b5be00c1ea Mon Sep 17 00:00:00 2001 From: Phil Asmar Date: Thu, 5 Sep 2024 10:57:54 -0400 Subject: [PATCH] ci: onboard the repo to the testing infra --- .github/workflows/aws-ci.yml | 46 ++++++++++++++++++++++++++++++++++++ buildtools/ci.buildspec.yml | 20 ++++++++++++++++ 2 files changed, 66 insertions(+) create mode 100644 .github/workflows/aws-ci.yml create mode 100644 buildtools/ci.buildspec.yml diff --git a/.github/workflows/aws-ci.yml b/.github/workflows/aws-ci.yml new file mode 100644 index 0000000..36e7b8f --- /dev/null +++ b/.github/workflows/aws-ci.yml @@ -0,0 +1,46 @@ +name: AWS CI + +on: + workflow_dispatch: + pull_request: + branches: + - v4sdk-release # Change to `main` when V4 is GA + - v4sdk-development # Change to `dev` when V4 is GA + - 'feature/**' + +permissions: + id-token: write + +jobs: + run-ci: + runs-on: ubuntu-latest + steps: + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 #v4 + with: + role-to-assume: ${{ secrets.CI_MAIN_TESTING_ACCOUNT_ROLE_ARN }} + role-duration-seconds: 7200 + aws-region: us-west-2 + - name: Invoke Load Balancer Lambda + id: lambda + shell: pwsh + run: | + 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 }}"}' + $roleArn=$(cat ./response.json) + "roleArn=$($roleArn -replace '"', '')" >> $env:GITHUB_OUTPUT + - name: Configure Test Runner Credentials + uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 #v4 + with: + role-to-assume: ${{ steps.lambda.outputs.roleArn }} + role-duration-seconds: 7200 + aws-region: us-west-2 + - name: Run Tests on AWS + id: codebuild + uses: aws-actions/aws-codebuild-run-build@v1 + with: + project-name: ${{ secrets.CI_TESTING_CODE_BUILD_PROJECT_NAME }} + - name: CodeBuild Link + shell: pwsh + run: | + $buildId = "${{ steps.codebuild.outputs.aws-build-id }}" + echo $buildId \ No newline at end of file diff --git a/buildtools/ci.buildspec.yml b/buildtools/ci.buildspec.yml new file mode 100644 index 0000000..7cbba1c --- /dev/null +++ b/buildtools/ci.buildspec.yml @@ -0,0 +1,20 @@ +version: 0.2 + +phases: + install: + runtime-versions: + dotnet: 8.x + commands: + # Mono is needed to run the unit tests on Linux + - curl https://download.mono-project.com/repo/centos8-stable.repo | tee /etc/yum.repos.d/mono-stable.repo + - dnf install -y mono-complete mono-devel + build: + commands: + - dotnet test test/UnitTests/Amazon.Extensions.S3.Encryption.UnitTests.csproj -c Release --logger trx --results-directory ./testresults + - dotnet test test/IntegrationTests/Amazon.Extensions.S3.Encryption.IntegrationTests.NetStandard.csproj -c Release --logger trx --results-directory ./testresults +reports: + aws-dotnet-messaging-tests: + file-format: VisualStudioTrx + files: + - '**/*' + base-directory: './testresults' \ No newline at end of file