| 1 |
name: NATS Server Tests |
| 2 |
|
| 3 |
on: |
| 4 |
push: |
| 5 |
pull_request: |
| 6 |
workflow_dispatch: |
| 7 |
|
| 8 |
permissions: |
| 9 |
contents: read |
| 10 |
|
| 11 |
env: |
| 12 |
RACE: ${{ (github.ref != 'refs/heads/main' && !startsWith(github.ref, 'refs/heads/release/') && github.event_name != 'pull_request') && '-race' || '' }} |
| 13 |
|
| 14 |
concurrency: |
| 15 |
group: ${{ github.workflow }}-${{ github.ref }} |
| 16 |
cancel-in-progress: ${{ github.ref != 'refs/heads/main' && !startsWith(github.ref, 'refs/heads/release/') }} |
| 17 |
|
| 18 |
jobs: |
| 19 |
signoffs: |
| 20 |
name: Sign-offs |
| 21 |
runs-on: ubuntu-latest |
| 22 |
if: github.event_name == 'pull_request' |
| 23 |
permissions: |
| 24 |
contents: read |
| 25 |
pull-requests: write |
| 26 |
steps: |
| 27 |
- name: Checkout |
| 28 |
uses: actions/checkout@v6 |
| 29 |
with: |
| 30 |
fetch-depth: 0 |
| 31 |
|
| 32 |
- name: Check all PR commits are signed off |
| 33 |
env: |
| 34 |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 35 |
run: | |
| 36 |
set -euo pipefail |
| 37 |
|
| 38 |
range="${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }}" |
| 39 |
|
| 40 |
missing=0 |
| 41 |
missing_list="" |
| 42 |
|
| 43 |
for c in $(git rev-list --no-merges $range); do |
| 44 |
msg="$(git log -1 --pretty=%B "$c")" |
| 45 |
if ! printf '%s\n' "$msg" | grep -q '^Signed-off-by:'; then |
| 46 |
echo "::error ::Commit $c has not been signed off" |
| 47 |
git log -1 --pretty=format:"%h %s" "$c" |
| 48 |
missing=1 |
| 49 |
missing_list+=$'\n- '"$(git log -1 --pretty=format:'%H `%s`' "$c")"'' |
| 50 |
fi |
| 51 |
done |
| 52 |
|
| 53 |
if [ "$missing" -ne 0 ]; then |
| 54 |
gh pr comment ${{ github.event.pull_request.number }} \ |
| 55 |
--body "$(printf "Please review the \`CONTRIBUTING.md\` guide as some commits are missing \`Signed-off-by:\` in their commit messages.\n\nTo correct, please amend the following commits and force-push:\n\n%s" "$missing_list")" |
| 56 |
exit 1 |
| 57 |
fi |
| 58 |
|
| 59 |
lint: |
| 60 |
name: Lint |
| 61 |
runs-on: ubuntu-latest |
| 62 |
steps: |
| 63 |
- name: Checkout |
| 64 |
uses: actions/checkout@v6 |
| 65 |
|
| 66 |
- name: Install Go |
| 67 |
uses: actions/setup-go@v6 |
| 68 |
with: |
| 69 |
go-version-file: "go.mod" |
| 70 |
|
| 71 |
- name: Run golangci-lint |
| 72 |
# Use commit hash here to avoid a re-tagging attack, as this is a third-party action |
| 73 |
# Commit 82606bf257cbaff209d206a39f5134f0cfbfd2ee = tag v9.2.1 |
| 74 |
uses: golangci/golangci-lint-action@82606bf257cbaff209d206a39f5134f0cfbfd2ee |
| 75 |
with: |
| 76 |
version: v2.13.0 |
| 77 |
skip-cache: true |
| 78 |
skip-save-cache: true |
| 79 |
args: --timeout=5m --config=.golangci.yml |
| 80 |
|
| 81 |
build-latest: |
| 82 |
name: Build (Latest Go) |
| 83 |
needs: [lint] |
| 84 |
runs-on: ubuntu-latest |
| 85 |
steps: |
| 86 |
- name: Checkout |
| 87 |
uses: actions/checkout@v6 |
| 88 |
|
| 89 |
- name: Install Go |
| 90 |
uses: actions/setup-go@v6 |
| 91 |
with: |
| 92 |
go-version: stable |
| 93 |
|
| 94 |
- name: Build NATS Server 64-bit |
| 95 |
run: GOARCH=amd64 GOOS=linux go build |
| 96 |
|
| 97 |
- name: Build NATS Server 32-bit |
| 98 |
run: GOARCH=386 GOOS=linux go build |
| 99 |
|
| 100 |
build-supported: |
| 101 |
name: Build (Minimum Go) |
| 102 |
needs: [lint] |
| 103 |
runs-on: ubuntu-latest |
| 104 |
steps: |
| 105 |
- name: Checkout |
| 106 |
uses: actions/checkout@v6 |
| 107 |
|
| 108 |
- name: Install Go |
| 109 |
uses: actions/setup-go@v6 |
| 110 |
with: |
| 111 |
go-version-file: "go.mod" |
| 112 |
|
| 113 |
- name: Build NATS Server 64-bit |
| 114 |
run: GOARCH=amd64 GOOS=linux go build |
| 115 |
|
| 116 |
- name: Build NATS Server 32-bit |
| 117 |
run: GOARCH=386 GOOS=linux go build |
| 118 |
|
| 119 |
# Using GitHub-supplied workers for Windows for now. |
| 120 |
# Note that the below testing steps depend on the Linux build |
| 121 |
# only, as the Windows builds take a fair bit longer to set up. |
| 122 |
build-windows: |
| 123 |
name: Build (Minimum Go, ${{ matrix.os }}) |
| 124 |
needs: [lint] |
| 125 |
strategy: |
| 126 |
fail-fast: false |
| 127 |
matrix: |
| 128 |
os: [windows-2022, windows-2025] |
| 129 |
runs-on: ${{ matrix.os }} |
| 130 |
steps: |
| 131 |
- name: Checkout |
| 132 |
uses: actions/checkout@v6 |
| 133 |
|
| 134 |
- name: Install Go |
| 135 |
uses: actions/setup-go@v6 |
| 136 |
with: |
| 137 |
go-version-file: "go.mod" |
| 138 |
|
| 139 |
- name: Build NATS Server |
| 140 |
run: go build |
| 141 |
|
| 142 |
store: |
| 143 |
name: Test Stores |
| 144 |
needs: [build-latest, build-supported, lint] |
| 145 |
runs-on: ${{ vars.GHA_WORKER_MEDIUM || 'ubuntu-latest' }} |
| 146 |
timeout-minutes: 30 |
| 147 |
steps: |
| 148 |
- name: Checkout |
| 149 |
uses: actions/checkout@v6 |
| 150 |
|
| 151 |
- name: Install Go |
| 152 |
uses: actions/setup-go@v6 |
| 153 |
with: |
| 154 |
go-version: stable |
| 155 |
|
| 156 |
- name: Run unit tests |
| 157 |
run: ./scripts/runTestsOnTravis.sh store_tests |
| 158 |
|
| 159 |
js-no-cluster: |
| 160 |
name: Test JetStream |
| 161 |
needs: [build-latest, build-supported, lint] |
| 162 |
runs-on: ${{ vars.GHA_WORKER_LARGE || 'ubuntu-latest' }} |
| 163 |
timeout-minutes: 30 |
| 164 |
steps: |
| 165 |
- name: Checkout |
| 166 |
uses: actions/checkout@v6 |
| 167 |
|
| 168 |
- name: Install Go |
| 169 |
uses: actions/setup-go@v6 |
| 170 |
with: |
| 171 |
go-version: stable |
| 172 |
|
| 173 |
- name: Run unit tests |
| 174 |
run: ./scripts/runTestsOnTravis.sh js_tests |
| 175 |
|
| 176 |
raft: |
| 177 |
name: Test Raft |
| 178 |
needs: [build-latest, build-supported, lint] |
| 179 |
runs-on: ${{ vars.GHA_WORKER_LARGE || 'ubuntu-latest' }} |
| 180 |
timeout-minutes: 30 |
| 181 |
steps: |
| 182 |
- name: Checkout |
| 183 |
uses: actions/checkout@v6 |
| 184 |
|
| 185 |
- name: Install Go |
| 186 |
uses: actions/setup-go@v6 |
| 187 |
with: |
| 188 |
go-version: stable |
| 189 |
|
| 190 |
- name: Run unit tests |
| 191 |
run: ./scripts/runTestsOnTravis.sh raft_tests |
| 192 |
|
| 193 |
js-consumers: |
| 194 |
name: Test JetStream Consumers |
| 195 |
needs: [build-latest, build-supported, lint] |
| 196 |
runs-on: ${{ vars.GHA_WORKER_LARGE || 'ubuntu-latest' }} |
| 197 |
timeout-minutes: 30 |
| 198 |
steps: |
| 199 |
- name: Checkout |
| 200 |
uses: actions/checkout@v6 |
| 201 |
|
| 202 |
- name: Install Go |
| 203 |
uses: actions/setup-go@v6 |
| 204 |
with: |
| 205 |
go-version: stable |
| 206 |
|
| 207 |
- name: Run unit tests |
| 208 |
run: ./scripts/runTestsOnTravis.sh js_consumer_tests |
| 209 |
|
| 210 |
js-cluster-1: |
| 211 |
name: Test JetStream Cluster 1 |
| 212 |
needs: [build-latest, build-supported, lint] |
| 213 |
runs-on: ${{ vars.GHA_WORKER_LARGE || 'ubuntu-latest' }} |
| 214 |
timeout-minutes: 30 |
| 215 |
steps: |
| 216 |
- name: Checkout |
| 217 |
uses: actions/checkout@v6 |
| 218 |
|
| 219 |
- name: Install Go |
| 220 |
uses: actions/setup-go@v6 |
| 221 |
with: |
| 222 |
go-version: stable |
| 223 |
|
| 224 |
- name: Run unit tests |
| 225 |
run: ./scripts/runTestsOnTravis.sh js_cluster_tests_1 |
| 226 |
|
| 227 |
js-cluster-2: |
| 228 |
name: Test JetStream Cluster 2 |
| 229 |
needs: [build-latest, build-supported, lint] |
| 230 |
runs-on: ${{ vars.GHA_WORKER_LARGE || 'ubuntu-latest' }} |
| 231 |
timeout-minutes: 30 |
| 232 |
steps: |
| 233 |
- name: Checkout |
| 234 |
uses: actions/checkout@v6 |
| 235 |
|
| 236 |
- name: Install Go |
| 237 |
uses: actions/setup-go@v6 |
| 238 |
with: |
| 239 |
go-version: stable |
| 240 |
|
| 241 |
- name: Run unit tests |
| 242 |
run: ./scripts/runTestsOnTravis.sh js_cluster_tests_2 |
| 243 |
|
| 244 |
js-cluster-3: |
| 245 |
name: Test JetStream Cluster 3 |
| 246 |
needs: [build-latest, build-supported, lint] |
| 247 |
runs-on: ${{ vars.GHA_WORKER_LARGE || 'ubuntu-latest' }} |
| 248 |
timeout-minutes: 30 |
| 249 |
steps: |
| 250 |
- name: Checkout |
| 251 |
uses: actions/checkout@v6 |
| 252 |
|
| 253 |
- name: Install Go |
| 254 |
uses: actions/setup-go@v6 |
| 255 |
with: |
| 256 |
go-version: stable |
| 257 |
|
| 258 |
- name: Run unit tests |
| 259 |
run: ./scripts/runTestsOnTravis.sh js_cluster_tests_3 |
| 260 |
|
| 261 |
js-cluster-4: |
| 262 |
name: Test JetStream Cluster 4 |
| 263 |
needs: [build-latest, build-supported, lint] |
| 264 |
runs-on: ${{ vars.GHA_WORKER_LARGE || 'ubuntu-latest' }} |
| 265 |
timeout-minutes: 30 |
| 266 |
steps: |
| 267 |
- name: Checkout |
| 268 |
uses: actions/checkout@v6 |
| 269 |
|
| 270 |
- name: Install Go |
| 271 |
uses: actions/setup-go@v6 |
| 272 |
with: |
| 273 |
go-version: stable |
| 274 |
|
| 275 |
- name: Run unit tests |
| 276 |
run: ./scripts/runTestsOnTravis.sh js_cluster_tests_4 |
| 277 |
|
| 278 |
js-supercluster: |
| 279 |
name: Test JetStream Supercluster |
| 280 |
needs: [build-latest, build-supported, lint] |
| 281 |
runs-on: ${{ vars.GHA_WORKER_LARGE || 'ubuntu-latest' }} |
| 282 |
timeout-minutes: 30 |
| 283 |
steps: |
| 284 |
- name: Checkout |
| 285 |
uses: actions/checkout@v6 |
| 286 |
|
| 287 |
- name: Install Go |
| 288 |
uses: actions/setup-go@v6 |
| 289 |
with: |
| 290 |
go-version: stable |
| 291 |
|
| 292 |
- name: Run unit tests |
| 293 |
run: ./scripts/runTestsOnTravis.sh js_super_cluster_tests |
| 294 |
|
| 295 |
no-race-1: |
| 296 |
name: Test No-Race 1 |
| 297 |
needs: [build-latest, build-supported, lint] |
| 298 |
runs-on: ${{ vars.GHA_WORKER_LARGE || 'ubuntu-latest' }} |
| 299 |
timeout-minutes: 30 |
| 300 |
steps: |
| 301 |
- name: Checkout |
| 302 |
uses: actions/checkout@v6 |
| 303 |
|
| 304 |
- name: Install Go |
| 305 |
uses: actions/setup-go@v6 |
| 306 |
with: |
| 307 |
go-version: stable |
| 308 |
|
| 309 |
- name: Run unit tests |
| 310 |
run: ./scripts/runTestsOnTravis.sh no_race_1_tests |
| 311 |
|
| 312 |
no-race-2: |
| 313 |
name: Test No-Race 2 |
| 314 |
needs: [build-latest, build-supported, lint] |
| 315 |
runs-on: ${{ vars.GHA_WORKER_LARGE || 'ubuntu-latest' }} |
| 316 |
timeout-minutes: 30 |
| 317 |
steps: |
| 318 |
- name: Checkout |
| 319 |
uses: actions/checkout@v6 |
| 320 |
|
| 321 |
- name: Install Go |
| 322 |
uses: actions/setup-go@v6 |
| 323 |
with: |
| 324 |
go-version: stable |
| 325 |
|
| 326 |
- name: Run unit tests |
| 327 |
run: ./scripts/runTestsOnTravis.sh no_race_2_tests |
| 328 |
|
| 329 |
mqtt: |
| 330 |
name: Test MQTT |
| 331 |
needs: [build-latest, build-supported, lint] |
| 332 |
runs-on: ${{ vars.GHA_WORKER_MEDIUM || 'ubuntu-latest' }} |
| 333 |
timeout-minutes: 30 |
| 334 |
steps: |
| 335 |
- name: Checkout |
| 336 |
uses: actions/checkout@v6 |
| 337 |
|
| 338 |
- name: Install Go |
| 339 |
uses: actions/setup-go@v6 |
| 340 |
with: |
| 341 |
go-version: stable |
| 342 |
|
| 343 |
- name: Run unit tests |
| 344 |
run: ./scripts/runTestsOnTravis.sh mqtt_tests |
| 345 |
|
| 346 |
msgtrace: |
| 347 |
name: Test Message Tracing |
| 348 |
needs: [build-latest, build-supported, lint] |
| 349 |
runs-on: ${{ vars.GHA_WORKER_MEDIUM || 'ubuntu-latest' }} |
| 350 |
timeout-minutes: 30 |
| 351 |
steps: |
| 352 |
- name: Checkout |
| 353 |
uses: actions/checkout@v6 |
| 354 |
|
| 355 |
- name: Install Go |
| 356 |
uses: actions/setup-go@v6 |
| 357 |
with: |
| 358 |
go-version: stable |
| 359 |
|
| 360 |
- name: Run unit tests |
| 361 |
run: ./scripts/runTestsOnTravis.sh msgtrace_tests |
| 362 |
|
| 363 |
jwt: |
| 364 |
name: Test JWT |
| 365 |
needs: [build-latest, build-supported, lint] |
| 366 |
runs-on: ${{ vars.GHA_WORKER_LARGE || 'ubuntu-latest' }} |
| 367 |
timeout-minutes: 30 |
| 368 |
steps: |
| 369 |
- name: Checkout |
| 370 |
uses: actions/checkout@v6 |
| 371 |
|
| 372 |
- name: Install Go |
| 373 |
uses: actions/setup-go@v6 |
| 374 |
with: |
| 375 |
go-version: stable |
| 376 |
|
| 377 |
- name: Run unit tests |
| 378 |
run: ./scripts/runTestsOnTravis.sh jwt_tests |
| 379 |
|
| 380 |
server-pkg-non-js: |
| 381 |
name: Test Remaining Server Tests |
| 382 |
needs: [build-latest, build-supported, lint] |
| 383 |
runs-on: ${{ vars.GHA_WORKER_LARGE || 'ubuntu-latest' }} |
| 384 |
timeout-minutes: 30 |
| 385 |
steps: |
| 386 |
- name: Checkout |
| 387 |
uses: actions/checkout@v6 |
| 388 |
|
| 389 |
- name: Install Go |
| 390 |
uses: actions/setup-go@v6 |
| 391 |
with: |
| 392 |
go-version: stable |
| 393 |
|
| 394 |
- name: Run unit tests |
| 395 |
run: ./scripts/runTestsOnTravis.sh srv_pkg_non_js_tests |
| 396 |
|
| 397 |
non-server-pkg: |
| 398 |
name: Test Other Packages |
| 399 |
needs: [build-latest, build-supported, lint] |
| 400 |
runs-on: ${{ vars.GHA_WORKER_MEDIUM || 'ubuntu-latest' }} |
| 401 |
timeout-minutes: 30 |
| 402 |
steps: |
| 403 |
- name: Checkout |
| 404 |
uses: actions/checkout@v6 |
| 405 |
|
| 406 |
- name: Install Go |
| 407 |
uses: actions/setup-go@v6 |
| 408 |
with: |
| 409 |
go-version: stable |
| 410 |
|
| 411 |
- name: Run unit tests |
| 412 |
run: ./scripts/runTestsOnTravis.sh non_srv_pkg_tests |