github.com/livekit/protocol@v1.16.1-0.20240517185851-47e4c6bba773/.github/workflows/buildtest.yaml (about)

     1  # Copyright 2023 LiveKit, Inc.
     2  #
     3  # Licensed under the Apache License, Version 2.0 (the "License");
     4  # you may not use this file except in compliance with the License.
     5  # You may obtain a copy of the License at
     6  #
     7  #     http://www.apache.org/licenses/LICENSE-2.0
     8  #
     9  # Unless required by applicable law or agreed to in writing, software
    10  # distributed under the License is distributed on an "AS IS" BASIS,
    11  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  # See the License for the specific language governing permissions and
    13  # limitations under the License.
    14  
    15  name: Test
    16  
    17  on:
    18    workflow_dispatch:
    19    push:
    20      branches: [main]
    21    pull_request:
    22      branches: [main]
    23  
    24  jobs:
    25    test:
    26      runs-on: ubuntu-latest
    27      steps:
    28        - uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4
    29        - uses: actions/cache@v4
    30          with:
    31            path: |
    32              ~/go/pkg/mod
    33              ~/go/bin
    34              ~/.cache
    35            key: livekit-protocol
    36  
    37        - name: Set up Go
    38          uses: actions/setup-go@v5
    39          with:
    40            go-version-file: 'go.mod'
    41  
    42        - name: Set up gotestfmt
    43          run: go install github.com/gotesttools/gotestfmt/v2/cmd/gotestfmt@v2.4.1
    44  
    45        - name: Download Go modules
    46          run: go mod download
    47  
    48        - name: Static Check
    49          uses: amarpal/staticcheck-action@master
    50          with:
    51            checks: '["all", "-ST1000", "-ST1003", "-ST1020", "-ST1021", "-ST1022", "-SA1019"]'
    52            install-go: false
    53  
    54        - name: Test
    55          run: |
    56            set -euo pipefail
    57            MallocNanoZone=0 go test -race -json -v ./... 2>&1 | gotestfmt