-
Notifications
You must be signed in to change notification settings - Fork 0
95 lines (86 loc) · 3.13 KB
/
Copy pathGCP-Build.yml
File metadata and controls
95 lines (86 loc) · 3.13 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
95
# Builds and tests the Google Cloud (Pub/Sub) cloud extension.
# Unit tests have no dependencies; integration tests run against the Pub/Sub emulator
# (the clients auto-detect PUBSUB_EMULATOR_HOST). Unlike the Azure Service Bus emulator the
# Pub/Sub emulator needs no SQL backing store and no entity pre-declaration.
name: gcp-build
on:
push:
branches: [ "gcp_cloud" ]
paths-ignore:
- "**/*.md"
- "**/*.gitignore"
- "**/*.gitattributes"
pull_request:
branches: [ "gcp_cloud", "master" ]
paths-ignore:
- "**/*.md"
- "**/*.gitignore"
- "**/*.gitattributes"
jobs:
build-and-unit-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
8.0.x
9.0.x
- name: Restore
run: dotnet restore SourceFlow.Net.sln
- name: Build
run: dotnet build SourceFlow.Net.sln --configuration Release --no-restore
- name: Run GCP unit tests
run: >-
dotnet test tests/SourceFlow.Cloud.GCP.Tests/SourceFlow.Cloud.GCP.Tests.csproj
--configuration Release --no-build --verbosity normal
--filter "Category=Unit"
- name: Pack SourceFlow.Cloud.GCP
run: dotnet pack src/SourceFlow.Cloud.GCP/SourceFlow.Cloud.GCP.csproj --configuration Release --no-build --output ./packages
- name: Upload package artifact
uses: actions/upload-artifact@v4
with:
name: gcp-nupkg
path: ./packages/*.nupkg
retention-days: 7
integration-test:
runs-on: ubuntu-latest
env:
PUBSUB_EMULATOR_HOST: localhost:8085
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
8.0.x
9.0.x
# GitHub `services:` cannot pass a multi-word command, so run the emulator via compose.
- name: Start Pub/Sub emulator
working-directory: .github/gcp-emulator
run: docker compose up -d
- name: Wait for emulator
working-directory: .github/gcp-emulator
run: |
echo "Waiting for the Pub/Sub emulator..."
for i in $(seq 1 30); do
if docker compose logs pubsub-emulator 2>&1 | grep -qi "Server started, listening"; then
echo "Emulator is ready."; exit 0
fi
echo "Attempt $i/30 - not ready yet..."; sleep 3
done
echo "ERROR: emulator did not become ready"; docker compose logs; exit 1
- name: Restore & build
run: |
dotnet restore SourceFlow.Net.sln
dotnet build SourceFlow.Net.sln --configuration Release --no-restore
- name: Run GCP integration tests (emulator)
run: >-
dotnet test tests/SourceFlow.Cloud.GCP.Tests/SourceFlow.Cloud.GCP.Tests.csproj
--configuration Release --no-build --verbosity normal
--filter "Category=Integration"
- name: Dump emulator logs on failure
if: failure()
working-directory: .github/gcp-emulator
run: docker compose logs