Skip to content

Commit bb18506

Browse files
authored
Merge pull request #4 from filecoin-project/web3-bot/sync
sync: update CI config files
2 parents 259b647 + b336697 commit bb18506

File tree

12 files changed

+242
-10
lines changed

12 files changed

+242
-10
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: go-test setup
2+
description: Set up go-test environment
3+
4+
runs:
5+
using: composite
6+
steps:
7+
- run: |
8+
# We could try running full test suite on ubuntu-latest-16-cores
9+
# On default runners it takes at least >1h
10+
echo "GOTESTFLAGS=$GOTESTFLAGS -short" >> $GITHUB_ENV
11+
echo "GO386FLAGS=$GO386FLAGS -short" >> $GITHUB_ENV
12+
echo "GORACEFLAGS=$GORACEFLAGS -short" >> $GITHUB_ENV
13+
shell: bash

.github/workflows/automerge.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# File managed by web3-bot. DO NOT EDIT.
2+
# See https://github.com/protocol/.github/ for details.
3+
4+
name: Automerge
5+
on: [ pull_request ]
6+
7+
jobs:
8+
automerge:
9+
uses: protocol/.github/.github/workflows/automerge.yml@master
10+
with:
11+
job: 'automerge'

.github/workflows/go-check.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# File managed by web3-bot. DO NOT EDIT.
2+
# See https://github.com/protocol/.github/ for details.
3+
4+
on: [push, pull_request]
5+
name: Go Checks
6+
7+
jobs:
8+
unit:
9+
runs-on: ubuntu-latest
10+
name: All
11+
steps:
12+
- uses: actions/checkout@v3
13+
with:
14+
submodules: recursive
15+
- id: config
16+
uses: protocol/.github/.github/actions/read-config@master
17+
- uses: actions/setup-go@v3
18+
with:
19+
go-version: 1.20.x
20+
- name: Run repo-specific setup
21+
uses: ./.github/actions/go-check-setup
22+
if: hashFiles('./.github/actions/go-check-setup') != ''
23+
- name: Install staticcheck
24+
run: go install honnef.co/go/tools/cmd/staticcheck@4970552d932f48b71485287748246cf3237cebdf # 2023.1 (v0.4.0)
25+
- name: Check that go.mod is tidy
26+
uses: protocol/[email protected]
27+
with:
28+
run: |
29+
go mod tidy
30+
if [[ -n $(git ls-files --other --exclude-standard --directory -- go.sum) ]]; then
31+
echo "go.sum was added by go mod tidy"
32+
exit 1
33+
fi
34+
git diff --exit-code -- go.sum go.mod
35+
- name: gofmt
36+
if: success() || failure() # run this step even if the previous one failed
37+
run: |
38+
out=$(gofmt -s -l .)
39+
if [[ -n "$out" ]]; then
40+
echo $out | awk '{print "::error file=" $0 ",line=0,col=0::File is not gofmt-ed."}'
41+
exit 1
42+
fi
43+
- name: go vet
44+
if: success() || failure() # run this step even if the previous one failed
45+
uses: protocol/[email protected]
46+
with:
47+
run: go vet ./...
48+
- name: staticcheck
49+
if: success() || failure() # run this step even if the previous one failed
50+
uses: protocol/[email protected]
51+
with:
52+
run: |
53+
set -o pipefail
54+
staticcheck ./... | sed -e 's@\(.*\)\.go@./\1.go@g'
55+
- name: go generate
56+
uses: protocol/[email protected]
57+
if: (success() || failure()) && fromJSON(steps.config.outputs.json).gogenerate == true
58+
with:
59+
run: |
60+
git clean -fd # make sure there aren't untracked files / directories
61+
go generate -x ./...
62+
# check if go generate modified or added any files
63+
if ! $(git add . && git diff-index HEAD --exit-code --quiet); then
64+
echo "go generated caused changes to the repository:"
65+
git status --short
66+
exit 1
67+
fi

