diff --git a/.gitattributes b/.gitattributes index e1c269d34a..402433593c 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1 +1,2 @@ +* -text *.bin -text -diff diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml new file mode 100644 index 0000000000..1c570845d4 --- /dev/null +++ b/.github/workflows/go.yml @@ -0,0 +1,69 @@ +name: Go + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + + +jobs: + build: + strategy: + matrix: + go-version: [1.14.x, 1.15.x, 1.16.x] + os: [ubuntu-latest, macos-latest, windows-latest] + env: + CGO_ENABLED: 0 + runs-on: ${{ matrix.os }} + steps: + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: ${{ matrix.go-version }} + + - name: Checkout code + uses: actions/checkout@v2 + + - name: Vet + run: go vet ./... + + - name: Test + run: go test ./... + + - name: Test Noasm + run: go test -tags=noasm ./... + + - name: Test Race + env: + CGO_ENABLED: 1 + run: go test -cpu="1,4" -short -race ./... + + build-special: + env: + CGO_ENABLED: 0 + runs-on: ubuntu-latest + steps: + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: 1.16.x + + - name: Checkout code + uses: actions/checkout@v2 + + - name: fmt + run: diff <(gofmt -d .) <(printf "") + + - name: Test 386 + run: GOOS=linux GOARCH=386 go test -short ./... + + - name: Build s2c + run: go build github.com/klauspost/compress/s2/cmd/s2c && go build github.com/klauspost/compress/s2/cmd/s2d&&./s2c -verify s2c &&./s2d s2c.s2&&rm ./s2c&&rm s2d&&rm s2c.s2 + + - name: goreleaser deprecation + run: curl -sfL https://git.io/goreleaser | VERSION=v0.162.0 sh -s -- check + + - name: goreleaser snapshot + run: curl -sL https://git.io/goreleaser | VERSION=v0.162.0 sh -s -- --snapshot --skip-publish --rm-dist + diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000000..91b70c328c --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,30 @@ +name: goreleaser + +on: + push: + tags: + - 'v*' + +jobs: + goreleaser: + runs-on: ubuntu-latest + steps: + - + name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - + name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: 1.16 + - + name: Run GoReleaser + uses: goreleaser/goreleaser-action@v2 + with: + version: 0.162.0 + args: release --rm-dist + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + CGO_ENABLED: 0 diff --git a/.goreleaser.yml b/.goreleaser.yml index 51d0c66161..c9014ce1da 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -9,6 +9,8 @@ builds: id: "s2c" binary: s2c main: ./s2/cmd/s2c/main.go + flags: + - -trimpath env: - CGO_ENABLED=0 goos: @@ -33,6 +35,8 @@ builds: id: "s2d" binary: s2d main: ./s2/cmd/s2d/main.go + flags: + - -trimpath env: - CGO_ENABLED=0 goos: @@ -57,6 +61,9 @@ builds: id: "s2sx" binary: s2sx main: ./s2/cmd/_s2sx/main.go + flags: + - -modfile=s2sx.mod + - -trimpath env: - CGO_ENABLED=0 goos: diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index df68ea4370..0000000000 --- a/.travis.yml +++ /dev/null @@ -1,61 +0,0 @@ -language: go - -os: - - linux - - osx - -arch: - - amd64 - -go: - - 1.14.x - - 1.15.x - - 1.16.x - - master - -env: - - GO111MODULE=off CGO_ENABLED=0 - -install: - - go get ./... - -script: - - go vet ./... - - go test -cpu=2 ./... - - go test -cpu=2 -tags=noasm ./... - - CGO_ENABLED=1 go test -cpu=1,4 -short -race ./... - - go build github.com/klauspost/compress/s2/cmd/s2c && go build github.com/klauspost/compress/s2/cmd/s2d && s2c s2c && s2d s2c.s2 && rm s2c && rm s2d && rm s2c.s2 - -jobs: - allow_failures: - - go: 'master' - fast_finish: true - include: - - stage: other - go: 1.16.x - script: - - diff <(gofmt -d .) <(printf "") - - GOOS=linux GOARCH=386 go test -short ./... # test on 386/32 bits. - - curl -sfL https://git.io/goreleaser | VERSION=v0.157.0 sh -s -- check # check goreleaser config for deprecations - - curl -sL https://git.io/goreleaser | VERSION=v0.157.0 sh -s -- --snapshot --skip-publish --rm-dist - - stage: other - arch: arm64 - go: - - 1.16.x - script: - - go test -cpu=2 ./s2 - - go test -cpu=2 -tags=noasm ./s2 - - go build github.com/klauspost/compress/s2/cmd/s2c && go build github.com/klauspost/compress/s2/cmd/s2d && s2c s2c && s2d s2c.s2 && rm s2c && rm s2d && rm s2c.s2 - -deploy: -- provider: script - skip_cleanup: true - script: curl -sL https://git.io/goreleaser | VERSION=v0.157.0 bash || true - on: - tags: true - condition: ($TRAVIS_OS_NAME = linux) && ($TRAVIS_CPU_ARCH = amd64) - go: 1.16.x -branches: - only: - - master - - /^v\d+\.\d+(\.\d+)?(-\S*)?$/ diff --git a/README.md b/README.md index b38faeb6b5..40c4e6bc0d 100644 --- a/README.md +++ b/README.md @@ -10,12 +10,12 @@ This package provides various compression algorithms. * [fuzz package](https://github.com/klauspost/compress-fuzz) for fuzz testing all compressors/decompressors here. [![Go Reference](https://pkg.go.dev/badge/klauspost/compress.svg)](https://pkg.go.dev/github.com/klauspost/compress?tab=subdirectories) -[![Build Status](https://travis-ci.com/klauspost/compress.svg?branch=master)](https://travis-ci.com/klauspost/compress) +[![Go](https://github.com/klauspost/compress/actions/workflows/go.yml/badge.svg)](https://github.com/klauspost/compress/actions/workflows/go.yml) [![Sourcegraph Badge](https://sourcegraph.com/github.com/klauspost/compress/-/badge.svg)](https://sourcegraph.com/github.com/klauspost/compress?badge) # changelog -* Apr 9, 2021 (v.1.12.1) +* Apr 14, 2021 (v1.12.1) * snappy package removed. Upstream added as dependency. * s2: Better compression in "best" mode [#353](https://github.com/klauspost/compress/pull/353) * s2sx: Add stdin input and detect pre-compressed from signature [#352](https://github.com/klauspost/compress/pull/352) diff --git a/s2/cmd/_s2sx/gensfx.cmd b/s2/cmd/_s2sx/gensfx.cmd index ea9ba26ec7..7e73f6505d 100644 --- a/s2/cmd/_s2sx/gensfx.cmd +++ b/s2/cmd/_s2sx/gensfx.cmd @@ -4,28 +4,29 @@ DEL /Q sfx-exe\* SET GOOS=linux SET GOARCH=amd64 -go build -ldflags="-s -w" -o ./sfx-exe/%GOOS%-%GOARCH% ./_unpack/main.go +SET BUILDFLAGS=-trimpath -ldflags="-s -w" +go build %BUILDFLAGS% -o ./sfx-exe/%GOOS%-%GOARCH% ./_unpack/main.go SET GOARCH=arm64 -go build -ldflags="-s -w" -o ./sfx-exe/%GOOS%-%GOARCH% ./_unpack/main.go +go build %BUILDFLAGS% -o ./sfx-exe/%GOOS%-%GOARCH% ./_unpack/main.go SET GOARCH=arm -go build -ldflags="-s -w" -o ./sfx-exe/%GOOS%-%GOARCH% ./_unpack/main.go +go build %BUILDFLAGS% -o ./sfx-exe/%GOOS%-%GOARCH% ./_unpack/main.go SET GOARCH=ppc64le -go build -ldflags="-s -w" -o ./sfx-exe/%GOOS%-%GOARCH% ./_unpack/main.go +go build %BUILDFLAGS% -o ./sfx-exe/%GOOS%-%GOARCH% ./_unpack/main.go SET GOARCH=mips64 -go build -ldflags="-s -w" -o ./sfx-exe/%GOOS%-%GOARCH% ./_unpack/main.go +go build %BUILDFLAGS% -o ./sfx-exe/%GOOS%-%GOARCH% ./_unpack/main.go SET GOOS=darwin SET GOARCH=amd64 -go build -ldflags="-s -w" -o ./sfx-exe/%GOOS%-%GOARCH% ./_unpack/main.go +go build %BUILDFLAGS% -o ./sfx-exe/%GOOS%-%GOARCH% ./_unpack/main.go SET GOARCH=arm64 -go build -ldflags="-s -w" -o ./sfx-exe/%GOOS%-%GOARCH% ./_unpack/main.go +go build %BUILDFLAGS% -o ./sfx-exe/%GOOS%-%GOARCH% ./_unpack/main.go SET GOOS=windows SET GOARCH=amd64 -go build -ldflags="-s -w" -o ./sfx-exe/%GOOS%-%GOARCH% ./_unpack/main.go +go build %BUILDFLAGS% -o ./sfx-exe/%GOOS%-%GOARCH% ./_unpack/main.go SET GOARCH=386 -go build -ldflags="-s -w" -o ./sfx-exe/%GOOS%-%GOARCH% ./_unpack/main.go +go build %BUILDFLAGS% -o ./sfx-exe/%GOOS%-%GOARCH% ./_unpack/main.go s2c.exe -rm -slower sfx-exe\* DEL /Q s2c.exe diff --git a/s2/cmd/_s2sx/gensfx.sh b/s2/cmd/_s2sx/gensfx.sh index b72b8e8a82..f77948b83f 100755 --- a/s2/cmd/_s2sx/gensfx.sh +++ b/s2/cmd/_s2sx/gensfx.sh @@ -4,17 +4,17 @@ go build -o=s2c ../s2c rm -rf sfx-exe/ || true -GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o ./sfx-exe/linux-amd64 ./_unpack/main.go -GOOS=linux GOARCH=arm64 go build -ldflags="-s -w" -o ./sfx-exe/linux-arm64 ./_unpack/main.go -GOOS=linux GOARCH=arm go build -ldflags="-s -w" -o ./sfx-exe/linux-arm ./_unpack/main.go -GOOS=linux GOARCH=ppc64le go build -ldflags="-s -w" -o ./sfx-exe/linux-ppc64le ./_unpack/main.go -GOOS=linux GOARCH=mips64 go build -ldflags="-s -w" -o ./sfx-exe/linux-mips64 ./_unpack/main.go +GOOS=linux GOARCH=amd64 go build -trimpath -ldflags="-s -w" -o ./sfx-exe/linux-amd64 ./_unpack/main.go +GOOS=linux GOARCH=arm64 go build -trimpath -ldflags="-s -w" -o ./sfx-exe/linux-arm64 ./_unpack/main.go +GOOS=linux GOARCH=arm go build -trimpath -ldflags="-s -w" -o ./sfx-exe/linux-arm ./_unpack/main.go +GOOS=linux GOARCH=ppc64le go build -trimpath -ldflags="-s -w" -o ./sfx-exe/linux-ppc64le ./_unpack/main.go +GOOS=linux GOARCH=mips64 go build -trimpath -ldflags="-s -w" -o ./sfx-exe/linux-mips64 ./_unpack/main.go -GOOS=darwin GOARCH=amd64 go build -ldflags="-s -w" -o ./sfx-exe/darwin-amd64 ./_unpack/main.go -GOOS=darwin GOARCH=arm64 go build -ldflags="-s -w" -o ./sfx-exe/darwin-arm64 ./_unpack/main.go +GOOS=darwin GOARCH=amd64 go build -trimpath -ldflags="-s -w" -o ./sfx-exe/darwin-amd64 ./_unpack/main.go +GOOS=darwin GOARCH=arm64 go build -trimpath -ldflags="-s -w" -o ./sfx-exe/darwin-arm64 ./_unpack/main.go -GOOS=windows GOARCH=amd64 go build -ldflags="-s -w" -o ./sfx-exe/windows-amd64 ./_unpack/main.go -GOOS=windows GOARCH=386 go build -ldflags="-s -w" -o ./sfx-exe/windows-386 ./_unpack/main.go +GOOS=windows GOARCH=amd64 go build -trimpath -ldflags="-s -w" -o ./sfx-exe/windows-amd64 ./_unpack/main.go +GOOS=windows GOARCH=386 go build -trimpath -ldflags="-s -w" -o ./sfx-exe/windows-386 ./_unpack/main.go ./s2c -rm -slower sfx-exe/* diff --git a/s2sx.mod b/s2sx.mod new file mode 100644 index 0000000000..a9faf7a022 --- /dev/null +++ b/s2sx.mod @@ -0,0 +1,5 @@ +module github.com/klauspost/compress + +go 1.16 + +require github.com/golang/snappy v0.0.3 // indirect diff --git a/s2sx.sum b/s2sx.sum new file mode 100644 index 0000000000..73204cafaf --- /dev/null +++ b/s2sx.sum @@ -0,0 +1,2 @@ +github.com/golang/snappy v0.0.3 h1:fHPg5GQYlCeLIPB9BZqMVR5nR9A+IM5zcgeTdjMYmLA= +github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=