diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2c3c263..bb9a724 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,7 +2,6 @@ name: ci on: push: - pull_request: workflow_dispatch: concurrency: @@ -16,7 +15,7 @@ jobs: GO111MODULE: "on" steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install Go uses: actions/setup-go@v4 @@ -27,12 +26,18 @@ jobs: run: go get ./... - name: Build - run: go build -v . + run: go build -ldflags="-s -w" -gcflags=all="-l -B" -trimpath -buildvcs=false -v . + + - name: Run UPX + uses: crazy-max/ghaction-upx@v3 + with: + files: goqoa.exe + args: --brute - name: Go Test run: go test -v ./... - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: windows path: goqoa.exe @@ -44,7 +49,7 @@ jobs: CGO_ENABLED: 1 steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install Go uses: actions/setup-go@v4 @@ -55,12 +60,12 @@ jobs: run: go get ./... - name: Build - run: go build -o goqoa-mac -v . + run: go build -ldflags="-s -w" -gcflags=all="-l -B" -trimpath -buildvcs=false -o goqoa-mac -v . - name: Go Test run: go test -v ./... - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: mac path: goqoa-mac @@ -72,7 +77,7 @@ jobs: CGO_ENABLED: 1 steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install Go uses: actions/setup-go@v4 @@ -83,20 +88,31 @@ jobs: run: | go get ./... sudo apt-get update - sudo apt-get install -y libasound2-dev libmp3lame-dev + sudo apt-get install -y libasound2-dev - name: Build - run: go build -o goqoa-linux -v . + run: | + go build -ldflags="-s -w" -gcflags=all="-l -B" -trimpath -buildvcs=false -o goqoa-linux -v . + upx --best goqoa-linux - name: Go Test run: go test -v ./... + - name: Cache large spec pack + uses: actions/cache@v3 + with: + key: qoa_test_samples_2023_02_18.zip + path: qoa_test_samples_2023_02_18.zip + + - name: Download large spec pack + run: wget --timestamping https://qoaformat.org/samples/qoa_test_samples_2023_02_18.zip + - name: Spec Test run: | sudo cp goqoa-linux /usr/bin/goqoa bash check_spec.sh - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: linux path: goqoa-linux @@ -113,8 +129,8 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v3 - - uses: actions/download-artifact@v3 + uses: actions/checkout@v4 + - uses: actions/checkout@v4 - name: Release uses: softprops/action-gh-release@v1 with: diff --git a/README.md b/README.md index 9b2657d..6da61cb 100644 --- a/README.md +++ b/README.md @@ -35,9 +35,9 @@ The easiest way is a pre-built binary on the [Releases](https://github.com/brahe Otherwise, install prerequisites for your platform: # Fedora - yum install gcc alsa-lib-devel lame-devel + yum install gcc alsa-lib-devel # Debian - apt-get install gcc pkg-config libasound2-dev libmp3lame-dev + apt-get install gcc pkg-config libasound2-dev Then, install directly with Go: diff --git a/check_spec.sh b/check_spec.sh index 2add6f8..c43af52 100755 --- a/check_spec.sh +++ b/check_spec.sh @@ -17,7 +17,7 @@ size_compare() { size2=$(stat -c %s "$2") if [ "$size1" != "$size2" ]; then - echo "Checksums do not match!" + echo "Sizes do not match!" echo "$1: $size1" echo "$2: $size2" exit 1 @@ -37,18 +37,20 @@ fi selected_songs=$(unzip -Z1 "$spec_zip" '*.wav' -x '*.qoa.wav' | shuf -n "$num_songs") for song in $selected_songs; do + echo "Checking $song..." song_filename=$(basename "$song") song_name="${song_filename%.*}" unzip -j -qq $spec_zip "*$song_name*" -d "$temp_dir" - goqoa -q convert "$temp_dir/$song_name.wav" "$temp_dir/my-$song_name.qoa" + goqoa convert "$temp_dir/$song_name.wav" "$temp_dir/my-$song_name.qoa" size_compare "$temp_dir/$song_name.qoa" "$temp_dir/my-$song_name.qoa" + goqoa -h goqoa -q convert "$temp_dir/my-$song_name.qoa" "$temp_dir/my-$song_name.qoa.wav" size_compare "$temp_dir/$song_name.qoa.wav" "$temp_dir/my-$song_name.qoa.wav" - echo -e "$song_name\tOK" + echo "OK" done rm -rf "$temp_dir" &>/dev/null diff --git a/go.mod b/go.mod index 326b40e..eeb1556 100644 --- a/go.mod +++ b/go.mod @@ -8,15 +8,15 @@ require ( github.com/go-audio/audio v1.0.0 github.com/go-audio/wav v1.1.0 github.com/jfreymuth/oggvorbis v1.0.5 - github.com/spf13/cobra v1.8.0 github.com/mewkiz/flac v1.0.10 + github.com/spf13/cobra v1.8.0 github.com/stretchr/testify v1.8.4 github.com/tosone/minimp3 v1.0.2 ) require ( github.com/davecgh/go-spew v1.1.1 // indirect - github.com/ebitengine/purego v0.5.0 // indirect + github.com/ebitengine/purego v0.6.0 // indirect github.com/go-audio/riff v1.0.0 // indirect github.com/icza/bitio v1.1.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect diff --git a/go.sum b/go.sum index 781e73e..3468a72 100644 --- a/go.sum +++ b/go.sum @@ -6,8 +6,8 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/ebitengine/oto/v3 v3.1.0 h1:9tChG6rizyeR2w3vsygTTTVVJ9QMMyu00m2yBOCch6U= github.com/ebitengine/oto/v3 v3.1.0/go.mod h1:IK1QTnlfZK2GIB6ziyECm433hAdTaPpOsGMLhEyEGTg= -github.com/ebitengine/purego v0.5.0 h1:JrMGKfRIAM4/QVKaesIIT7m/UVjTj5GYhRSQYwfVdpo= -github.com/ebitengine/purego v0.5.0/go.mod h1:ah1In8AOtksoNK6yk5z1HTJeUkC1Ez4Wk2idgGslMwQ= +github.com/ebitengine/purego v0.6.0 h1:Yo9uBc1x+ETQbfEaf6wcBsjrQfCEnh/gaGUg7lguEJY= +github.com/ebitengine/purego v0.6.0/go.mod h1:ah1In8AOtksoNK6yk5z1HTJeUkC1Ez4Wk2idgGslMwQ= github.com/go-audio/audio v1.0.0 h1:zS9vebldgbQqktK4H0lUqWrG8P0NxCJVqcj7ZpNnwd4= github.com/go-audio/audio v1.0.0/go.mod h1:6uAu0+H2lHkwdGsAY+j2wHPNPpPoeg5AaEFh9FlA+Zs= github.com/go-audio/riff v1.0.0 h1:d8iCGbDvox9BfLagY94fBynxSPHO80LmZCaOsmKxokA= diff --git a/pkg/qoa/qoa_test.go b/pkg/qoa/qoa_test.go index 1bba300..5039669 100644 --- a/pkg/qoa/qoa_test.go +++ b/pkg/qoa/qoa_test.go @@ -1,10 +1,10 @@ package qoa import ( + "bytes" "fmt" "log" "os" - "reflect" "testing" "github.com/go-audio/wav" @@ -28,7 +28,7 @@ func TestEncodeHeader(t *testing.T) { qoa.encodeHeader(header) - if !reflect.DeepEqual(header, expectedHeader) { + if !bytes.Equal(header, expectedHeader) { t.Errorf("Header encoding mismatch.\nExpected: %#v\nGot: %#v", expectedHeader, header) } }