Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions .github/workflows/ci_codebuild_batch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1310,11 +1310,40 @@ jobs:
aws-region: us-west-2
role-duration-seconds: 7200
- name: Run CodeBuild
id: codebuild
uses: aws-actions/aws-codebuild-run-build@v1
timeout-minutes: 120
with:
project-name: python-esdk
buildspec-override: codebuild/coverage/coverage.yml
- name: Write the line coverage report
# The CodeBuild build prints its lcov report, gzipped and base64
# encoded, between two marker lines in its log.
if: ${{ !cancelled() && steps.codebuild.outputs.aws-build-id }}
env:
BUILD_ID: ${{ steps.codebuild.outputs.aws-build-id }}
run: |
read -r group stream < <(aws codebuild batch-get-builds --ids "$BUILD_ID" \
--query 'builds[0].logs.[groupName,streamName]' --output text)
token=""
: > build.log
while :; do
page=$(aws logs get-log-events --log-group-name "$group" --log-stream-name "$stream" \
--start-from-head ${token:+--next-token "$token"} --output json)
jq -r '.events[].message' <<< "$page" >> build.log
next=$(jq -r '.nextForwardToken' <<< "$page")
[ "$next" = "$token" ] && break
token=$next
done
mkdir -p coverage
sed -n '/^LCOV-GZ-BASE64-BEGIN$/,/^LCOV-GZ-BASE64-END$/{//!p}' build.log | base64 -d | gunzip > coverage/esdk.lcov
grep -c '^SF:' coverage/esdk.lcov
- name: Upload the line coverage report
if: ${{ !cancelled() && steps.codebuild.outputs.aws-build-id }}
uses: actions/upload-artifact@v4
with:
name: local-coverage-esdk
path: coverage/*.lcov

code_coverage_mpl:
name: Code Coverage MPL
Expand All @@ -1327,12 +1356,41 @@ jobs:
aws-region: us-west-2
role-duration-seconds: 7200
- name: Run CodeBuild
id: codebuild
uses: aws-actions/aws-codebuild-run-build@v1
timeout-minutes: 120
with:
project-name: python-esdk
buildspec-override: codebuild/coverage/coverage_mpl.yml
image-override: aws/codebuild/standard:7.0
- name: Write the line coverage report
# The CodeBuild build prints its lcov report, gzipped and base64
# encoded, between two marker lines in its log.
if: ${{ !cancelled() && steps.codebuild.outputs.aws-build-id }}
env:
BUILD_ID: ${{ steps.codebuild.outputs.aws-build-id }}
run: |
read -r group stream < <(aws codebuild batch-get-builds --ids "$BUILD_ID" \
--query 'builds[0].logs.[groupName,streamName]' --output text)
token=""
: > build.log
while :; do
page=$(aws logs get-log-events --log-group-name "$group" --log-stream-name "$stream" \
--start-from-head ${token:+--next-token "$token"} --output json)
jq -r '.events[].message' <<< "$page" >> build.log
next=$(jq -r '.nextForwardToken' <<< "$page")
[ "$next" = "$token" ] && break
token=$next
done
mkdir -p coverage
sed -n '/^LCOV-GZ-BASE64-BEGIN$/,/^LCOV-GZ-BASE64-END$/{//!p}' build.log | base64 -d | gunzip > coverage/esdk-mpl.lcov
grep -c '^SF:' coverage/esdk-mpl.lcov
- name: Upload the line coverage report
if: ${{ !cancelled() && steps.codebuild.outputs.aws-build-id }}
uses: actions/upload-artifact@v4
with:
name: local-coverage-esdk-mpl
path: coverage/*.lcov

compliance:
name: Compliance
Expand Down
11 changes: 11 additions & 0 deletions codebuild/coverage/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,14 @@ phases:
commands:
- pip install "tox < 4.0"
- tox
post_build:
commands:
# The GitHub workflow reads the line coverage report back out of this
# build's log and uploads it.
- |
cd "$CODEBUILD_SRC_DIR"
if [ -f .coverage ]; then
echo LCOV-GZ-BASE64-BEGIN
".tox/$TOXENV/bin/coverage" lcov --fail-under=0 -q -o - | sed 's#^SF:.*/site-packages/#SF:src/#' | gzip | base64
echo LCOV-GZ-BASE64-END
fi
11 changes: 11 additions & 0 deletions codebuild/coverage/coverage_mpl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,14 @@ phases:
commands:
- pip install "tox < 4.0"
- tox
post_build:
commands:
# The GitHub workflow reads the line coverage report back out of this
# build's log and uploads it.
- |
cd "$CODEBUILD_SRC_DIR"
if [ -f .coverage ]; then
echo LCOV-GZ-BASE64-BEGIN
".tox/$TOXENV/bin/coverage" lcov --fail-under=0 -q -o - | sed 's#^SF:.*/site-packages/#SF:src/#' | gzip | base64
echo LCOV-GZ-BASE64-END
fi
Loading