Skip to content

Commit 68154af

Browse files
committed
Add Build Pipeline
1 parent edede16 commit 68154af

1 file changed

Lines changed: 93 additions & 0 deletions

File tree

.github/workflows/build.yml

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
name: BinanceBot Build Pipeline
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
pull_request:
7+
branches: [ "master" ]
8+
9+
permissions:
10+
contents: read
11+
12+
concurrency:
13+
group: build-${{ github.ref }}
14+
cancel-in-progress: true
15+
16+
defaults:
17+
run:
18+
working-directory: ./src
19+
20+
jobs:
21+
build:
22+
23+
runs-on: ubuntu-latest
24+
25+
strategy:
26+
matrix:
27+
configuration: [Debug, Release]
28+
dotnet-version: ["9.0.x"]
29+
30+
steps:
31+
- uses: actions/checkout@v4
32+
33+
- name: Set up .NET SDK
34+
uses: actions/setup-dotnet@v4
35+
with:
36+
dotnet-version: ${{ matrix.dotnet-version }}
37+
cache: true
38+
cache-dependency-path: |
39+
src/**/*.csproj
40+
src/**/global.json
41+
src/**/NuGet.Config
42+
43+
- name: .NET info
44+
run: dotnet --info
45+
46+
- name: Restore dependencies
47+
run: dotnet restore --verbosity minimal
48+
49+
- name: Build
50+
run: dotnet build --no-restore --configuration ${{ matrix.configuration }} --nologo
51+
52+
- name: Test
53+
run: dotnet test --no-build --configuration ${{ matrix.configuration }} --collect:"XPlat Code Coverage" --logger "trx;LogFileName=test_results.trx" || echo "No tests found"
54+
55+
- name: Upload test results (TRX)
56+
if: always()
57+
uses: actions/upload-artifact@v4
58+
with:
59+
name: test-results-${{ matrix.configuration }}
60+
path: |
61+
**/TestResults/**/*.trx
62+
if-no-files-found: warn
63+
64+
- name: Upload code coverage (Cobertura)
65+
if: always()
66+
uses: actions/upload-artifact@v4
67+
with:
68+
name: coverage-cobertura-${{ matrix.configuration }}
69+
path: |
70+
**/TestResults/**/coverage.cobertura.xml
71+
if-no-files-found: warn
72+
73+
- name: Publish artifacts (Release only)
74+
if: matrix.configuration == 'Release'
75+
run: |
76+
dotnet publish BinanceBot.MarketBot.Console/BinanceBot.MarketBot.Console.csproj \
77+
-c Release \
78+
-o ./publish/MarketBot \
79+
--no-build
80+
dotnet publish BinanceBot.MarketViewer.Console/BinanceBot.MarketViewer.Console.csproj \
81+
-c Release \
82+
-o ./publish/MarketViewer \
83+
--no-build
84+
85+
- name: Upload published artifacts
86+
if: matrix.configuration == 'Release'
87+
uses: actions/upload-artifact@v4
88+
with:
89+
name: binance-bot-binaries
90+
path: |
91+
src/publish/MarketBot/
92+
src/publish/MarketViewer/
93+
retention-days: 7

0 commit comments

Comments
 (0)