.github/workflows/go-test.yml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# File managed by web3-bot. DO NOT EDIT.
2+
# See https://github.com/protocol/.github/ for details.
3+
4+
on: [push, pull_request]
5+
name: Go Test
6+
7+
jobs:
8+
unit:
9+
strategy:
10+
fail-fast: false
11+
matrix:
12+
os: [ "ubuntu", "windows", "macos" ]
13+
go: ["1.19.x","1.20.x"]
14+
env:
15+
GOTESTFLAGS: -shuffle=on -cover -coverprofile=module-coverage.txt -coverpkg=./...
16+
GO386FLAGS: -shuffle=on
17+
GORACEFLAGS: -shuffle=on
18+
runs-on: ${{ fromJSON(vars[format('UCI_GO_TEST_RUNNER_{0}', matrix.os)] || format('"{0}-latest"', matrix.os)) }}
19+
name: ${{ matrix.os }} (go ${{ matrix.go }})
20+
steps:
21+
- uses: actions/checkout@v3
22+
with:
23+
submodules: recursive
24+
- id: config
25+
uses: protocol/.github/.github/actions/read-config@master
26+
- uses: actions/setup-go@v3
27+
with:
28+
go-version: ${{ matrix.go }}
29+
- name: Go information
30+
run: |
31+
go version
32+
go env
33+
- name: Use msys2 on windows
34+
if: matrix.os == 'windows'
35+
shell: bash
36+
# The executable for msys2 is also called bash.cmd
37+
# https://github.com/actions/virtual-environments/blob/main/images/win/Windows2019-Readme.md#shells
38+
# If we prepend its location to the PATH
39+
# subsequent 'shell: bash' steps will use msys2 instead of gitbash
40+
run: echo "C:/msys64/usr/bin" >> $GITHUB_PATH
41+
- name: Run repo-specific setup
42+
uses: ./.github/actions/go-test-setup
43+
if: hashFiles('./.github/actions/go-test-setup') != ''
44+
- name: Run tests
45+
if: contains(fromJSON(steps.config.outputs.json).skipOSes, matrix.os) == false
46+
uses: protocol/[email protected]
47+
env:
48+
GOFLAGS: ${{ format('{0} {1}', env.GOTESTFLAGS, env.GOFLAGS) }}
49+
with:
50+
run: go test -v ./...
51+
- name: Run tests (32 bit)
52+
# can't run 32 bit tests on OSX.
53+
if: matrix.os != 'macos' &&
54+
fromJSON(steps.config.outputs.json).skip32bit != true &&
55+
contains(fromJSON(steps.config.outputs.json).skipOSes, matrix.os) == false
56+
uses: protocol/[email protected]
57+
env:
58+
GOARCH: 386
59+
GOFLAGS: ${{ format('{0} {1}', env.GO386FLAGS, env.GOFLAGS) }}
60+
with:
61+
run: |
62+
export "PATH=$PATH_386:$PATH"
63+
go test -v ./...
64+
- name: Run tests with race detector
65+
# speed things up. Windows and OSX VMs are slow
66+
if: matrix.os == 'ubuntu' &&
67+
contains(fromJSON(steps.config.outputs.json).skipOSes, matrix.os) == false
68+
uses: protocol/[email protected]
69+
env:
70+
GOFLAGS: ${{ format('{0} {1}', env.GORACEFLAGS, env.GOFLAGS) }}
71+
with:
72+
run: go test -v -race ./...
73+
- name: Collect coverage files
74+
id: coverages
75+
shell: bash
76+
run: echo "files=$(find . -type f -name 'module-coverage.txt' | tr -s '\n' ',' | sed 's/,$//')" >> $GITHUB_OUTPUT
77+
- name: Upload coverage to Codecov
78+
uses: codecov/codecov-action@d9f34f8cd5cb3b3eb79b3e4b5dae3a16df499a70 # v3.1.1
79+
with:
80+
files: ${{ steps.coverages.outputs.files }}
81+
env_vars: OS=${{ matrix.os }}, GO=${{ matrix.go }}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# File managed by web3-bot. DO NOT EDIT.
2+
# See https://github.com/protocol/.github/ for details.
3+
4+
name: Release Checker
5+
on:
6+
pull_request_target:
7+
paths: [ 'version.json' ]
8+
9+
jobs:
10+
release-check:
11+
uses: protocol/.github/.github/workflows/release-check.yml@master
12+
with:
13+
go-version: 1.20.x

.github/workflows/releaser.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# File managed by web3-bot. DO NOT EDIT.
2+
# See https://github.com/protocol/.github/ for details.
3+
4+
name: Releaser
5+
on:
6+
push:
7+
paths: [ 'version.json' ]
8+
9+
jobs:
10+
releaser:
11+
uses: protocol/.github/.github/workflows/releaser.yml@master

.github/workflows/tagpush.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# File managed by web3-bot. DO NOT EDIT.
2+
# See https://github.com/protocol/.github/ for details.
3+
4+
name: Tag Push Checker
5+
on:
6+
push:
7+
tags:
8+
- v*
9+
10+
jobs:
11+
releaser:
12+
uses: protocol/.github/.github/workflows/tagpush.yml@master

cmd/stream-commp/go.mod

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,33 @@
11
module github.com/filecoin-project/go-fil-commp-hashhash/cmd/stream-commp
22

3-
go 1.11
3+
go 1.19
44

