Skip to content

Commit 1f6a53a

Browse files
authored
Setting up a CI pipeline based on GitHub Actions (#135)
* Setting up a CI pipeline based on GitHub Actions * Added a Windows build job * Fixed tests for Windows * More Windows test fixes * Consolidated 2 jobs into one * Disabling telemetry for all steps
1 parent 83222d3 commit 1f6a53a

10 files changed

+71
-23
lines changed

.github/workflows/ci.yml

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: .NET Continuous Integration
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build:
7+
strategy:
8+
matrix:
9+
os: [ubuntu-latest, windows-latest]
10+
11+
env:
12+
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
13+
DOTNET_CLI_TELEMETRY_OPTOUT: 1
14+
15+
runs-on: ${{ matrix.os }}
16+
17+
steps:
18+
- name: Checkout code
19+
uses: actions/checkout@v1
20+
21+
- name: Setup .NET Core
22+
if: matrix.os == 'ubuntu-latest'
23+
uses: actions/setup-dotnet@v1
24+
with:
25+
dotnet-version: 2.2.108
26+
27+
- name: Build with dotnet
28+
run: |
29+
dotnet build FirebaseAdmin/FirebaseAdmin
30+
dotnet build FirebaseAdmin/FirebaseAdmin.Snippets
31+
dotnet build FirebaseAdmin/FirebaseAdmin.IntegrationTests
32+
33+
- name: Run unit tests
34+
run: dotnet test FirebaseAdmin/FirebaseAdmin.Tests

FirebaseAdmin/FirebaseAdmin.Tests/Auth/AuthErrorHandlerTest.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ public void UnknownErrorCode()
121121

122122
Assert.Equal(ErrorCode.Internal, error.ErrorCode);
123123
Assert.Equal(
124-
$"Unexpected HTTP response with status: 500 (InternalServerError)\n{json}",
124+
$"Unexpected HTTP response with status: 500 (InternalServerError){Environment.NewLine}{json}",
125125
error.Message);
126126
Assert.Null(error.AuthErrorCode);
127127
Assert.Same(resp, error.HttpResponse);
@@ -144,7 +144,7 @@ public void UnspecifiedErrorCode()
144144

145145
Assert.Equal(ErrorCode.Internal, error.ErrorCode);
146146
Assert.Equal(
147-
$"Unexpected HTTP response with status: 500 (InternalServerError)\n{json}",
147+
$"Unexpected HTTP response with status: 500 (InternalServerError){Environment.NewLine}{json}",
148148
error.Message);
149149
Assert.Null(error.AuthErrorCode);
150150
Assert.Same(resp, error.HttpResponse);
@@ -165,7 +165,7 @@ public void NoDetails()
165165

166166
Assert.Equal(ErrorCode.Unavailable, error.ErrorCode);
167167
Assert.Equal(
168-
"Unexpected HTTP response with status: 503 (ServiceUnavailable)\n{}",
168+
$"Unexpected HTTP response with status: 503 (ServiceUnavailable){Environment.NewLine}{{}}",
169169
error.Message);
170170
Assert.Null(error.AuthErrorCode);
171171
Assert.Same(resp, error.HttpResponse);
@@ -186,7 +186,7 @@ public void NonJson()
186186

187187
Assert.Equal(ErrorCode.Unavailable, error.ErrorCode);
188188
Assert.Equal(
189-
$"Unexpected HTTP response with status: 503 (ServiceUnavailable)\n{text}",
189+
$"Unexpected HTTP response with status: 503 (ServiceUnavailable){Environment.NewLine}{text}",
190190
error.Message);
191191
Assert.Null(error.AuthErrorCode);
192192
Assert.Same(resp, error.HttpResponse);

FirebaseAdmin/FirebaseAdmin.Tests/Auth/FirebaseUserManagerTest.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -695,7 +695,7 @@ public async Task ListUsersHttpError()
695695
Assert.Equal(ErrorCode.Internal, exception.ErrorCode);
696696
Assert.Null(exception.AuthErrorCode);
697697
Assert.Equal(
698-
"Unexpected HTTP response with status: 500 (InternalServerError)\n{}",
698+
$"Unexpected HTTP response with status: 500 (InternalServerError){Environment.NewLine}{{}}",
699699
exception.Message);
700700
Assert.NotNull(exception.HttpResponse);
701701
Assert.Null(exception.InnerException);
@@ -730,7 +730,7 @@ public async Task ListUsersIntermittentHttpError()
730730
Assert.Equal(ErrorCode.Internal, exception.ErrorCode);
731731
Assert.Null(exception.AuthErrorCode);
732732
Assert.Equal(
733-
"Unexpected HTTP response with status: 500 (InternalServerError)\n{}",
733+
$"Unexpected HTTP response with status: 500 (InternalServerError){Environment.NewLine}{{}}",
734734
exception.Message);
735735
Assert.NotNull(exception.HttpResponse);
736736
Assert.Null(exception.InnerException);
@@ -1487,7 +1487,7 @@ public async Task UpdateUserHttpError()
14871487
Assert.Equal(ErrorCode.Internal, exception.ErrorCode);
14881488
Assert.Null(exception.AuthErrorCode);
14891489
Assert.Equal(
1490-
"Unexpected HTTP response with status: 500 (InternalServerError)\n{}",
1490+
$"Unexpected HTTP response with status: 500 (InternalServerError){Environment.NewLine}{{}}",
14911491
exception.Message);
14921492
Assert.NotNull(exception.HttpResponse);
14931493
Assert.Null(exception.InnerException);

FirebaseAdmin/FirebaseAdmin.Tests/Auth/HttpPublicKeySourceTest.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ public async Task HttpError()
116116

117117
Assert.Equal(ErrorCode.Internal, exception.ErrorCode);
118118
Assert.Equal(
119-
"Unexpected HTTP response with status: 500 (InternalServerError)\ntest error",
119+
$"Unexpected HTTP response with status: 500 (InternalServerError){Environment.NewLine}test error",
120120
exception.Message);
121121
Assert.Equal(AuthErrorCode.CertificateFetchFailed, exception.AuthErrorCode);
122122
Assert.NotNull(exception.HttpResponse);

FirebaseAdmin/FirebaseAdmin.Tests/Auth/IAMSignerTest.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ public async Task UnexpectedSignError()
175175

176176
Assert.Equal(ErrorCode.Internal, ex.ErrorCode);
177177
Assert.Equal(
178-
$"Unexpected HTTP response with status: 500 (InternalServerError)\nnot json",
178+
$"Unexpected HTTP response with status: 500 (InternalServerError){Environment.NewLine}not json",
179179
ex.Message);
180180
Assert.Null(ex.AuthErrorCode);
181181
Assert.NotNull(ex.HttpResponse);

FirebaseAdmin/FirebaseAdmin.Tests/HttpErrorHandlerTest.cs

+4-3
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
using System;
1516
using System.Collections.Generic;
1617
using System.Net;
1718
using System.Net.Http;
@@ -52,7 +53,7 @@ public void KnownHttpStatusCode(HttpStatusCode statusCode, ErrorCode expected)
5253

5354
Assert.Equal(expected, error.ErrorCode);
5455
Assert.Equal(
55-
$"Unexpected HTTP response with status: {(int)statusCode} ({statusCode})\n{json}",
56+
$"Unexpected HTTP response with status: {(int)statusCode} ({statusCode}){Environment.NewLine}{json}",
5657
error.Message);
5758
Assert.Same(resp, error.HttpResponse);
5859
Assert.Null(error.InnerException);
@@ -73,7 +74,7 @@ public void NonJsonResponse(HttpStatusCode statusCode, ErrorCode expected)
7374

7475
Assert.Equal(expected, error.ErrorCode);
7576
Assert.Equal(
76-
$"Unexpected HTTP response with status: {(int)statusCode} ({statusCode})\n{text}",
77+
$"Unexpected HTTP response with status: {(int)statusCode} ({statusCode}){Environment.NewLine}{text}",
7778
error.Message);
7879
Assert.Same(resp, error.HttpResponse);
7980
Assert.Null(error.InnerException);
@@ -93,7 +94,7 @@ public void UnknownHttpStatusCode()
9394

9495
Assert.Equal(ErrorCode.Unknown, error.ErrorCode);
9596
Assert.Equal(
96-
$"Unexpected HTTP response with status: 405 (MethodNotAllowed)\n{json}",
97+
$"Unexpected HTTP response with status: 405 (MethodNotAllowed){Environment.NewLine}{json}",
9798
error.Message);
9899
Assert.Same(resp, error.HttpResponse);
99100
Assert.Null(error.InnerException);

FirebaseAdmin/FirebaseAdmin.Tests/Messaging/FirebaseMessagingClientTest.cs

+4-2
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ public async Task HttpErrorNonJsonAsync()
480480

481481
Assert.Equal(ErrorCode.Internal, ex.ErrorCode);
482482
Assert.Equal(
483-
"Unexpected HTTP response with status: 500 (InternalServerError)\nnot json",
483+
$"Unexpected HTTP response with status: 500 (InternalServerError){Environment.NewLine}not json",
484484
ex.Message);
485485
Assert.Null(ex.MessagingErrorCode);
486486
Assert.NotNull(ex.HttpResponse);
@@ -511,7 +511,9 @@ public async Task Unavailable()
511511
async () => await client.SendAsync(message));
512512

