mirror of
https://github.com/livekit/livekit.git
synced 2026-04-30 05:55:34 +00:00
77b8e9eecb
* Use grants clone * Fix a couple of more races Use a shadow copy of down tracks in DownTrackSpreader. Read always uses the shadow. On Add/Delete of down track, make a new copy. Copying is done only on add/delete. If somebody is holding reference to a shadow, it will be in tact as Add/Delete create a new slice. With this, not seeing any more races in test. So, enabling CI tests with `-race`. Also fixing another race reported in #603 There are a couple of more races in that bug report that needs to be chased down. * Use env suggested in https://lifesaver.codes/answer/runtime-race-detector-sigabrt-or-sigsegv-on-macos-monterey-49138 * staticcheck, did not fail locally, but reported by CI * use API to get down tracks
70 lines
1.8 KiB
YAML
70 lines
1.8 KiB
YAML
name: Test
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
branches: [ master ]
|
|
pull_request:
|
|
branches: [ master ]
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- uses: actions/cache@v2
|
|
with:
|
|
path: |
|
|
~/go/pkg/mod
|
|
~/go/bin
|
|
~/.cache
|
|
key: livekit-server
|
|
- uses: shogo82148/actions-setup-redis@v1.10.3
|
|
with:
|
|
redis-version: '6.x'
|
|
auto-start: true
|
|
- run: redis-cli ping
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v2
|
|
with:
|
|
go-version: 1.17
|
|
|
|
- name: Set up gotestfmt
|
|
run: go install github.com/haveyoudebuggedit/gotestfmt/v2/cmd/gotestfmt@latest
|
|
|
|
- name: Replace mutexes
|
|
run: |
|
|
go get github.com/sasha-s/go-deadlock
|
|
grep -rl sync.Mutex ./pkg | xargs sed -i 's/sync\.Mutex/deadlock\.Mutex/g'
|
|
grep -rl sync.RWMutex ./pkg | xargs sed -i 's/sync\.RWMutex/deadlock\.RWMutex/g'
|
|
go install golang.org/x/tools/cmd/goimports
|
|
grep -rl deadlock.Mutex ./pkg | xargs goimports -w
|
|
grep -rl deadlock.RWMutex ./pkg | xargs goimports -w
|
|
go mod tidy
|
|
|
|
- name: Mage Build
|
|
uses: magefile/mage-action@v1
|
|
with:
|
|
version: latest
|
|
args: build
|
|
|
|
- name: Static Check
|
|
uses: dominikh/staticcheck-action@v1.1.0
|
|
with:
|
|
version: "2021.1.1"
|
|
|
|
- name: Test
|
|
run: |
|
|
set -euo pipefail
|
|
MallocNanoZone=0 go test -race -json -v ./... 2>&1 | tee /tmp/gotest.log | gotestfmt
|
|
|
|
# Upload the original go test log as an artifact for later review.
|
|
- name: Upload test log
|
|
uses: actions/upload-artifact@v2
|
|
if: always()
|
|
with:
|
|
name: test-log
|
|
path: /tmp/gotest.log
|
|
if-no-files-found: error
|