55
require (
66
github.com/filecoin-project/go-fil-commcid v0.1.0
7-
github.com/filecoin-project/go-fil-commp-hashhash v0.1.1-0.20210716094257-d9e25dd4bb3d
7+
github.com/filecoin-project/go-fil-commp-hashhash v0.1.1-0.20230209104829-259b647a49b0
88
github.com/ipfs/go-cid v0.1.0
99
github.com/ipfs/go-ipld-cbor v0.0.5
1010
github.com/mattn/go-isatty v0.0.14
1111
github.com/pborman/options v1.2.0
1212
)
13+
14+
require (
15+
github.com/ipfs/go-block-format v0.0.2 // indirect
16+
github.com/ipfs/go-ipfs-util v0.0.1 // indirect
17+
github.com/ipfs/go-ipld-format v0.0.1 // indirect
18+
github.com/klauspost/cpuid/v2 v2.0.4 // indirect
19+
github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 // indirect
20+
github.com/minio/sha256-simd v1.0.0 // indirect
21+
github.com/mr-tron/base58 v1.2.0 // indirect
22+
github.com/multiformats/go-base32 v0.0.3 // indirect
23+
github.com/multiformats/go-base36 v0.1.0 // indirect
24+
github.com/multiformats/go-multibase v0.0.3 // indirect
25+
github.com/multiformats/go-multihash v0.0.15 // indirect
26+
github.com/multiformats/go-varint v0.0.6 // indirect
27+
github.com/pborman/getopt/v2 v2.0.0-20200816005738-fd0d075bf4de // indirect
28+
github.com/polydawn/refmt v0.0.0-20190221155625-df39d6c2d992 // indirect
29+
github.com/whyrusleeping/cbor-gen v0.0.0-20200123233031-1cdf64d27158 // indirect
30+
golang.org/x/crypto v0.0.0-20210506145944-38f3c27a63bf // indirect
31+
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c // indirect
32+
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
33+
)

cmd/stream-commp/go.sum

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8
22
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
33
github.com/filecoin-project/go-fil-commcid v0.1.0 h1:3R4ds1A9r6cr8mvZBfMYxTS88OqLYEo6roi+GiIeOh8=
44
github.com/filecoin-project/go-fil-commcid v0.1.0/go.mod h1:Eaox7Hvus1JgPrL5+M3+h7aSPHc0cVqpSxA+TxIEpZQ=
5-
github.com/filecoin-project/go-fil-commp-hashhash v0.1.1-0.20210716094257-d9e25dd4bb3d h1:sE5iCZkQtMtxvGDf1FmqEcdde6+p+lyMfiIkMXHTreQ=
6-
github.com/filecoin-project/go-fil-commp-hashhash v0.1.1-0.20210716094257-d9e25dd4bb3d/go.mod h1:73S8WSEWh9vr0fDJVnKADhfIv/d6dCbAGaAGWbdJEI8=
5+
github.com/filecoin-project/go-fil-commp-hashhash v0.1.1-0.20230209104829-259b647a49b0 h1:r1aWlJZhLwTCZDyghSEP6IdMB709oWZ1Q+ZW0P5cZoQ=
6+
github.com/filecoin-project/go-fil-commp-hashhash v0.1.1-0.20230209104829-259b647a49b0/go.mod h1:73S8WSEWh9vr0fDJVnKADhfIv/d6dCbAGaAGWbdJEI8=
77
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
88
github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY=
99
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
@@ -103,7 +103,6 @@ golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGm
103103
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
104104
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
105105
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
106-
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
107106
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
108107
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
109108
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=

cmd/stream-commp/main.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import (
55
"encoding/binary"
66
"fmt"
77
"io"
8-
"io/ioutil"
98
"log"
109
"os"
1110

@@ -57,7 +56,7 @@ func main() {
5756
// everything is opportunistic - keep descending on every err == nil
5857
if maybeHeaderLen, err := streamBuf.Peek(10); err == nil {
5958
if hdrLen, viLen := binary.Uvarint(maybeHeaderLen); viLen > 0 && hdrLen > 0 {
60-
actualViLen, err := io.CopyN(ioutil.Discard, streamBuf, int64(viLen))
59+
actualViLen, err := io.CopyN(io.Discard, streamBuf, int64(viLen))
6160
streamLen += actualViLen
6261
if err == nil {
6362
hdrBuf := make([]byte, hdrLen)
@@ -99,7 +98,7 @@ func main() {
9998
break
10099
}
101100

102-
actualFrameLen, err := io.CopyN(ioutil.Discard, streamBuf, int64(viLen)+int64(frameLen))
101+
actualFrameLen, err := io.CopyN(io.Discard, streamBuf, int64(viLen)+int64(frameLen))
103102
streamLen += actualFrameLen
104103
if err != nil {
105104
if err != io.EOF {
@@ -120,7 +119,7 @@ func main() {
120119
}
121120

122121
// read out remainder into the hasher, if any
123-
n, err := io.Copy(ioutil.Discard, streamBuf)
122+
n, err := io.Copy(io.Discard, streamBuf)
124123
streamLen += n
125124
if err != nil && err != io.EOF {
126125
log.Fatalf("unexpected error at offset %d: %s", streamLen, err)

0 commit comments

Comments
 (0)