NATS Server Long Tests workflow (nats-io/nats-server)
The NATS Server Long Tests workflow from nats-io/nats-server, explained and optimized by Latchkey.
A
CI health: A - excellent
Run this on Latchkey for self-healing, caching, and up to 58% lower cost.
Grade your own workflow free or run it on Latchkey →What it does
This is the NATS Server Long Tests workflow from the nats-io/nats-server repository, a real project running GitHub Actions. It is shown here with attribution under its Apache-2.0 license.
Below, Latchkey shows a faster, safer version produced by its optimization engine.
The workflow
workflow (.yml)
name: NATS Server Long Tests
on:
# Allow manual trigger (any branch)
workflow_dispatch:
# Run daily at 12:30 on default branch
schedule:
- cron: "30 12 * * *"
permissions:
contents: read
concurrency:
# At most one of these workflow per ref running
group: ${{ github.workflow }}-${{ github.ref }}
# New one cancels in-progress one
cancel-in-progress: true
jobs:
js-long:
name: Long JetStream tests
runs-on: ${{ vars.GHA_WORKER_MEDIUM || 'ubuntu-latest' }}
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Install Go
uses: actions/setup-go@v6
with:
go-version: stable
- name: Run tests
run: go test -race -v -run='^TestLong.*' ./server -tags=include_js_long_tests -count=1 -vet=off -timeout=60m -shuffle on -p 1 -failfast
The same workflow, on Latchkey
Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.
name: NATS Server Long Tests on: # Allow manual trigger (any branch) workflow_dispatch: # Run daily at 12:30 on default branch schedule: - cron: "30 12 * * *" permissions: contents: read concurrency: # At most one of these workflow per ref running group: ${{ github.workflow }}-${{ github.ref }} # New one cancels in-progress one cancel-in-progress: true jobs: js-long: timeout-minutes: 30 name: Long JetStream tests runs-on: ${{ vars.GHA_WORKER_MEDIUM || 'ubuntu-latest' }} steps: - name: Checkout uses: actions/checkout@v6 - name: Install Go uses: actions/setup-go@v6 with: go-version: stable - name: Run tests run: go test -race -v -run='^TestLong.*' ./server -tags=include_js_long_tests -count=1 -vet=off -timeout=60m -shuffle on -p 1 -failfast
What changed
- Add a job timeout so a hung step cannot burn hours of runner time.
This workflow runs 1 job per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.