Skip to content

Commit 1d60dce

Browse files
committed
Import GitHub Actions, goreleaser and golangci-lint workflow changes from main
Signed-off-by: Neil Twigg <neil@nats.io>
1 parent 99e836e commit 1d60dce

8 files changed

Lines changed: 35 additions & 29 deletions

File tree

.github/workflows/long-tests.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ concurrency:
1616
jobs:
1717
js-long:
1818
name: Long JetStream tests
19-
runs-on: ${{ vars.GHA_WORKER_SMALL }}
19+
runs-on: ${{ vars.GHA_WORKER_MEDIUM || 'ubuntu-latest' }}
2020
steps:
2121
- name: Checkout
2222
uses: actions/checkout@v4

.github/workflows/mqtt-test.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
name: MQTT external test
1+
name: MQTT External Tests
22
on: [pull_request]
33

44
jobs:
55
test:
66
env:
77
GOPATH: /home/runner/work/nats-server
88
GO111MODULE: "on"
9-
runs-on: ubuntu-latest
9+
runs-on: ${{ vars.GHA_WORKER_SMALL || 'ubuntu-latest' }}
1010
steps:
1111
- name: Checkout code
1212
uses: actions/checkout@v4

.github/workflows/nightly.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ on:
1212

1313
jobs:
1414
run:
15-
runs-on: ubuntu-latest
15+
runs-on: ${{ vars.GHA_WORKER_RELEASE || 'ubuntu-latest' }}
1616
steps:
1717
- name: Checkout code
1818
uses: actions/checkout@v4

.github/workflows/release.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,13 @@ on:
44
tags:
55
- v*
66

7+
permissions:
8+
contents: write
9+
710
jobs:
811
run:
912
name: GitHub Release
10-
runs-on: ubuntu-latest
13+
runs-on: ${{ vars.GHA_WORKER_RELEASE || 'ubuntu-latest' }}
1114
steps:
1215
- name: Checkout code
1316
uses: actions/checkout@v4
@@ -41,4 +44,5 @@ jobs:
4144
version: "~> v2"
4245
args: release --clean
4346
env:
47+
GITHUB_REPOSITORY_NAME: ${{ github.event.repository.name }}
4448
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/stale-issues.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: stale-issues
1+
name: Stale Issues
22
on:
33
schedule:
44
- cron: "30 1 * * *"

.github/workflows/tests.yaml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ on:
55
pull_request:
66
workflow_dispatch:
77

8+
env:
9+
RACE: ${{ (github.ref != 'refs/heads/main' && !startsWith(github.ref, 'refs/heads/release/') && github.event_name != 'pull_request') && '-race' || '' }}
10+
811
concurrency:
912
group: ${{ github.workflow }}-${{ github.ref }}
1013
cancel-in-progress: ${{ github.ref != 'refs/heads/main' && !startsWith(github.ref, 'refs/heads/release/') }}
@@ -25,6 +28,7 @@ jobs:
2528
- name: Run golangci-lint
2629
uses: golangci/golangci-lint-action@v6
2730
with:
31+
version: v1.64.8
2832
skip-cache: true
2933
skip-save-cache: true
3034
args: --timeout=5m --config=.golangci.yml
@@ -114,7 +118,7 @@ jobs:
114118
run: ./scripts/runTestsOnTravis.sh js_tests
115119

116120
js-cluster-1:
117-
name: Test JetStream Cluster (1)
121+
name: Test JetStream Cluster 1
118122
needs: [build-latest, build-supported, lint]
119123
runs-on: ${{ vars.GHA_WORKER_LARGE || 'ubuntu-latest' }}
120124
steps:
@@ -130,7 +134,7 @@ jobs:
130134
run: ./scripts/runTestsOnTravis.sh js_cluster_tests_1
131135

132136
js-cluster-2:
133-
name: Test JetStream Cluster (2)
137+
name: Test JetStream Cluster 2
134138
needs: [build-latest, build-supported, lint]
135139
runs-on: ${{ vars.GHA_WORKER_LARGE || 'ubuntu-latest' }}
136140
steps:
@@ -146,7 +150,7 @@ jobs:
146150
run: ./scripts/runTestsOnTravis.sh js_cluster_tests_2
147151

