-
Notifications
You must be signed in to change notification settings - Fork 18
59 lines (49 loc) · 2.28 KB
/
coverage.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
name: "Code coverage"
on:
push:
branches: [ "master" ]
jobs:
coverage:
name: Run tests and generate coverage reports
runs-on: ubuntu-20.04
steps:
- name: Checkout this repo
uses: actions/checkout@v3
- name: Build the middleware docker image
run: docker/mware/build
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.CODECOVERAGE_AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.CODECOVERAGE_AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.CODECOVERAGE_AWS_REGION }}
- name: Run middleware coverage script
run: |
middleware/test-all-coverage
COVPCT=$(cat middleware/coverage/total)
COVCOL=$(utils/coverage-color.sh $COVPCT)
echo "{ \"schemaVersion\": 1, \"label\": \"Middleware coverage\", \"message\": \"$COVPCT%\", \"color\": \"$COVCOL\" }" > middleware/coverage/badge.json
- name: "Upload middleware coverage report"
run: |
aws s3 sync \
middleware/coverage/ \
s3://${{ secrets.CODECOVERAGE_S3_BUCKET }}/powhsm_5.1.x/middleware_coverage_report \
--sse aws:kms --sse-kms-key-id ${{ secrets.CODECOVERAGE_KMS_KEY_ID }} \
--no-progress --follow-symlinks --delete --only-show-errors
- name: Run firmware coverage script
run: |
firmware/coverage/gen-coverage
COVPCT=$(cat firmware/coverage/output/total)
COVCOL=$(utils/coverage-color.sh $COVPCT)
echo "{ \"schemaVersion\": 1, \"label\": \"Firmware coverage\", \"message\": \"$COVPCT%\", \"color\": \"$COVCOL\" }" > firmware/coverage/output/badge.json
- name: "Upload firmware coverage report"
run: |
aws s3 sync \
firmware/coverage/output/ \
s3://${{ secrets.CODECOVERAGE_S3_BUCKET }}/powhsm_5.1.x/firmware_coverage_report \
--sse aws:kms --sse-kms-key-id ${{ secrets.CODECOVERAGE_KMS_KEY_ID }} \
--no-progress --follow-symlinks --delete --only-show-errors
- name: Invalidate CloudFront cache
run: |
aws cloudfront create-invalidation \
--distribution-id ${{ secrets.CODECOVERAGE_CLOUDFRONT_DIST_ID }} --paths "/*"