Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GITHUB only run what I need #8

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 41 additions & 41 deletions .github/workflows/mqtt-test.yaml
Original file line number Diff line number Diff line change
@@ -1,48 +1,48 @@
name: MQTT external test
on: [pull_request]
# name: MQTT external test
# on: [pull_request]

jobs:
test:
env:
GOPATH: /home/runner/work/nats-server
GO111MODULE: "on"
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
path: src/github.com/nats-io/nats-server
# jobs:
# test:
# env:
# GOPATH: /home/runner/work/nats-server
# GO111MODULE: "on"
# runs-on: ubuntu-latest
# steps:
# - name: Checkout code
# uses: actions/checkout@v4
# with:
# path: src/github.com/nats-io/nats-server

- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: src/github.com/nats-io/nats-server/go.mod
cache-dependency-path: src/github.com/nats-io/nats-server/go.sum
# - name: Setup Go
# uses: actions/setup-go@v5
# with:
# go-version-file: src/github.com/nats-io/nats-server/go.mod
# cache-dependency-path: src/github.com/nats-io/nats-server/go.sum

- name: Set up testing tools and environment
shell: bash --noprofile --norc -eo pipefail {0}
id: setup
run: |
wget https://github.com/hivemq/mqtt-cli/releases/download/v4.20.0/mqtt-cli-4.20.0.deb
sudo apt install ./mqtt-cli-4.20.0.deb
go install github.com/ConnectEverything/mqtt-test@v0.1.0
# - name: Set up testing tools and environment
# shell: bash --noprofile --norc -eo pipefail {0}
# id: setup
# run: |
# wget https://github.com/hivemq/mqtt-cli/releases/download/v4.20.0/mqtt-cli-4.20.0.deb
# sudo apt install ./mqtt-cli-4.20.0.deb
# go install github.com/ConnectEverything/mqtt-test@v0.1.0

- name: Run tests (3 times to detect flappers)
shell: bash --noprofile --norc -eo pipefail {0}
run: |
cd src/github.com/nats-io/nats-server
go test -v --count=3 --run='TestXMQTT' ./server
# - name: Run tests (3 times to detect flappers)
# shell: bash --noprofile --norc -eo pipefail {0}
# run: |
# cd src/github.com/nats-io/nats-server
# go test -v --count=3 --run='TestXMQTT' ./server

- name: Run tests with --race
shell: bash --noprofile --norc -eo pipefail {0}
run: |
cd src/github.com/nats-io/nats-server
go test -v --race --failfast --run='TestXMQTT' ./server
# - name: Run tests with --race
# shell: bash --noprofile --norc -eo pipefail {0}
# run: |
# cd src/github.com/nats-io/nats-server
# go test -v --race --failfast --run='TestXMQTT' ./server

- name: Run benchmarks
shell: bash --noprofile --norc -eo pipefail {0}
run: |
cd src/github.com/nats-io/nats-server
go test --run='-' --count=3 --bench 'BenchmarkXMQTT' --benchtime=100x ./server
# - name: Run benchmarks
# shell: bash --noprofile --norc -eo pipefail {0}
# run: |
# cd src/github.com/nats-io/nats-server
# go test --run='-' --count=3 --bench 'BenchmarkXMQTT' --benchtime=100x ./server

# TODO: compare benchmarks
# # TODO: compare benchmarks
262 changes: 5 additions & 257 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -1,270 +1,18 @@
name: NATS Server Tests

on:
# push:
push:
# pull_request:
workflow_dispatch:
# workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
lint:
name: Lint
runs-on: ${{ vars.GHA_WORKER_SMALL }}
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Go
uses: actions/setup-go@v5
with:
go-version: stable

- name: Run golangci-lint
uses: golangci/golangci-lint-action@v6
with:
skip-cache: true
skip-pkg-cache: true
skip-build-cache: true
args: --timeout=5m --config=.golangci.yml

build-latest:
name: Build (Latest Go)
runs-on: ${{ vars.GHA_WORKER_SMALL }}
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Go
uses: actions/setup-go@v5
with:
go-version: stable

- name: Build NATS Server
run: go build

build-supported:
name: Build (Minimum Go)
runs-on: ${{ vars.GHA_WORKER_SMALL }}
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Go
uses: actions/setup-go@v5
with:
go-version-file: "go.mod"

- name: Build NATS Server
run: go build

# Using GitHub-supplied workers for Windows for now.
# Note that the below testing steps depend on the Linux build
# only, as the Windows builds take a fair bit longer to set up.
build-windows:
name: Build (Minimum Go, ${{ matrix.os }})
strategy:
fail-fast: false
matrix:
os: [windows-2019, windows-2022]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Go
uses: actions/setup-go@v5
with:
go-version-file: "go.mod"

- name: Build NATS Server
run: go build

store:
name: Store tests
needs: [build-latest, build-supported, lint]
runs-on: ${{ vars.GHA_WORKER_MEDIUM }}
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Go
uses: actions/setup-go@v5
with:
go-version: stable

- name: Run unit tests
run: |
go test -race -v -run=TestMemStore ./server/... -count=1 -vet=off -timeout=30m -failfast
go test -race -v -run=TestFileStore ./server/... -count=1 -vet=off -timeout=30m -failfast