148152
js-cluster-3:
149-
name: Test JetStream Cluster (3)
153+
name: Test JetStream Cluster 3
150154
needs: [build-latest, build-supported, lint]
151155
runs-on: ${{ vars.GHA_WORKER_LARGE || 'ubuntu-latest' }}
152156
steps:
@@ -162,7 +166,7 @@ jobs:
162166
run: ./scripts/runTestsOnTravis.sh js_cluster_tests_3
163167

164168
js-cluster-4:
165-
name: Test JetStream Cluster (4)
169+
name: Test JetStream Cluster 4
166170
needs: [build-latest, build-supported, lint]
167171
runs-on: ${{ vars.GHA_WORKER_LARGE || 'ubuntu-latest' }}
168172
steps:
@@ -242,7 +246,7 @@ jobs:
242246
run: ./scripts/runTestsOnTravis.sh msgtrace_tests
243247

244248
server-pkg-non-js:
245-
name: Test Non-JetStream/MQTT/Message Tracing
249+
name: Test Remaining Server Tests
246250
needs: [build-latest, build-supported, lint]
247251
runs-on: ${{ vars.GHA_WORKER_MEDIUM || 'ubuntu-latest' }}
248252
steps:

.goreleaser.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ version: 2
44
release:
55
github:
66
owner: '{{ envOrDefault "GITHUB_REPOSITORY_OWNER" "nats-io" }}'
7-
name: nats-server
7+
name: '{{ envOrDefault "GITHUB_REPOSITORY_NAME" "nats-server" }}'
88
name_template: "Release {{.Tag}}"
99
draft: true
1010

scripts/runTestsOnTravis.sh

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
#!/bin/sh
22

3-
set -e
3+
set -ex
44

55
if [ "$1" = "compile" ]; then
66
# First check that NATS builds.
7-
go build;
7+
go build -v;
88

99
# Now run the linters.
1010
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.64.4;
1111
golangci-lint run;
1212
if [ "$TRAVIS_TAG" != "" ]; then
13-
go test -race -v -run=TestVersionMatchesTag ./server -ldflags="-X=github.com/nats-io/nats-server/v2/server.serverVersion=$TRAVIS_TAG" -count=1 -vet=off
13+
go test -v -run=TestVersionMatchesTag ./server -ldflags="-X=github.com/nats-io/nats-server/v2/server.serverVersion=$TRAVIS_TAG" -count=1 -vet=off
1414
fi
1515

1616
elif [ "$1" = "build_only" ]; then
17-
go build;
17+
go build -v;
1818

1919
elif [ "$1" = "no_race_tests" ]; then
2020

@@ -28,33 +28,31 @@ elif [ "$1" = "store_tests" ]; then
2828
# Run store tests. By convention, all file store tests start with `TestFileStore`,
2929
# and memory store tests start with `TestMemStore`.
3030

31-
go test -race -v -run=TestMemStore ./server -count=1 -vet=off -timeout=30m -failfast
32-
go test -race -v -run=TestFileStore ./server -count=1 -vet=off -timeout=30m -failfast
33-
go test -race -v -run=TestStore ./server -count=1 -vet=off -timeout=30m -failfast
31+
go test $RACE -v -p=1 -run=Test\(Store\|FileStore\|MemStore\) ./server -count=1 -vet=off -timeout=30m -failfast
3432

3533
elif [ "$1" = "js_tests" ]; then
3634

3735
# Run JetStream non-clustered tests. By convention, all JS tests start
3836
# with `TestJetStream`. We exclude the clustered and super-clustered
3937
# tests by using the appropriate tags.
4038

41-
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
39+
go test $RACE -v -p=1 -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
4240

4341
elif [ "$1" = "js_cluster_tests_1" ]; then
4442

