8000 Add Github workflow file by MarkKremer · Pull Request #124 · gopxl/beep · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add Github workflow file #124

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Oct 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go

name: Go

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:

build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version-file: 'go.mod'

- name: Install goveralls
if: ${{ github.ref == 'refs/heads/main' }}
run: go install github.com/mattn/goveralls@latest

# Install ALSA for building Oto
- name: Install ALSA
run: sudo apt install libasound2-dev

- name: Build
run: go build -v ./...

- name: Test
run: go test -v -covermode atomic -coverprofile=covprofile ./...

- name: Gofmt
# Run gofmt, print the output and exit with status code 1 if it isn't empty.
run: |
OUTPUT=$(gofmt -d ./)
echo "$OUTPUT"
test -z "$OUTPUT"

- name: Send coverage
if: ${{ github.ref == 'refs/heads/main' }}
env:
COVERALLS_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
run: goveralls -coverprofile=covprofile -service=github
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
# Beep [![GoDoc](https://godoc.org/github.com/gopxl/beep?status.svg)](https://godoc.org/github.com/gopxl/beep) [![Go Report Card](https://goreportcard.com/badge/github.com/gopxl/beep)](https://goreportcard.com/report/github.com/gopxl/beep) [![Discord Chat](https://img.shields.io/discord/1158461233121468496)](https://discord.gg/erpa32cB) [![Coverage Status](https://coveralls.io/repos/github/gopxl/beep/badge.svg?branch=main)](https://coveralls.io/github/gopxl/beep?branch=main)
# Beep

[![GoDoc](https://godoc.org/github.com/gopxl/beep?status.svg)](https://godoc.org/github.com/gopxl/beep)
[![Go build status](https://github.com/gopxl/beep/actions/workflows/go.yml/badge.svg?branch=main)](https://github.com/gopxl/beep/actions/workflows/go.yml?query=branch%3Amain)
[![Coverage Status](https://coveralls.io/repos/github/gopxl/beep/badge.svg?branch=main)](https://coveralls.io/github/gopxl/beep?branch=main)
[![Go Report Card](https://goreportcard.com/badge/github.com/gopxl/beep)](https://goreportcard.com/report/github.com/gopxl/beep)
[![Discord Chat](https://img.shields.io/discord/1158461233121468496)](https://discord.gg/erpa32cB)


A little package that brings sound to any Go application. Suitable for playback and audio-processing.

Expand Down
4 changes: 2 additions & 2 deletions resample.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func ResampleRatio(quality int, ratio float64, s Streamer) *Resampler {
panic(fmt.Errorf("resample: invalid quality: %d", quality))
}
if math.IsInf(ratio, 0) || math.IsNaN(ratio) {
panic(fmt.Errorf("resample: invalid ratio: %d", ratio))
panic(fmt.Errorf("resample: invalid ratio: %f", ratio))
}
return &Resampler{
s: s,
Expand Down Expand Up @@ -155,7 +155,7 @@ func (r *Resampler) Ratio() float64 {
// SetRatio sets the resampling ratio. This does not cause any glitches in the stream.
func (r *Resampler) SetRatio(ratio float64) {
if math.IsInf(ratio, 0) || math.IsNaN(ratio) {
panic(fmt.Errorf("resample: invalid ratio: %d", ratio))
panic(fmt.Errorf("resample: invalid ratio: %f", ratio))
}
r.pos = int(float64(r.pos) * r.ratio / ratio)
r.ratio = ratio
Expand Down
0