Skip to content

Commit

Permalink
test: Switch to github actions (#354)
Browse files Browse the repository at this point in the history
  • Loading branch information
klauspost authored Apr 14, 2021
1 parent a53314f commit 1076456
Show file tree
Hide file tree
Showing 10 changed files with 135 additions and 81 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
* -text
*.bin -text -diff
69 changes: 69 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -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

30 changes: 30 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -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
7 changes: 7 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ builds:
id: "s2c"
binary: s2c
main: ./s2/cmd/s2c/main.go
flags:
- -trimpath
env:
- CGO_ENABLED=0
goos:
Expand All @@ -33,6 +35,8 @@ builds:
id: "s2d"
binary: s2d
main: ./s2/cmd/s2d/main.go
flags:
- -trimpath
env:
- CGO_ENABLED=0
goos:
Expand All @@ -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:
Expand Down
61 changes: 0 additions & 61 deletions .travis.yml

This file was deleted.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
19 changes: 10 additions & 9 deletions s2/cmd/_s2sx/gensfx.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 9 additions & 9 deletions s2/cmd/_s2sx/gensfx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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/*

Expand Down
5 changes: 5 additions & 0 deletions s2sx.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module github.com/klauspost/compress

go 1.16

require github.com/golang/snappy v0.0.3 // indirect
2 changes: 2 additions & 0 deletions s2sx.sum
Original file line number Diff line number Diff line change
@@ -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=

0 comments on commit 1076456

Please sign in to comment.