-
Notifications
You must be signed in to change notification settings - Fork 51
205 lines (200 loc) · 8.97 KB
/
Copy pathci.yml
File metadata and controls
205 lines (200 loc) · 8.97 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
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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
name: CI
on:
push:
branches:
- master
- release-*
pull_request:
workflow_dispatch:
env:
DOTNET_NOLOGO: true
defaults:
run:
shell: pwsh
jobs:
build:
name: ${{ matrix.os-name }}-${{ matrix.test-category }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest, ubuntu-latest]
# Categories are declared by the <TestCategory> property in each test project.
test-category: [ DefaultCore, DefaultAudit, DefaultMonitoring, SqlServer, SqlServerPersistence, AzureServiceBus, RabbitMQClassicConventional, RabbitMQClassicDirect, RabbitMQQuorumConventional, RabbitMQQuorumDirect, AzureStorageQueues, MSMQ, SQS, PrimaryRavenAcceptance, PrimaryRavenPersistence, PostgreSql, PostgreSqlPersistence, IBMMQ ]
include:
- os: windows-latest
os-name: Windows
- os: ubuntu-latest
os-name: Linux
exclude:
- os: ubuntu-latest
test-category: MSMQ
fail-fast: false
steps:
- name: Check for secrets
env:
SECRETS_AVAILABLE: ${{ secrets.SECRETS_AVAILABLE }}
run: exit $(If ($env:SECRETS_AVAILABLE -eq 'true') { 0 } Else { 1 })
- name: Checkout
uses: actions/checkout@v7.0.1
with:
fetch-depth: 0
- name: Setup .NET SDK
uses: actions/setup-dotnet@v6.0.0
with:
global-json-file: global.json
- name: Select test projects
id: select
run: ./tools/select-test-projects.ps1 -Category ${{ matrix.test-category }}
- name: Download RavenDB Server
if: matrix.test-category == 'DefaultCore'
run: ./tools/download-ravendb-server.ps1
- name: Build
id: build
background: true
run: dotnet build tests.proj --configuration Release -graph
# Provisions the WSL2 Docker host that the SQL Server, PostgreSQL, RabbitMQ and IBM MQ containers
# run in on Windows. A no-op on Linux, but still run there so those actions see the same
# environment variables on both runners.
- name: Setup WSL
if: startsWith(matrix.test-category, 'RabbitMQ') || contains(fromJSON('["SqlServer", "SqlServerPersistence", "PostgreSql", "PostgreSqlPersistence", "IBMMQ"]'), matrix.test-category)
uses: Particular/setup-wsl-action@v1.2.0
with:
# The action defaults to 4GB. The runner has 16GB and the build runs concurrently with the
# container starting up, so give the VM real headroom.
memory: 8GB
# there is an issue with az cli and python 3.14, so for now we need to pin it
# once the issue is resolved it should be able to be re-floated
# https://github.com/Azure/azure-cli/issues/32980.
# This can be removed once https://github.com/Azure/azure-cli/issues/32869 is supported.
- name: Set Python 3.13 (Linux)
if: matrix.os-name == 'Linux' && matrix.test-category == 'AzureServiceBus'
uses: actions/setup-python@v5
with:
python-version: '3.13'
- name: Install pinned Azure CLI on Python 3.13 (Linux)
if: matrix.os-name == 'Linux' && matrix.test-category == 'AzureServiceBus'
shell: bash
run: |
python -m pip install --upgrade pip
python -m pip install --user "azure-cli==2.64.0"
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
- name: Setup SQL Server
uses: Particular/install-sql-server-action@v3.0.0
if: matrix.test-category == 'SqlServer'
with:
connection-string-env-var: ServiceControl_TransportTests_SQL_ConnectionString
catalog: nservicebus
- name: Setup SQL Server persistence
uses: Particular/install-sql-server-action@v3.0.0
if: matrix.test-category == 'SqlServerPersistence'
with:
connection-string-env-var: ServiceControl_Persistence_SqlServer_ConnectionString
catalog: ServiceControl
enable-full-text-search: true
- name: Setup PostgreSQL
uses: Particular/setup-postgres-action@v3.0.0
if: matrix.test-category == 'PostgreSql'
with:
connection-string-name: ServiceControl_TransportTests_PostgreSQL_ConnectionString
registry-username: ${{ secrets.DOCKERHUB_USERNAME }}
registry-password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Setup PostgreSQL persistence
uses: Particular/setup-postgres-action@v3.0.0
if: matrix.test-category == 'PostgreSqlPersistence'
with:
connection-string-name: ServiceControl_Persistence_PostgreSql_ConnectionString
registry-username: ${{ secrets.DOCKERHUB_USERNAME }}
registry-password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Setup RabbitMQ
uses: Particular/setup-rabbitmq-action@v2.0.0
if: startsWith(matrix.test-category, 'RabbitMQ')
with:
connection-string-name: ServiceControl_TransportTests_RabbitMQ_ConnectionString
registry-username: ${{ secrets.DOCKERHUB_USERNAME }}
registry-password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Setup IBM MQ
uses: Particular/setup-ibmmq-action@v1.0.0
if: matrix.test-category == 'IBMMQ'
with:
connection-string-name: ServiceControl_TransportTests_IBMMQ_ConnectionString
- name: Setup SQS environment variables
if: matrix.test-category == 'SQS'
run: |
echo "AWS_REGION=${{ secrets.AWS_REGION }}" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
echo "AWS_ACCESS_KEY_ID=${{ secrets.AWS_ACCESS_KEY_ID }}" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
echo "AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_SECRET_ACCESS_KEY }}" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
# Cleanup of queues starting with `GHA-` handled by https://github.com/Particular/NServiceBus.AmazonSQS/blob/master/.github/workflows/tests-cleanup.yml
$connectString = "AccessKeyId=${{ secrets.AWS_ACCESS_KEY_ID }};SecretAccessKey=${{ secrets.AWS_SECRET_ACCESS_KEY }};Region=${{ secrets.AWS_REGION }};QueueNamePrefix=GHA-${{ github.run_id }}"
echo "ServiceControl_TransportTests_SQS_ConnectionString=$connectString" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
# Everything above provisions local containers, so it overlaps the build freely. The Azure steps
# below create real cloud resources, so they sit behind the wait too.
- name: Wait for build
wait: build
- name: Azure login
uses: azure/login@v3.0.1
if: matrix.test-category == 'AzureServiceBus' || matrix.test-category == 'AzureStorageQueues'
with:
creds: ${{ secrets.AZURE_ACI_CREDENTIALS }}
- name: Setup Azure Service Bus
uses: Particular/setup-azureservicebus-action@v2.5.0
if: matrix.test-category == 'AzureServiceBus'
with:
connection-string-name: ServiceControl_TransportTests_ASBS_ConnectionString
azure-credentials: ${{ secrets.AZURE_ACI_CREDENTIALS }}
tag: ServiceControl
- name: Setup Azure Storage Queues
uses: Particular/setup-azurestorage-action@v2.0.0
if: matrix.test-category == 'AzureStorageQueues'
with:
connection-string-name: ServiceControl_TransportTests_ASQ_ConnectionString
azure-credentials: ${{ secrets.AZURE_ACI_CREDENTIALS }}
tag: ServiceControl
- name: Run tests
run: ./tools/run-tests.ps1 -Projects $Env:TEST_PROJECTS
env:
TEST_PROJECTS: ${{ steps.select.outputs.test-projects }}
ServiceControl_TESTS_FILTER: ${{ matrix.test-category }}
PARTICULARSOFTWARE_LICENSE: ${{ secrets.LICENSETEXT }}
AZURE_ACI_CREDENTIALS: ${{ secrets.AZURE_ACI_CREDENTIALS }}
compile:
name: ${{ matrix.os-name }}-Compile
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: windows-latest
os-name: Windows
- os: ubuntu-latest
os-name: Linux
fail-fast: false
steps:
- name: Check for secrets
env:
SECRETS_AVAILABLE: ${{ secrets.SECRETS_AVAILABLE }}
run: exit $(If ($env:SECRETS_AVAILABLE -eq 'true') { 0 } Else { 1 })
- name: Checkout
uses: actions/checkout@v7.0.1
with:
fetch-depth: 0
- name: Setup .NET SDK
uses: actions/setup-dotnet@v6.0.0
with:
global-json-file: global.json
- name: Download RavenDB Server
run: ./tools/download-ravendb-server.ps1
- name: Build
run: dotnet build src --configuration Release -graph
windows-installers:
uses: ./.github/workflows/build-windows.yml
secrets: inherit
containers:
uses: ./.github/workflows/build-containers.yml
secrets: inherit
db-container:
uses: ./.github/workflows/build-db-container.yml
secrets: inherit
# See /src/container-integration-test/README.md
container-test:
needs: [ 'containers', 'db-container' ]
uses: ./.github/workflows/container-integration-test.yml
secrets: inherit