Skip to content

ci(push): replace golangci-lint with super-linter #308

ci(push): replace golangci-lint with super-linter

ci(push): replace golangci-lint with super-linter #308

Workflow file for this run

name: push
on:
push:
branches:
- master
pull_request:
branches:
- master
permissions:
actions: read
attestations: none
checks: none
contents: read
deployments: none
id-token: none
issues: none
discussions: none
packages: write
pages: none
pull-requests: read
repository-projects: none
security-events: none
statuses: none
jobs:
commitlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: wagoid/commitlint-github-action@v5
codespell:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: codespell-project/actions-codespell@v2
with:
check_filenames: true
super-linter:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: super-linter/super-linter@latest
env:
GITHUB_TOKEN: ${{ secrets.GH_ACTIONS_SPOTITUBE }}
VALIDATE_ALL_CODEBASE: false
VALIDATE_GO: false
gofumpt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
- run: |
PATH="$PATH:$(go env GOPATH)/bin"
export PATH
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@v4
- 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@v4
- 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@v4
- run: test "$(grep -cr 'defer gomonkey\.')" = "$(grep -cr 'Reset()$')"
test:
runs-on: ubuntu-latest
needs:
[
commitlint,
codespell,
super-linter,
gofumpt,
go-channel-closure,
go-http-body-closure,
go-monkey-unpatch,
]
if: success()
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
- 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@v4
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
docs:
- 'docs/**'
- uses: peter-evans/repository-dispatch@v3
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@v4
- uses: actions/setup-go@v5
- 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@v4
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/build-push-action@v6
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' }}