get.pme.sh/pnats@v0.0.0-20240304004023-26bb5a137ed0/.github/workflows/tests.yaml (about)

     1  name: NATS Server Tests
     2  
     3  on:
     4    # push:
     5    # pull_request:
     6    schedule:
     7      - cron: "15 * * * *" # Hourly, 15 mins past the hour
     8  
     9  concurrency:
    10    group: ${{ github.workflow }}-${{ github.ref }}
    11    cancel-in-progress: true
    12  
    13  jobs:
    14    lint:
    15      name: Lint
    16      runs-on: ${{ vars.GHA_WORKER_SMALL }}
    17      steps:
    18        - name: Checkout
    19          uses: actions/checkout@v4
    20  
    21        - name: Install Go
    22          uses: actions/setup-go@v5
    23          with:
    24            go-version: stable
    25  
    26        - name: Run golangci-lint
    27          uses: golangci/golangci-lint-action@v4
    28          with:
    29            skip-cache: true
    30            skip-pkg-cache: true
    31            skip-build-cache: true
    32            args: --timeout=5m --config=.golangci.yml
    33  
    34    build-latest:
    35      name: Build (Latest Go)
    36      runs-on: ${{ vars.GHA_WORKER_SMALL }}
    37      steps:
    38        - name: Checkout
    39          uses: actions/checkout@v4
    40  
    41        - name: Install Go
    42          uses: actions/setup-go@v5
    43          with:
    44            go-version: stable
    45  
    46        - name: Build NATS Server
    47          run: go build
    48  
    49    build-supported:
    50      name: Build (Minimum Go)
    51      runs-on: ${{ vars.GHA_WORKER_SMALL }}
    52      steps:
    53        - name: Checkout
    54          uses: actions/checkout@v4
    55  
    56        - name: Install Go
    57          uses: actions/setup-go@v5
    58          with:
    59            go-version-file: "go.mod"
    60  
    61        - name: Build NATS Server
    62          run: go build
    63  
    64    # Using GitHub-supplied workers for Windows for now.
    65    # Note that the below testing steps depend on the Linux build
    66    # only, as the Windows builds take a fair bit longer to set up.
    67    build-windows:
    68      name: Build (Minimum Go, ${{ matrix.os }})
    69      strategy:
    70        fail-fast: false
    71        matrix:
    72          os: [windows-2019, windows-2022]
    73      runs-on: ${{ matrix.os }}
    74      steps:
    75        - name: Checkout
    76          uses: actions/checkout@v4
    77  
    78        - name: Install Go
    79          uses: actions/setup-go@v5
    80          with:
    81            go-version-file: "go.mod"
    82  
    83        - name: Build NATS Server
    84          run: go build
    85  
    86    js-no-cluster:
    87      name: JetStream tests
    88      needs: [build-latest, build-supported, lint]
    89      runs-on: ${{ vars.GHA_WORKER_LARGE }}
    90      steps:
    91        - name: Checkout
    92          uses: actions/checkout@v4
    93  
    94        - name: Install Go
    95          uses: actions/setup-go@v5
    96          with:
    97            go-version: stable
    98  
    99        - name: Run unit tests
   100          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_super_cluster_tests -count=1 -vet=off -timeout=30m -failfast
   101  
   102    js-cluster-1:
   103      name: JetStream Cluster tests (1)
   104      needs: [build-latest, build-supported, lint]
   105      runs-on: ${{ vars.GHA_WORKER_LARGE }}
   106      steps:
   107        - name: Checkout
   108          uses: actions/checkout@v4
   109  
   110        - name: Install Go
   111          uses: actions/setup-go@v5
   112          with:
   113            go-version: stable
   114  
   115        - name: Run unit tests
   116          run: go test -race -v -run=TestJetStreamCluster ./server/... -tags=skip_js_cluster_tests_2,skip_js_cluster_tests_3 -count=1 -vet=off -timeout=30m -failfast
   117  
   118    js-cluster-2:
   119      name: JetStream Cluster tests (2)
   120      needs: [build-latest, build-supported, lint]
   121      runs-on: ${{ vars.GHA_WORKER_LARGE }}
   122      steps:
   123        - name: Checkout
   124          uses: actions/checkout@v4
   125  
   126        - name: Install Go
   127          uses: actions/setup-go@v5
   128          with:
   129            go-version: stable
   130  
   131        - name: Run unit tests
   132          run: go test -race -v -run=TestJetStreamCluster ./server/... -tags=skip_js_cluster_tests,skip_js_cluster_tests_3 -count=1 -vet=off -timeout=30m -failfast
   133  
   134    js-cluster-3:
   135      name: JetStream Cluster tests (3)
   136      needs: [build-latest, build-supported, lint]
   137      runs-on: ${{ vars.GHA_WORKER_LARGE }}
   138      steps:
   139        - name: Checkout
   140          uses: actions/checkout@v4
   141  
   142        - name: Install Go
   143          uses: actions/setup-go@v5
   144          with:
   145            go-version: stable
   146  
   147        - name: Run unit tests
   148          run: go test -race -v -run=TestJetStreamCluster ./server/... -tags=skip_js_cluster_tests,skip_js_cluster_tests_2 -count=1 -vet=off -timeout=30m -failfast
   149  
   150    js-supercluster:
   151      name: JetStream Supercluster tests
   152      needs: [build-latest, build-supported, lint]
   153      runs-on: ${{ vars.GHA_WORKER_LARGE }}
   154      steps:
   155        - name: Checkout
   156          uses: actions/checkout@v4
   157  
   158        - name: Install Go
   159          uses: actions/setup-go@v5
   160          with:
   161            go-version: stable
   162  
   163        - name: Run unit tests
   164          run: go test -race -v -run=TestJetStreamSuperCluster ./server/... -count=1 -vet=off -timeout=30m -failfast
   165  
   166    no-race:
   167      name: No-race tests
   168      needs: [build-latest, build-supported, lint]
   169      runs-on: ${{ vars.GHA_WORKER_LARGE }}
   170      steps:
   171        - name: Checkout
   172          uses: actions/checkout@v4
   173  
   174        - name: Install Go
   175          uses: actions/setup-go@v5
   176          with:
   177            go-version: stable
   178  
   179        - name: Run unit tests
   180          run: go test -v -p=1 -run=TestNoRace ./... -count=1 -vet=off -timeout=30m -failfast
   181  
   182    js-chaos:
   183      name: JetStream chaos tests
   184      if: ${{ false }} # Don't run for now
   185      needs: [build-latest, build-supported, lint]
   186      runs-on: ${{ vars.GHA_WORKER_LARGE }}
   187      steps:
   188        - name: Checkout
   189          uses: actions/checkout@v4
   190  
   191        - name: Install Go
   192          uses: actions/setup-go@v5
   193          with:
   194            go-version: stable
   195  
   196        - name: Run unit tests
   197          run: go test -race -v -p=1 -run=TestJetStreamChaos ./server/... -tags=js_chaos_tests -count=1 -vet=off -timeout=30m -failfast
   198  
   199    mqtt:
   200      name: MQTT tests
   201      needs: [build-latest, build-supported, lint]
   202      runs-on: ${{ vars.GHA_WORKER_MEDIUM }}
   203      steps:
   204        - name: Checkout
   205          uses: actions/checkout@v4
   206  
   207        - name: Install Go
   208          uses: actions/setup-go@v5
   209          with:
   210            go-version: stable
   211  
   212        - name: Run unit tests
   213          run: go test -race -v -run=TestMQTT ./server/... -count=1 -vet=off -timeout=30m -failfast
   214  
   215    server-pkg-non-js:
   216      name: Non-JetStream/MQTT tests
   217      needs: [build-latest, build-supported, lint]
   218      runs-on: ${{ vars.GHA_WORKER_LARGE }}
   219      steps:
   220        - name: Checkout
   221          uses: actions/checkout@v4
   222  
   223        - name: Install Go
   224          uses: actions/setup-go@v5
   225          with:
   226            go-version: stable
   227  
   228        - name: Run unit tests
   229          run: go test -race -v -p=1 ./server/... -tags=skip_js_tests,skip_mqtt_tests -count=1 -vet=off -timeout=30m -failfast
   230          timeout-minutes: 15
   231  
   232    non-server-pkg:
   233      name: Tests from all other packages
   234      needs: [build-latest, build-supported, lint]
   235      runs-on: ${{ vars.GHA_WORKER_MEDIUM }}
   236      steps:
   237        - name: Checkout
   238          uses: actions/checkout@v4
   239  
   240        - name: Install Go
   241          uses: actions/setup-go@v5
   242          with:
   243            go-version: stable
   244  
   245        - name: Run unit tests
   246          run: go test -race -v -p=1 ./conf/... ./internal/... ./logger/... ./test/... -count=1 -vet=off -timeout=30m -failfast