-
Notifications
You must be signed in to change notification settings - Fork 176
68 lines (56 loc) · 1.68 KB
/
unit-tests.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
60
61
62
63
64
65
66
67
68
name: unit-tests
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
unit-tests:
name: Unit Tests
runs-on: ubuntu-latest
steps:
- name: Add LocalStack AWS Credentials
run: |
mkdir -p ~/.aws
touch ~/.aws/credentials
echo '[default]' >> ~/.aws/credentials
echo 'aws_access_key_id=localstack' >> ~/.aws/credentials
echo 'aws_secret_access_key=localstack' >> ~/.aws/credentials
- name: Set Test Profile to default
run: |
aws configure --profile test-profile set region us-east-1
aws configure --profile test-profile set source_profile default
- uses: actions/setup-go@v3
with:
go-version: '1.21' # The Go version to download (if necessary) and use.
- run: go version
- name: Checkout EigenDA
uses: actions/checkout@v3
- name: Build
run: make build
- name: Test all
run: ./test.sh -coverprofile=coverage.out
- name: Upload coverage artifact
uses: actions/upload-artifact@v3
with:
name: coverage
path: coverage.out
- name: Extract coverage
shell: bash
run: |
COVERAGE=$(go tool cover -func="coverage.out" | tail -1 | grep -Eo '[0-9]+\.[0-9]')
echo "coverage: $COVERAGE% of statements"
coverage-report:
name: Coverage Report
needs: unit-tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Update coverage badge
if: github.ref == 'refs/heads/master'
uses: ./.github/actions/test-coverage
with:
chart: true
amend: true