-
Notifications
You must be signed in to change notification settings - Fork 31
94 lines (77 loc) · 2.36 KB
/
build.yml
File metadata and controls
94 lines (77 loc) · 2.36 KB
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
name: BinanceBot Build Pipeline
on:
workflow_dispatch:
push:
pull_request:
branches: [ "master" ]
permissions:
contents: read
concurrency:
group: build-${{ github.ref }}
cancel-in-progress: true
defaults:
run:
working-directory: ./src
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
configuration: [Debug, Release]
dotnet-version: ["9.0.x"]
steps:
- uses: actions/checkout@v4
- name: Set up .NET SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ matrix.dotnet-version }}
cache: true
cache-dependency-path: |
src/**/*.csproj
tests/**/*.csproj
src/**/global.json
src/**/NuGet.Config
- name: .NET info
run: dotnet --info
- name: Restore dependencies
run: dotnet restore --verbosity minimal
- name: Build
run: dotnet build --no-restore --configuration ${{ matrix.configuration }} --nologo
- name: Test
run: dotnet test BinanceBot.sln --no-build --configuration ${{ matrix.configuration }} --collect:"XPlat Code Coverage" --logger "trx;LogFileName=test_results.trx"
- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results-${{ matrix.configuration }}
path: |
**/TestResults/**/*.trx
if-no-files-found: warn
- name: Upload code coverage
if: always()
uses: actions/upload-artifact@v4
with:
name: coverage-cobertura-${{ matrix.configuration }}
path: |
**/TestResults/**/coverage.cobertura.xml
if-no-files-found: warn
- name: Publish artifacts (Release only)
if: matrix.configuration == 'Release'
run: |
dotnet publish BinanceBot.MarketBot.Console/BinanceBot.MarketBot.Console.csproj \
-c Release \
-o ./publish/MarketBot \
--no-build
dotnet publish BinanceBot.MarketViewer.Console/BinanceBot.MarketViewer.Console.csproj \
-c Release \
-o ./publish/MarketViewer \
--no-build
- name: Upload published artifacts
if: matrix.configuration == 'Release'
uses: actions/upload-artifact@v4
with:
name: binance-bot-binaries
path: |
src/publish/MarketBot/
src/publish/MarketViewer/
retention-days: 7