513513
Assert.Equal(ErrorCode.Unavailable, ex.ErrorCode);
514-
Assert.Equal("Unexpected HTTP response with status: 503 (ServiceUnavailable)\nServiceUnavailable", ex.Message);
514+
Assert.Equal(
515+
$"Unexpected HTTP response with status: 503 (ServiceUnavailable){Environment.NewLine}ServiceUnavailable",
516+
ex.Message);
515517
Assert.Null(ex.MessagingErrorCode);
516518
Assert.NotNull(ex.HttpResponse);
517519
Assert.Null(ex.InnerException);

FirebaseAdmin/FirebaseAdmin.Tests/Messaging/InstanceIdClientTest.cs

+15-5
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,9 @@ public async Task BadRequest()
8080
() => client.SubscribeToTopicAsync(new List<string> { "abc123" }, "test-topic"));
8181

8282
Assert.Equal(ErrorCode.InvalidArgument, exception.ErrorCode);
83-
Assert.Equal("Unexpected HTTP response with status: 400 (BadRequest)\nBadRequest", exception.Message);
83+
Assert.Equal(
84+
$"Unexpected HTTP response with status: 400 (BadRequest){Environment.NewLine}BadRequest",
85+
exception.Message);
8486
Assert.Null(exception.MessagingErrorCode);
8587
Assert.NotNull(exception.HttpResponse);
8688
Assert.Null(exception.InnerException);
@@ -102,7 +104,9 @@ public async Task Unauthorized()
102104
() => client.SubscribeToTopicAsync(new List<string> { "abc123" }, "test-topic"));
103105