js-no-cluster:
name: JetStream tests
needs: [build-latest, build-supported, lint]
runs-on: ${{ vars.GHA_WORKER_LARGE }}
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Go
uses: actions/setup-go@v5
with:
go-version: stable

- name: Run unit tests
run: go test -race -v -run=TestJetStream ./server/... -tags=skip_js_cluster_tests,skip_js_cluster_tests_2,skip_js_cluster_tests_3,skip_js_cluster_tests_4,skip_js_super_cluster_tests -count=1 -vet=off -timeout=30m -failfast

js-cluster-1:
name: JetStream Cluster tests (1)
needs: [build-latest, build-supported, lint]
runs-on: ${{ vars.GHA_WORKER_LARGE }}
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Go
uses: actions/setup-go@v5
with:
go-version: stable

- name: Run unit tests
run: go test -race -v -run=TestJetStreamCluster ./server/... -tags=skip_js_cluster_tests_2,skip_js_cluster_tests_3,skip_js_cluster_tests_4 -count=1 -vet=off -timeout=30m -failfast

js-cluster-2:
name: JetStream Cluster tests (2)
needs: [build-latest, build-supported, lint]
runs-on: ${{ vars.GHA_WORKER_LARGE }}
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Go
uses: actions/setup-go@v5
with:
go-version: stable

- name: Run unit tests
run: go test -race -v -run=TestJetStreamCluster ./server/... -tags=skip_js_cluster_tests,skip_js_cluster_tests_3,skip_js_cluster_tests_4 -count=1 -vet=off -timeout=30m -failfast

js-cluster-3:
name: JetStream Cluster tests (3)
needs: [build-latest, build-supported, lint]
runs-on: ${{ vars.GHA_WORKER_LARGE }}
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Go
uses: actions/setup-go@v5
with:
go-version: stable

- name: Run unit tests
run: go test -race -v -run=TestJetStreamCluster ./server/... -tags=skip_js_cluster_tests,skip_js_cluster_tests_2,skip_js_cluster_tests_4 -count=1 -vet=off -timeout=30m -failfast

js-cluster-4:
name: JetStream Cluster tests (4)
needs: [build-latest, build-supported, lint]
runs-on: ${{ vars.GHA_WORKER_LARGE }}
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Go
uses: actions/setup-go@v5
with:
go-version: stable

- name: Run unit tests
run: go test -race -v -run=TestJetStreamCluster ./server/... -tags=skip_js_cluster_tests,skip_js_cluster_tests_2,skip_js_cluster_tests_3 -count=1 -vet=off -timeout=30m -failfast

js-supercluster:
name: JetStream Supercluster tests
needs: [build-latest, build-supported, lint]
runs-on: ${{ vars.GHA_WORKER_LARGE }}
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Go
uses: actions/setup-go@v5
with:
go-version: stable

- name: Run unit tests
run: go test -race -v -run=TestJetStreamSuperCluster ./server/... -count=1 -vet=off -timeout=30m -failfast

no-race:
name: No-race tests
needs: [build-latest, build-supported, lint]
runs-on: ${{ vars.GHA_WORKER_LARGE }}
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Go
uses: actions/setup-go@v5
with:
go-version: stable

- name: Run unit tests
run: go test -v -p=1 -run=TestNoRace ./... -count=1 -vet=off -timeout=30m -failfast

mqtt:
name: MQTT tests
needs: [build-latest, build-supported, lint]
runs-on: ${{ vars.GHA_WORKER_MEDIUM }}
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Go
uses: actions/setup-go@v5
with:
go-version: stable

- name: Run unit tests
run: go test -race -v -run=TestMQTT ./server/... -count=1 -vet=off -timeout=30m -failfast

msgtrace:
name: MsgTrace tests
needs: [build-latest, build-supported, lint]
runs-on: ${{ vars.GHA_WORKER_MEDIUM }}
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Go
uses: actions/setup-go@v5
with:
go-version: stable

- name: Run unit tests
run: go test -race -v -run=TestMsgTrace ./server/... -count=1 -vet=off -timeout=30m -failfast

server-pkg-non-js:
name: Non-JetStream/MQTT/MsgTrace tests
needs: [build-latest, build-supported, lint]
runs-on: ${{ vars.GHA_WORKER_LARGE }}
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Go
uses: actions/setup-go@v5
with:
go-version: stable

- name: Run unit tests
run: go test -race -v -p=1 ./server/... -tags=skip_js_tests,skip_store_tests,skip_mqtt_tests,skip_msgtrace_tests -count=1 -vet=off -timeout=30m -failfast
timeout-minutes: 15

non-server-pkg:
name: Tests from all other packages
needs: [build-latest, build-supported, lint]
runs-on: ${{ vars.GHA_WORKER_MEDIUM }}
name: Lev MQTT test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -275,4 +23,4 @@ jobs:
go-version: stable

- name: Run unit tests
run: go test -race -v -p=1 ./conf/... ./internal/... ./logger/... ./test/... -count=1 -vet=off -timeout=30m -failfast
run: go test -race -v -run=TestMQTTSubRetained ./server -count=10 -timeout=30m -failfast
Loading