Skip to content

test(sync): restore tests passing locally #266

test(sync): restore tests passing locally

test(sync): restore tests passing locally #266

Workflow file for this run

name: push
on:
push:
branches:
- master
pull_request:
branches:
- master
permissions: write-all
jobs:
commitlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: wagoid/commitlint-github-action@v5
codespell:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: codespell-project/actions-codespell@v2
with:
check_filenames: true
golangci-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: golangci/golangci-lint-action@v3
gofumpt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
- run: |
export PATH=$PATH:$(go env GOPATH)/bin
go install mvdan.cc/gofumpt@latest
if gofumpt -l -e . | grep '^' -q; then exit 1; fi
go-channel-closure:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: test "$(grep -Erc --exclude-dir=".git*" 'make\(chan\s')" = "$(grep -Erc --exclude-dir=".git*" '\sclose\(')"
go-http-body-closure:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: test "$(grep -rc --exclude-dir=".git*" 'http.Get(\|http.Head(\|http.DefaultClient.Do(')" = "$(grep -rc --exclude-dir=".git*" '.Body.Close()')"
go-monkey-unpatch:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: test "$(grep -cr 'defer gomonkey\.')" = "$(grep -cr 'Reset()$')"
test:
runs-on: ubuntu-latest
needs: [commitlint, codespell, golangci-lint, gofumpt, go-channel-closure, go-http-body-closure, go-monkey-unpatch]
if: success()
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
- run: |
go test -v -timeout 30s -coverprofile=coverage.out ./...
go tool cover -func=coverage.out | grep -E '^total:.*100.0%$'
env:
XDG_MUSIC_DIR: /tmp
notify:
needs: [test]
if: success() && github.event_name == 'push' && github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
docs:
- 'docs/**'
- uses: peter-evans/repository-dispatch@v2
if: steps.filter.outputs.docs == 'true'
with:
token: ${{ secrets.GH_ACTIONS_SPOTITUBE }}
repository: streambinder/streambinder
event-type: doc-sync
client-payload: '{"repo": "${{ github.repository }}", "ref": "${{ github.ref }}", "sha": "${{ github.sha }}"}'
benchmark:
runs-on: ubuntu-latest
needs: [test]
if: success()
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
- run: go test -benchmem -bench '^Benchmark.*$' ./... | grep ^Benchmark
build:
runs-on: ubuntu-latest
needs: [test]
if: success() && github.event_name == 'push' && github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v3
- uses: docker/setup-qemu-action@v2
- uses: docker/setup-buildx-action@v2
- uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/build-push-action@v4
with:
secrets: |
SPOTIFY_ID=${{ secrets.SPOTIFY_ID }}
SPOTIFY_KEY=${{ secrets.SPOTIFY_KEY }}
GENIUS_TOKEN=${{ secrets.GENIUS_TOKEN }}
platforms: linux/amd64,linux/arm/v7,linux/arm64/v8
tags: ghcr.io/streambinder/spotitube:latest
push: ${{ github.event_name != 'pull_request' }}