104106
Assert.Equal(ErrorCode.Unauthenticated, exception.ErrorCode);
105-
Assert.Equal("Unexpected HTTP response with status: 401 (Unauthorized)\nUnauthorized", exception.Message);
107+
Assert.Equal(
108+
$"Unexpected HTTP response with status: 401 (Unauthorized){Environment.NewLine}Unauthorized",
109+
exception.Message);
106110
Assert.Null(exception.MessagingErrorCode);
107111
Assert.NotNull(exception.HttpResponse);
108112
Assert.Null(exception.InnerException);
@@ -124,7 +128,9 @@ public async Task Forbidden()
124128
() => client.SubscribeToTopicAsync(new List<string> { "abc123" }, "test-topic"));
125129

126130
Assert.Equal(ErrorCode.PermissionDenied, exception.ErrorCode);
127-
Assert.Equal("Unexpected HTTP response with status: 403 (Forbidden)\nForbidden", exception.Message);
131+
Assert.Equal(
132+
$"Unexpected HTTP response with status: 403 (Forbidden){Environment.NewLine}Forbidden",
133+
exception.Message);
128134
Assert.Null(exception.MessagingErrorCode);
129135
Assert.NotNull(exception.HttpResponse);
130136
Assert.Null(exception.InnerException);
@@ -146,7 +152,9 @@ public async Task NotFound()
146152
() => client.SubscribeToTopicAsync(new List<string> { "abc123" }, "test-topic"));
147153

