-
Notifications
You must be signed in to change notification settings - Fork 1
52 lines (43 loc) · 1.38 KB
/
test-with-code-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
name: Test with code coverage
on:
push:
branches:
- '**'
env:
DOTNET_INSTALL_DIR: "./.dotnet"
jobs:
test:
runs-on: ubuntu-20.04
permissions:
pull-requests: write
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: '6.0'
- name: 'Download AElf build tools'
run: bash scripts/download_binary.sh
- name: 'Install protobuf'
run: bash scripts/install.sh
- name: Install dependencies
run: dotnet restore --verbosity quiet
- name: Build
run: dotnet build --no-restore /clp:ErrorsOnly /p:GeneratePackageOnBuild=false --verbosity quiet
- name: Test
run: |
for name in $(ls ./test/*.Tests/*.csproj | awk '{print $NF}')
do
echo "Running tests for $name..."
dotnet test $name --no-restore --no-build --logger trx --settings CodeCoverage.runsettings --results-directory coverage --collect:"XPlat Code Coverage"
echo "Finished running tests for $name."
done
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true
files: coverage/*/coverage.cobertura.xml
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}