Skip to content

Commit

Permalink
ci: Added STS token-based authorization for integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
orlowskilp committed Oct 12, 2024
1 parent 448f457 commit cab01bd
Showing 1 changed file with 30 additions and 12 deletions.
42 changes: 30 additions & 12 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ on:
branches:
- master

permissions:
id-token: write
contents: read

jobs:
run-tests:
name: Execute tests and measure coverage
Expand All @@ -21,28 +25,42 @@ jobs:
LCOV_UT_OUT: unit-test-cov.lcov
LCOV_IT_OUT: integration-test-cov.lcov
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Install llvm-cov for code coverage
uses: taiki-e/install-action@cargo-llvm-cov

- name: Run unit tests and measure coverage
env:
LLVM_COV_ARGS: --lcov --output-path ${{ env.LCOV_UT_OUT }} --lib
run: make test-coverage ARGS="${{ env.LLVM_COV_ARGS }}"
run: |
make test-coverage ARGS="${{ env.LLVM_COV_ARGS }}"
ls -l
- name: Assume AWS role
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: ${{ secrets.AWS_REGION }}
role-to-assume: ${{ secrets.AWS_KMS_IAM_ROLE }}
role-session-name: ${{ vars.AWS_STS_SESSION_NAME}}
mask-aws-account-id: true

- name: Run integration tests and measure coverage
env:
LLVM_COV_ARGS: --lcov --output-path ${{ env.LCOV_IT_OUT }} --tests
KMS_KEY_ID: ${{ secrets.KMS_KEY_ID }}
run: |
make test-coverage ARGS="${{ env.LLVM_COV_ARGS }}"
ls -l
# - name: Run integration tests and measure coverage
# env:
# LLVM_COV_ARGS: --lcov --output-path ${{ env.LCOV_IT_OUT }} --tests
# run: make test-coverage ARGS="${{ env.LLVM_COV_ARGS }}"
- name: List working directory
run: ls -l

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files:
${{ env.LCOV_UT_OUT }}
# ${{ env.LCOV_IT_OUT }}
files: ./${{ env.LCOV_UT_OUT }},./${{ env.LCOV_IT_OUT }}
fail_ci_if_error: true

build-x86-gnu:
Expand All @@ -51,7 +69,7 @@ jobs:
TOOL_CHAIN : x86_64-unknown-linux-gnu
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Build for ${{ env.TOOL_CHAIN }}
env:
Expand All @@ -64,7 +82,7 @@ jobs:
TOOL_CHAIN : x86_64-unknown-linux-musl
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Install musl toolchain
run: |
Expand Down

0 comments on commit cab01bd

Please sign in to comment.