148154
Assert.Equal(ErrorCode.NotFound, exception.ErrorCode);
149-
Assert.Equal("Unexpected HTTP response with status: 404 (NotFound)\nNotFound", exception.Message);
155+
Assert.Equal(
156+
$"Unexpected HTTP response with status: 404 (NotFound){Environment.NewLine}NotFound",
157+
exception.Message);
150158
Assert.Null(exception.MessagingErrorCode);
151159
Assert.NotNull(exception.HttpResponse);
152160
Assert.Null(exception.InnerException);
@@ -168,7 +176,9 @@ public async Task ServiceUnavailable()
168176
() => client.SubscribeToTopicAsync(new List<string> { "abc123" }, "test-topic"));
169177

170178
Assert.Equal(ErrorCode.Unavailable, exception.ErrorCode);
171-
Assert.Equal("Unexpected HTTP response with status: 503 (ServiceUnavailable)\nServiceUnavailable", exception.Message);
179+
Assert.Equal(
180+
$"Unexpected HTTP response with status: 503 (ServiceUnavailable){Environment.NewLine}ServiceUnavailable",
181+
exception.Message);
172182
Assert.Null(exception.MessagingErrorCode);
173183
Assert.NotNull(exception.HttpResponse);
174184
Assert.Null(exception.InnerException);

FirebaseAdmin/FirebaseAdmin.Tests/Messaging/MessagingErrorHandlerTest.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ public void NoDetails()
136136

137137
Assert.Equal(ErrorCode.Unavailable, error.ErrorCode);
138138
Assert.Equal(
139-
"Unexpected HTTP response with status: 503 (ServiceUnavailable)\n{}",
139+
$"Unexpected HTTP response with status: 503 (ServiceUnavailable){Environment.NewLine}{{}}",
140140
error.Message);
141141
Assert.Null(error.MessagingErrorCode);
142142
Assert.Same(resp, error.HttpResponse);

FirebaseAdmin/FirebaseAdmin.Tests/PlatformErrorHandlerTest.cs

+4-3
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
using System;
1516
using System.Net;
1617
using System.Net.Http;
1718
using System.Text;
@@ -60,7 +61,7 @@ public void NonJsonResponse()
6061

6162
Assert.Equal(ErrorCode.Unavailable, error.ErrorCode);
6263
Assert.Equal(
63-
$"Unexpected HTTP response with status: 503 (ServiceUnavailable)\n{text}",
64+
$"Unexpected HTTP response with status: 503 (ServiceUnavailable){Environment.NewLine}{text}",
6465
error.Message);
6566
Assert.Same(resp, error.HttpResponse);
6667
Assert.Null(error.InnerException);
@@ -106,7 +107,7 @@ public void PlatformErrorWithoutMessage()
106107

107108
Assert.Equal(ErrorCode.InvalidArgument, error.ErrorCode);
108109
Assert.Equal(
109-
$"Unexpected HTTP response with status: 503 (ServiceUnavailable)\n{json}",
110+
$"Unexpected HTTP response with status: 503 (ServiceUnavailable){Environment.NewLine}{json}",
110111
error.Message);
111112
Assert.Same(resp, error.HttpResponse);
112113
Assert.Null(error.InnerException);
@@ -126,7 +127,7 @@ public void PlatformErrorWithoutCodeOrMessage()
126127

127128
Assert.Equal(ErrorCode.Unavailable, error.ErrorCode);
128129
Assert.Equal(
129-
"Unexpected HTTP response with status: 503 (ServiceUnavailable)\n{}",
130+
$"Unexpected HTTP response with status: 503 (ServiceUnavailable){Environment.NewLine}{{}}",
130131
error.Message);
131132
Assert.Same(resp, error.HttpResponse);
132133
Assert.Null(error.InnerException);

0 commit comments

Comments
 (0)