| 1 |
name: Go |
| 2 |
|
| 3 |
on: |
| 4 |
push: |
| 5 |
branches: [ master ] |
| 6 |
pull_request: |
| 7 |
branches: [ master ] |
| 8 |
|
| 9 |
permissions: read-all |
| 10 |
|
| 11 |
jobs: |
| 12 |
build: |
| 13 |
strategy: |
| 14 |
matrix: |
| 15 |
go-version: [1.24.x, 1.25.x, 1.26.x] |
| 16 |
os: [ubuntu-latest, ubuntu-24.04-arm, macos-latest, windows-latest] |
| 17 |
env: |
| 18 |
CGO_ENABLED: 0 |
| 19 |
runs-on: ${{ matrix.os }} |
| 20 |
steps: |
| 21 |
- name: Set up Go |
| 22 |
uses: actions/[email protected] |
| 23 |
with: |
| 24 |
go-version: ${{ matrix.go-version }} |
| 25 |
|
| 26 |
- name: Checkout code |
| 27 |
uses: actions/[email protected] |
| 28 |
|
| 29 |
- name: Vet |
| 30 |
run: go vet ./... |
| 31 |
|
| 32 |
- name: Test |
| 33 |
run: go test ./... |
| 34 |
|
| 35 |
- name: Test No-asm |
| 36 |
run: go test -tags=noasm ./... |
| 37 |
|
| 38 |
- name: Test No-unsafe |
| 39 |
run: go test -tags=nounsafe ./... |
| 40 |
|
| 41 |
- name: Test No-unsafe, noasm |
| 42 |
run: go test -tags="nounsafe,noasm" ./... |
| 43 |
|
| 44 |
- name: Test Race 1 CPU |
| 45 |
env: |
| 46 |
CGO_ENABLED: 1 |
| 47 |
run: go test -cpu=1 -short -race -tags=nounsafe -v ./... |
| 48 |
|
| 49 |
- name: Test Race 4 CPU |
| 50 |
env: |
| 51 |
CGO_ENABLED: 1 |
| 52 |
run: go test -cpu=4 -short -race -tags=nounsafe -v ./... |
| 53 |
|
| 54 |
generate: |
| 55 |
strategy: |
| 56 |
matrix: |
| 57 |
pkg: [s2, zstd, huff0] |
| 58 |
runs-on: ubuntu-latest |
| 59 |
steps: |
| 60 |
- name: Set up Go |
| 61 |
uses: actions/[email protected] |
| 62 |
with: |
| 63 |
go-version: 1.26.x |
| 64 |
|
| 65 |
- name: Checkout code |
| 66 |
uses: actions/[email protected] |
| 67 |
|
| 68 |
- name: Generate |
| 69 |
working-directory: ${{ matrix.pkg }}/_generate |
| 70 |
run: go generate -v -x |
| 71 |
|
| 72 |
- name: Git Status |
| 73 |
run: | |
| 74 |
git diff |
| 75 |
test -z "$(git status --porcelain)" |
| 76 |
|
| 77 |
build-special: |
| 78 |
env: |
| 79 |
CGO_ENABLED: 0 |
| 80 |
runs-on: ubuntu-latest |
| 81 |
steps: |
| 82 |
- name: Set up Go |
| 83 |
uses: actions/[email protected] |
| 84 |
with: |
| 85 |
go-version: 1.26.x |
| 86 |
|
| 87 |
- name: Checkout code |
| 88 |
uses: actions/[email protected] |
| 89 |
|
| 90 |
- name: fmt |
| 91 |
run: diff <(gofmt -d .) <(printf "") |
| 92 |
|
| 93 |
- name: fix |
| 94 |
run: diff <(go fix -diff ./...) <(printf "") |
| 95 |
|
| 96 |
- name: Test 386 |
| 97 |
run: GOOS=linux GOARCH=386 go test -short ./... |
| 98 |
|
| 99 |
- name: Build s2c |
| 100 |
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 |
| 101 |
|
| 102 |
- name: goreleaser deprecation |
| 103 |
run: curl -sfL https://goreleaser.com/static/run | VERSION=v2.13.3 bash -s -- check |
| 104 |
|
| 105 |
- name: goreleaser snapshot |
| 106 |
run: curl -sfL https://goreleaser.com/static/run | VERSION=v2.13.3 bash -s -- --snapshot --clean |
| 107 |
|
| 108 |
- name: Test S2 GOAMD64 v3 |
| 109 |
env: |
| 110 |
GOAMD64: v3 |
| 111 |
shell: bash {0} |
| 112 |
run: go test . -test.run=None;if [ $? -eq 0 ]; then go test ./s2/...; else true; fi |
| 113 |
|
| 114 |
- name: Test GOAMD64 v4 |
| 115 |
env: |
| 116 |
GOAMD64: v4 |
| 117 |
shell: bash {0} |
| 118 |
run: go test . -test.run=None;if [ $? -eq 0 ]; then go test ./s2/...; else true; fi |
| 119 |
|
| 120 |
fuzz-s2: |
| 121 |
env: |
| 122 |
CGO_ENABLED: 0 |
| 123 |
runs-on: ubuntu-latest |
| 124 |
strategy: |
| 125 |
matrix: |
| 126 |
tags: [ 'nounsafe', '"noasm,nounsafe"' ] |
| 127 |
steps: |
| 128 |
- name: Set up Go |
| 129 |
uses: actions/[email protected] |
| 130 |
with: |
| 131 |
go-version: 1.26.x |
| 132 |
|
| 133 |
- name: Checkout code |
| 134 |
uses: actions/[email protected] |
| 135 |
|
| 136 |
- name: S2/FuzzDictBlocks/${{ matrix.tags }} |
| 137 |
run: go test -tags=${{ matrix.tags }} -run=none -fuzz=FuzzDictBlocks -fuzztime=100000x -test.fuzzminimizetime=10ms ./s2/. |
| 138 |
|
| 139 |
- name: S2/FuzzEncodingBlocks/${{ matrix.tags }} |
| 140 |
run: go test -tags=${{ matrix.tags }} -run=none -fuzz=FuzzEncodingBlocks -fuzztime=500000x -test.fuzzminimizetime=10ms ./s2/. |
| 141 |
|
| 142 |
- name: S2/FuzzLZ4Block/${{ matrix.tags }} |
| 143 |
run: go test -tags=${{ matrix.tags }} -run=none -fuzz=FuzzLZ4Block -fuzztime=500000x -test.fuzzminimizetime=10ms ./s2/. |
| 144 |
|
| 145 |
|
| 146 |
fuzz-zstd: |
| 147 |
env: |
| 148 |
CGO_ENABLED: 0 |
| 149 |
runs-on: ${{ matrix.os }} |
| 150 |
strategy: |
| 151 |
matrix: |
| 152 |
os: [ ubuntu-latest, ubuntu-24.04-arm ] |
| 153 |
tags: [ 'nounsafe', '"noasm,nounsafe"' ] |
| 154 |
steps: |
| 155 |
- name: Set up Go |
| 156 |
uses: actions/[email protected] |
| 157 |
with: |
| 158 |
go-version: 1.25.x |
| 159 |
|
| 160 |
- name: Checkout code |
| 161 |
uses: actions/[email protected] |
| 162 |
|
| 163 |
- name: zstd/FuzzDecodeAll/${{ matrix.tags }} |
| 164 |
run: go test -tags=${{ matrix.tags }} -run=none -fuzz=FuzzDecodeAll -fuzztime=500000x -test.fuzzminimizetime=10ms ./zstd/. |
| 165 |
|
| 166 |
- name: zstd/FuzzDecAllNoBMI2/${{ matrix.tags }} |
| 167 |
run: go test -tags=${{ matrix.tags }} -run=none -fuzz=FuzzDecAllNoBMI2 -fuzztime=500000x -test.fuzzminimizetime=10ms ./zstd/. |
| 168 |
|
| 169 |
- name: zstd/FuzzDecoder/${{ matrix.tags }} |
| 170 |
run: go test -tags=${{ matrix.tags }} -run=none -fuzz=FuzzDecoder -fuzztime=500000x -test.fuzzminimizetime=10ms ./zstd/. |
| 171 |
|
| 172 |
- name: zstd/FuzzNoBMI2Dec/${{ matrix.tags }} |
| 173 |
run: go test -tags=${{ matrix.tags }} -run=none -fuzz=FuzzNoBMI2Dec -fuzztime=500000x -test.fuzzminimizetime=10ms ./zstd/. |
| 174 |
|
| 175 |
- name: zstd/FuzzEncoding/${{ matrix.tags }} |
| 176 |
run: cd zstd&&go test -tags=${{ matrix.tags }} -run=none -fuzz=FuzzEncoding -fuzztime=250000x -test.fuzzminimizetime=10ms -fuzz-end=3&&cd .. |
| 177 |
|
| 178 |
fuzz-other: |
| 179 |
env: |
| 180 |
CGO_ENABLED: 0 |
| 181 |
runs-on: ubuntu-latest |
| 182 |
strategy: |
| 183 |
matrix: |
| 184 |
tags: [ 'nounsafe', '"noasm,nounsafe"' ] |
| 185 |
steps: |
| 186 |
- name: Set up Go |
| 187 |
uses: actions/[email protected] |
| 188 |
with: |
| 189 |
go-version: 1.25.x |
| 190 |
- name: Checkout code |
| 191 |
uses: actions/[email protected] |
| 192 |
|
| 193 |
- name: flate/FuzzEncoding/${{ matrix.tags }} |
| 194 |
run: go test -tags=${{ matrix.tags }} -run=none -fuzz=FuzzEncoding -fuzztime=100000x -test.fuzzminimizetime=10ms ./flate/. |
| 195 |
|
| 196 |
- name: zip/FuzzReader/${{ matrix.tags }} |
| 197 |
run: go test -tags=${{ matrix.tags }} -run=none -fuzz=FuzzReader -fuzztime=500000x -test.fuzzminimizetime=10ms ./zip/. |
| 198 |
|
| 199 |
- name: fse/FuzzCompress/${{ matrix.tags }} |
| 200 |
run: go test -tags=${{ matrix.tags }} -run=none -fuzz=FuzzCompress -fuzztime=1000000x -test.fuzzminimizetime=10ms ./fse/. |
| 201 |
|
| 202 |
- name: fse/FuzzDecompress/${{ matrix.tags }} |
| 203 |
run: go test -tags=${{ matrix.tags }} -run=none -fuzz=FuzzDecompress -fuzztime=1000000x -test.fuzzminimizetime=10ms ./fse/. |