-
Notifications
You must be signed in to change notification settings - Fork 1
158 lines (129 loc) · 5.56 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
147
148
149
150
151
152
153
154
155
156
157
158
#CI/MANUAL TRIGGER
name: Build
on:
push:
branches: [ main, dev ]
paths-ignore:
- '**.md'
pull_request:
branches: [ main ]
workflow_dispatch:
jobs:
Build_DotNet_OS-VSVersion:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ windows-2019 ]
vs-version: [ '16.1']
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Nuget Restore
run: nuget restore GmailAPIHelper.sln -Verbosity quiet
- name: Setup-MSBuild VS-Version (${{ matrix.vs-version }})
uses: microsoft/setup-msbuild@v2
with:
vs-version: ${{ matrix.vs-version }}
- name: Find And Replace Values (App Config)
uses: abhinavminhas/[email protected]
with:
files: '${{ github.workspace }}\GmailAPIHelper.NET.Tests\App.config'
replacements: '__GMAILID__=${{ secrets.GMAIL_ID }}'
- name: Build
id: build
run: |
msbuild GmailAPIHelper.sln /p:configuration=Release /p:DeployExtension=false /p:ZipPackageCompressionLevel=normal /v:m
- name: Find And Replace Values (OAuth)
uses: abhinavminhas/[email protected]
with:
files: '${{ github.workspace }}\GmailAPIHelper.NET.Tests\bin\Release\token.json\Google.Apis.Auth.OAuth2.Responses.TokenResponse-user'
replacements: '__ACCESSTOKEN__=${{ secrets.ACCESS_TOKEN }}'
- name: Find And Replace Values (Client Secret)
uses: abhinavminhas/[email protected]
with:
files: '${{ github.workspace }}\GmailAPIHelper.NET.Tests\bin\Release\credentials.json'
replacements: '__CLIENTSECRET__=${{ secrets.CLIENT_SECRET }}'
- name: Setup-VSTest
uses: darenm/[email protected]
- name: Test
run: vstest.console.exe ${{ github.workspace }}\GmailAPIHelper.NET.Tests\bin\Release\GmailAPIHelper.NET.Tests.dll /TestCaseFilter:"TestCategory=GMAIL-TESTS-DOTNETFRAMEWORK"
Build_DotNetCore_OS-Version:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ windows-2019, ubuntu-20.04, macOS-11 ]
dotnet-version: [ '3.1.x', '6.0.x' ]
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Dotnet Version (${{ matrix.dotnet-version }})
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ matrix.dotnet-version }}
- name: Find And Replace Values (App Config)
uses: abhinavminhas/[email protected]
with:
files: '${{ github.workspace }}/GmailAPIHelper.CORE.Tests/App.config'
replacements: '__GMAILID__=${{ secrets.GMAIL_ID }}'
- name: Build
run: dotnet build GmailAPIHelper.CORE.Tests/GmailAPIHelper.CORE.Tests.csproj --configuration Release
- name: Find And Replace Values (OAuth)
if: ${{ matrix.dotnet-version == 'N/A' }}
uses: abhinavminhas/[email protected]
with:
files: '${{ github.workspace }}/GmailAPIHelper.CORE.Tests/bin/Release/netcoreapp3.1/token.json/Google.Apis.Auth.OAuth2.Responses.TokenResponse-user'
replacements: '__ACCESSTOKEN__=${{ secrets.ACCESS_TOKEN }}'
- name: Find And Replace Values (Client Secret)
if: ${{ matrix.dotnet-version == 'N/A' }}
uses: abhinavminhas/[email protected]
with:
files: '${{ github.workspace }}/GmailAPIHelper.CORE.Tests/bin/Release/netcoreapp3.1/credentials.json'
replacements: '__CLIENTSECRET__=${{ secrets.CLIENT_SECRET }}'
- name: Test
if: ${{ matrix.dotnet-version == 'N/A' }}
run: dotnet test --no-build --verbosity normal --configuration Release --filter TestCategory=GMAIL-TESTS-DOTNETCORE
Code-Coverage:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ windows-2019, ubuntu-20.04, macOS-11 ]
dotnet-version: [ '3.1.x' ]
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Dotnet Version (${{ matrix.dotnet-version }})
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ matrix.dotnet-version }}
- name: Find And Replace Values (App Config)
uses: abhinavminhas/[email protected]
with:
files: '${{ github.workspace }}/GmailAPIHelper.CORE.Tests/App.config'
replacements: '__GMAILID__=${{ secrets.GMAIL_ID }}'
- name: Build
run: dotnet build GmailAPIHelper.CORE.Tests/GmailAPIHelper.CORE.Tests.csproj --configuration Release
- name: Find And Replace Values (OAuth)
if: ${{ matrix.dotnet-version == '3.1.x' }}
uses: abhinavminhas/[email protected]
with:
files: '${{ github.workspace }}/GmailAPIHelper.CORE.Tests/bin/Release/netcoreapp3.1/token.json/Google.Apis.Auth.OAuth2.Responses.TokenResponse-user'
replacements: '__ACCESSTOKEN__=${{ secrets.ACCESS_TOKEN }}'
- name: Find And Replace Values (Client Secret)
if: ${{ matrix.dotnet-version == '3.1.x' }}
uses: abhinavminhas/[email protected]
with:
files: '${{ github.workspace }}/GmailAPIHelper.CORE.Tests/bin/Release/netcoreapp3.1/credentials.json'
replacements: '__CLIENTSECRET__=${{ secrets.CLIENT_SECRET }}'
- name: Test
if: ${{ matrix.dotnet-version == '3.1.x' }}
run: dotnet test --no-build --verbosity normal --configuration Release --filter TestCategory=GMAIL-TESTS-DOTNETCORE /p:CollectCoverage=true /p:CoverletOutputFormat=lcov
- name: Upload Coverage To Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}