4543
# Run JetStream clustered tests. By convention, all JS cluster tests
4644
# start with `TestJetStreamCluster`. Will run the first batch of tests,
4745
# excluding others with use of proper tags.
4846

49-
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
47+
go test $RACE -v -p=1 -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
5048

5149
elif [ "$1" = "js_cluster_tests_2" ]; then
5250

5351
# Run JetStream clustered tests. By convention, all JS cluster tests
5452
# start with `TestJetStreamCluster`. Will run the second batch of tests,
5553
# excluding others with use of proper tags.
5654

57-
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
55+
go test $RACE -v -p=1 -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
5856

5957
elif [ "$1" = "js_cluster_tests_3" ]; then
6058

@@ -63,7 +61,7 @@ elif [ "$1" = "js_cluster_tests_3" ]; then
6361
# excluding others with use of proper tags.
6462
#
6563

66-
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
64+
go test $RACE -v -p=1 -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
6765

6866
elif [ "$1" = "js_cluster_tests_4" ]; then
6967

@@ -72,26 +70,26 @@ elif [ "$1" = "js_cluster_tests_4" ]; then
7270
# excluding others with use of proper tags.
7371
#
7472

75-
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
73+
go test $RACE -v -p=1 -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
7674

7775
elif [ "$1" = "js_super_cluster_tests" ]; then
7876

7977
# Run JetStream super clustered tests. By convention, all JS super cluster
8078
# tests start with `TestJetStreamSuperCluster`.
8179

82-
go test -race -v -run=TestJetStreamSuperCluster ./server -count=1 -vet=off -timeout=30m -failfast
80+
go test $RACE -v -p=1 -run=TestJetStreamSuperCluster ./server -count=1 -vet=off -timeout=30m -failfast
8381

8482
elif [ "$1" = "mqtt_tests" ]; then
8583

8684
# Run MQTT tests. By convention, all MQTT tests start with `TestMQTT`.
8785

88-
go test -race -v -run=TestMQTT ./server -count=1 -vet=off -timeout=30m -failfast
86+
go test $RACE -v -p=1 -run=TestMQTT ./server -count=1 -vet=off -timeout=30m -failfast
8987

9088
elif [ "$1" = "msgtrace_tests" ]; then
9189

9290
# Run Message Tracing tests. By convention, all message tracing tests start with `TestMsgTrace`.
9391

94-
go test -race -v -run=TestMsgTrace ./server -count=1 -vet=off -timeout=30m -failfast
92+
go test $RACE -v -p=1 -run=TestMsgTrace ./server -count=1 -vet=off -timeout=30m -failfast
9593

9694
elif [ "$1" = "srv_pkg_non_js_tests" ]; then
9795

@@ -101,12 +99,12 @@ elif [ "$1" = "srv_pkg_non_js_tests" ]; then
10199
# message tracing tests by using `skip_msgtrace_tests`.
102100

103101
# Also including the ldflag with the version since this includes the `TestVersionMatchesTag`.
104-
go test -race -v -p=1 ./server/... -ldflags="-X=github.com/nats-io/nats-server/v2/server.serverVersion=$TRAVIS_TAG" -tags=skip_store_tests,skip_js_tests,skip_mqtt_tests,skip_msgtrace_tests -count=1 -vet=off -timeout=30m -failfast
102+
go test $RACE -v -p=1 ./server/... -ldflags="-X=github.com/nats-io/nats-server/v2/server.serverVersion=$TRAVIS_TAG" -tags=skip_store_tests,skip_js_tests,skip_mqtt_tests,skip_msgtrace_tests,skip_no_race_tests -count=1 -vet=off -timeout=30m -failfast
105103

106104
elif [ "$1" = "non_srv_pkg_tests" ]; then
107105

108106
# Run all tests of all non server package.
109107

110-
go test -race -v -p=1 $(go list ./... | grep -v "/server") -count=1 -vet=off -timeout=30m -failfast
108+
go test $RACE -v -p=1 $(go list ./... | grep -v "/server") -count=1 -vet=off -timeout=30m -failfast
111109

112110
fi

0 commit comments

Comments
 (0)