-
Notifications
You must be signed in to change notification settings - Fork 11
146 lines (141 loc) · 6.81 KB
/
build.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
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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
name: CI
on:
workflow_dispatch:
push:
branches:
- 'main'
- 'rel/v**'
pull_request:
branches: [ "main" ]
jobs:
build-nuget-and-tests:
name: Build Nuget and Run Tests
strategy:
fail-fast: false
matrix:
os: [ windows-latest, ubuntu-latest, macos-latest ]
runs-on: ${{ matrix.os }}
permissions:
checks: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 9.0.x
- name: Install and Configure Keyring
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
sudo apt-get install -y gnome-keyring
export $(dbus-launch --sh-syntax)
export $(echo 'anypass_just_to_unlock' | gnome-keyring-daemon --unlock)
export $(echo 'anypass_just_to_unlock' | gnome-keyring-daemon --start --components=gpg,pkcs11,secrets,ssh)
- name: Install NBGV tool
run: dotnet tool install --tool-path . nbgv
- name: Set Version
run: ./nbgv cloud
- name: Restore dependencies
run: dotnet restore MSStore.CLI.sln /p:Configuration=Release
- name: Build
run: dotnet build MSStore.CLI.sln --no-restore /p:Configuration=Release
- name: Test net9.0
run: dotnet run --project MSStore.CLI.UnitTests -f net9.0 --no-build -c Release --coverage --coverage-output-format cobertura --report-trx --results-directory ./TestResults
- name: Test net9.0-windows10.0.17763.0
if: ${{ matrix.os == 'windows-latest' }}
run: dotnet run --project MSStore.CLI.UnitTests -f net9.0-windows10.0.17763.0 --no-build -c Release --coverage --coverage-output-format cobertura --report-trx --results-directory ./TestResults
- name: Publish test results
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v4
with:
name: test-results-${{ matrix.os }}
path: TestResults/*.trx
- name: Install ReportGenerator
run: dotnet tool install --global dotnet-reportgenerator-globaltool --version 5.3.11
- name: Merge code coverage files
run: reportgenerator "-reports:${{ github.workspace }}/**/*.cobertura.xml" "-targetdir:${{ github.workspace }}/report" "-reporttypes:Cobertura" "-filefilters:-*GenerationContext*.g.cs"
- name: Publish code coverage results
uses: actions/upload-artifact@v4
with:
name: Cobertura-${{ matrix.os }}
path: ${{ github.workspace }}/report/Cobertura.xml
# TODO: Publish github comment with code coverage
- name: Pack NuGet
if: ${{ matrix.os == 'ubuntu-latest' }}
run: dotnet pack MSStore.API --no-build -c Release
- name: Upload Artifact - NuGet
if: ${{ matrix.os == 'ubuntu-latest' }}
uses: actions/upload-artifact@v4
with:
name: NuGet
path: MSStore.API/bin/Release/*.nupkg
build-cli:
strategy:
fail-fast: false
matrix:
os: [ windows-latest, ubuntu-latest, macos-latest ]
dotnet-configuration: [ 'Release' ]
dotnet-arch: ['x64', 'arm64' ]
include:
- os: windows-latest
dotnet-os: win
dotnet-framework: net9.0-windows10.0.17763.0
- os: ubuntu-latest
dotnet-os: linux
dotnet-framework: net9.0
- os: macos-latest
dotnet-os: osx
dotnet-framework: net9.0
runs-on: ${{ matrix.os }}
name: Build CLI - ${{ matrix.dotnet-os }}-${{ matrix.dotnet-arch }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 9.0.x
- name: Add msbuild to PATH
if: ${{ matrix.os == 'windows-latest' }}
uses: microsoft/setup-msbuild@v2
- name: Install NBGV tool
run: dotnet tool install --tool-path . nbgv
- name: Set Version
run: ./nbgv cloud
- name: Restore CLI
run: dotnet restore MSStore.CLI -r ${{ matrix.dotnet-os }}-${{ matrix.dotnet-arch }} /p:Configuration=Release /p:PublishReadyToRun=true
- name: Build CLI
run: dotnet build MSStore.CLI --no-restore --no-self-contained -r ${{ matrix.dotnet-os }}-${{ matrix.dotnet-arch }} -f ${{ matrix.dotnet-framework }} /p:Configuration=Release
- name: Publish SelfContained CLI
run: dotnet publish MSStore.CLI --no-build --no-self-contained -r ${{ matrix.dotnet-os }}-${{ matrix.dotnet-arch }} -f ${{ matrix.dotnet-framework }} /p:Configuration=Release /p:PublishProfile=${{ matrix.dotnet-os }}-${{ matrix.dotnet-arch }}
- run: |
New-Item -ItemType File -Path ".\MSStore.CLI.MSIX\obj\${{ matrix.dotnet-arch }}\appxmanifest.xml" -Force
Copy-Item ".\MSStore.CLI.MSIX\Package.appxmanifest" -Destination ".\MSStore.CLI.MSIX\obj\${{ matrix.dotnet-arch }}\appxmanifest.xml" -Force
[xml]$manifest = get-content ".\MSStore.CLI.MSIX\obj\${{ matrix.dotnet-arch }}\appxmanifest.xml"
$manifest.Package.Identity.Version = '${{ env.GitBuildVersionSimple }}.0'
$manifest.Package.Identity.SetAttribute('ProcessorArchitecture', '${{ matrix.dotnet-arch }}')
$manifest.Save((Resolve-Path ".\MSStore.CLI.MSIX\obj\${{ matrix.dotnet-arch }}\appxmanifest.xml"))
if: ${{ matrix.os == 'windows-latest' }}
name: Version Package Manifest
- name: Build CLI MSIX
if: ${{ matrix.os == 'windows-latest' }}
env:
Configuration: Release
run: dotnet msbuild .\MSStore.CLI.MSIX\MSStore.CLI.MSIX.proj -target:MakeMSIX /p:Platform=${{ matrix.dotnet-arch }} /p:MakeMsixOutputFilename='MSStore.CLI.MSIX_${{ env.GitBuildVersionSimple }}.0_${{ matrix.dotnet-arch }}_Test.msix' /p:PublishFolderPath='${{ github.workspace }}/MSStore.CLI/bin/Release/${{ matrix.dotnet-framework }}/${{ matrix.dotnet-os }}-${{ matrix.dotnet-arch }}/publish/'
- name: Sign CLI MSIX
if: ${{ matrix.os == 'windows-latest' }}
run: ."C:\Program Files (x86)\Windows Kits\10\App Certification Kit\SignTool.exe" sign /fd SHA256 /a /f .\MSStore.CLI.MSIX\MSStore.CLI.MSIX_TemporaryKey.pfx ${{ github.workspace }}/MSStore.CLI.MSIX/AppPackages/${{ matrix.dotnet-arch }}/MSStore.CLI.MSIX_${{ env.GitBuildVersionSimple }}.0_${{ matrix.dotnet-arch }}_Test.msix
- name: Upload Artifact - CLI
if: ${{ !env.ACT }}
uses: actions/upload-artifact@v4
with:
name: CLI-${{ matrix.dotnet-os }}-${{ matrix.dotnet-arch }}
path: ${{ github.workspace }}/MSStore.CLI/bin/Release/${{ matrix.dotnet-framework }}/${{ matrix.dotnet-os }}-${{ matrix.dotnet-arch }}/publish/**/*
- name: Upload Artifact - MSIX
if: ${{ matrix.os == 'windows-latest' && !env.ACT }}
uses: actions/upload-artifact@v4
with:
name: CLI-MSIX-${{ matrix.dotnet-arch }}
path: ${{ github.workspace }}/MSStore.CLI.MSIX/AppPackages/${{ matrix.dotnet-arch }}/MSStore.CLI.MSIX_${{ env.GitBuildVersionSimple }}.0_${{ matrix.dotnet-arch }}_Test.msix