-
Notifications
You must be signed in to change notification settings - Fork 0
119 lines (97 loc) · 3.52 KB
/
build-test.yaml
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
name: Build/Test
env:
SUBPROJECT: BeamGameCode
on:
workflow_dispatch:
push:
branches: [ main ]
paths:
- 'src/BeamGameCode/**'
- 'tests/BeamGameCode.Tests/**'
# Would really like to do this:
# paths:
# - 'src/${{env.SUBPROJECT}}/**'
# - 'tests/${{env.SUBPROJECT}}.Tests/**'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-dotnet@v3
with:
dotnet-version: '6.0.x'
- name: Checkout Target
uses: actions/checkout@v3
with:
path: main
- name: Checkout framework dependency - UniLog
uses: actions/checkout@v3
with:
repository: Apian-Framework/UniLog
path: UniLog
- name: Checkout framework dependency - ApianAppUtils
uses: actions/checkout@v3
with:
repository: Apian-Framework/ApianAppUtils
path: ApianAppUtils
- name: Checkout framework dependency - ApianCrypto
uses: actions/checkout@v3
with:
repository: Apian-Framework/ApianCrypto
path: ApianCrypto
- name: Checkout framework dependency - P2pNet
uses: actions/checkout@v3
with:
repository: Apian-Framework/P2pNet
path: P2pNet
- name: Checkout framework dependency - Apian.Net
uses: actions/checkout@v3
with:
repository: Apian-Framework/Apian.Net
path: Apian.Net
- name: Checkout framework dependency - NotUnityEngine
uses: actions/checkout@v3
with:
repository: Apian-Framework/NotUnityEngine
path: NotUnityEngine
- name: Restore dependencies
run: dotnet restore
working-directory: main
- name: Build
run: dotnet build ./src/${{env.SUBPROJECT}} --configuration Release
working-directory: main
- name: Test # See the test project .csproj file for property definitions
run: dotnet test ./tests/${{env.SUBPROJECT}}.Tests --verbosity normal
working-directory: main
- name: Checkout CI badges
uses: actions/checkout@v3
with:
repository: Apian-Framework/Apian-CI-Badges
ref: ${{env.SUBPROJECT}}
path: badges
- name: Commit Badges
run: |
if [ -f ./tests/${{env.SUBPROJECT}}.Tests/coverage/reports/badge_linecoverage.svg ]
then
cp -v ./tests/${{env.SUBPROJECT}}.Tests/coverage/reports/badge_linecoverage.svg ../badges/${{env.SUBPROJECT}}_linecoverage.svg
cp -v ./tests/${{env.SUBPROJECT}}.Tests/coverage/reports/badge_branchcoverage.svg ../badges/${{env.SUBPROJECT}}_branchcoverage.svg
else
echo "No coverage badges created"
cp -v ../badges/badge_linecoverage_none.svg ../badges/${{env.SUBPROJECT}}_linecoverage.svg
cp -v ../badges/badge_branchcoverage_none.svg ../badges/${{env.SUBPROJECT}}_branchcoverage.svg
fi
cd ../badges
git config --global user.name "ApianFrameworkPackageAccess"
git config --global user.email "[email protected]"
git config -l | grep 'http\..*\.extraheader' | cut -d= -f1 | xargs -L1 git config --unset-all
git add ${{env.SUBPROJECT}}_linecoverage.svg
git add ${{env.SUBPROJECT}}_branchcoverage.svg
git pull --ff-only
git commit --allow-empty -m "${{env.SUBPROJECT}} coverage badges"
working-directory: main
- name: Push Badges
uses: ad-m/github-push-action@master
with:
directory: badges
repository: Apian-Framework/Apian-CI-Badges
branch: ${{env.SUBPROJECT}}
github_token: ${{ secrets.BOT_ACCESS_TOKEN }}