Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Sep 22, 2021. It is now read-only.

Commit 42e968f

Browse files
authored
Merge pull request #42 from ipfs/web3-bot/sync
sync: update CI config files
2 parents 07a1868 + 59c5f19 commit 42e968f

File tree

7 files changed

+157
-39
lines changed

7 files changed

+157
-39
lines changed

.github/workflows/automerge.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# File managed by web3-bot. DO NOT EDIT.
2+
# See https://github.com/protocol/.github/ for details.
3+
4+
# Automatically merge pull requests opened by web3-bot, as soon as (and only if) all tests pass.
5+
# This reduces the friction associated with updating with our workflows.
6+
7+
on: [ pull_request ]
8+
name: Automerge
9+
10+
jobs:
11+
automerge-check:
12+
if: github.event.pull_request.user.login == 'web3-bot'
13+
runs-on: ubuntu-latest
14+
outputs:
15+
status: ${{ steps.should-automerge.outputs.status }}
16+
steps:
17+
- uses: actions/checkout@v2
18+
with:
19+
fetch-depth: 0
20+
- name: Check if we should automerge
21+
id: should-automerge
22+
run: |
23+
for commit in $(git rev-list --first-parent origin/${{ github.event.pull_request.base.ref }}..${{ github.event.pull_request.head.sha }}); do
24+
committer=$(git show --format=$'%ce' -s $commit)
25+
echo "Committer: $committer"
26+
if [[ "$committer" != "[email protected]" ]]; then
27+
echo "Commit $commit wasn't committed by web3-bot, but by $committer."
28+
echo "::set-output name=status::false"
29+
exit
30+
fi
31+
done
32+
echo "::set-output name=status::true"
33+
automerge:
34+
needs: automerge-check
35+
runs-on: ubuntu-latest
36+
if: ${{ needs.automerge-check.outputs.status == 'true' }}
37+
steps:
38+
- name: Wait on tests
39+
uses: lewagon/wait-on-check-action@bafe56a6863672c681c3cf671f5e10b20abf2eaa # v0.2
40+
with:
41+
ref: ${{ github.event.pull_request.head.sha }}
42+
repo-token: ${{ secrets.GITHUB_TOKEN }}
43+
wait-interval: 10
44+
running-workflow-name: 'automerge' # the name of this job
45+
- name: Merge PR
46+
uses: pascalgn/automerge-action@741c311a47881be9625932b0a0de1b0937aab1ae # v0.13.1
47+
env:
48+
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
49+
MERGE_LABELS: ""
50+
MERGE_METHOD: "squash"
51+
MERGE_DELETE_BRANCH: true

.github/workflows/go-check.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
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@v2
13+
with:
14+
submodules: recursive
15+
- uses: actions/setup-go@v2
16+
with:
17+
go-version: "1.16.x"
18+
- name: Install staticcheck
19+
run: go install honnef.co/go/tools/cmd/staticcheck@434f5f3816b358fe468fa83dcba62d794e7fe04b # 2021.1 (v0.2.0)
20+
- name: Check that go.mod is tidy
21+
uses: protocol/[email protected]
22+
with:
23+
run: |
24+
go mod tidy
25+
if [[ -n $(git ls-files --other --exclude-standard --directory -- go.sum) ]]; then
26+
echo "go.sum was added by go mod tidy"
27+
exit 1
28+
fi
29+
git diff --exit-code -- go.sum go.mod
30+
- name: gofmt
31+
if: ${{ success() || failure() }} # run this step even if the previous one failed
32+
run: |
33+
out=$(gofmt -s -l .)
34+
if [[ -n "$out" ]]; then
35+
echo $out | awk '{print "::error file=" $0 ",line=0,col=0::File is not gofmt-ed."}'
36+
exit 1
37+
fi
38+
- name: go vet
39+
if: ${{ success() || failure() }} # run this step even if the previous one failed
40+
uses: protocol/[email protected]
41+
with:
42+
run: go vet ./...
43+
- name: staticcheck
44+
if: ${{ success() || failure() }} # run this step even if the previous one failed
45+
uses: protocol/[email protected]
46+
with:
47+
run: |
48+
set -o pipefail
49+
staticcheck ./... | sed -e 's@\(.*\)\.go@./\1.go@g'
50+

.github/workflows/go-test.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
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.15.x", "1.16.x" ]
14+
runs-on: ${{ matrix.os }}-latest
15+
name: ${{ matrix.os}} (go ${{ matrix.go }})
16+
steps:
17+
- uses: actions/checkout@v2
18+
with:
19+
submodules: recursive
20+
- uses: actions/setup-go@v2
21+
with:
22+
go-version: ${{ matrix.go }}
23+
- name: Go information
24+
run: |
25+
go version
26+
go env
27+
- name: Run tests
28+
uses: protocol/[email protected]
29+
with:
30+
run: go test -v -coverprofile coverage.txt ./...
31+
- name: Run tests (32 bit)
32+
if: ${{ matrix.os != 'macos' }} # can't run 32 bit tests on OSX.
33+
uses: protocol/[email protected]
34+
env:
35+
GOARCH: 386
36+
with:
37+
run: go test -v ./...
38+
- name: Run tests with race detector
39+
if: ${{ matrix.os == 'ubuntu' }} # speed things up. Windows and OSX VMs are slow
40+
uses: protocol/[email protected]
41+
with:
42+
run: go test -v -race ./...
43+
- name: Upload coverage to Codecov
44+
uses: codecov/codecov-action@a1ed4b322b4b38cb846afb5a0ebfa17086917d27 # v1.5.0
45+
with:
46+
file: coverage.txt
47+
env_vars: OS=${{ matrix.os }}, GO=${{ matrix.go }}

.travis.yml

Lines changed: 0 additions & 28 deletions
This file was deleted.

endpoints.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,15 @@ import (
1111
config "github.com/ipfs/go-ipfs"
1212
cmds "github.com/ipfs/go-ipfs-cmds"
1313
corecmds "github.com/ipfs/go-ipfs/core/commands"
14-
peer "github.com/libp2p/go-libp2p-peer"
15-
peerstore "github.com/libp2p/go-libp2p-peerstore"
14+
peer "github.com/libp2p/go-libp2p-core/peer"
1615
multiaddr "github.com/multiformats/go-multiaddr"
1716
)
1817

1918
var JsondocGlossary = jsondoc.NewGlossary().
2019
WithSchema(new(cid.Cid), jsondoc.Object{"/": "<cid-string>"}).
2120
WithName(new(multiaddr.Multiaddr), "multiaddr-string").
2221
WithName(new(peer.ID), "peer-id").
23-
WithSchema(new(peerstore.PeerInfo),
22+
WithSchema(new(peer.AddrInfo),
2423
jsondoc.Object{"ID": "peer-id", "Addrs": []string{"<multiaddr-string>"}})
2524

2625
var ignoreOptsPerEndpoint = map[string]map[string]struct{}{
@@ -127,7 +126,7 @@ func Endpoints(name string, cmd *cmds.Command) (endpoints []*Endpoint) {
127126
res := buildResponse(cmd.Type)
128127

129128
endpoints = []*Endpoint{
130-
&Endpoint{
129+
{
131130
Name: name,
132131
Description: cmd.Helptext.Tagline,
133132
Arguments: arguments,

go.mod

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
module github.com/ipfs/http-api-docs
22

3-
go 1.14
3+
go 1.15
44

55
require (
66
github.com/Stebalien/go-json-doc v0.0.2
77
github.com/ipfs/go-cid v0.0.7
88
github.com/ipfs/go-ipfs v0.8.0
99
github.com/ipfs/go-ipfs-cmds v0.6.0
10-
github.com/libp2p/go-libp2p-peer v0.2.0
11-
github.com/libp2p/go-libp2p-peerstore v0.2.6
10+
github.com/libp2p/go-libp2p-core v0.8.0
1211
github.com/multiformats/go-multiaddr v0.3.1
1312
)

markdown.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -171,22 +171,22 @@ func (md *MarkdownFormatter) GenerateArgumentsBlock(args []*Argument, opts []*Ar
171171
fmt.Fprintf(buf, "### Arguments\n\n")
172172

173173
if len(args)+len(opts) == 0 {
174-
fmt.Fprintf(buf, "This endpoint takes no arguments.\n")
174+
fmt.Fprint(buf, "This endpoint takes no arguments.\n")
175175
}
176176

177177
for _, arg := range args {
178-
fmt.Fprintf(buf, genArgument(arg, true))
178+
fmt.Fprint(buf, genArgument(arg, true))
179179
}
180180
for _, opt := range opts {
181-
fmt.Fprintf(buf, genArgument(opt, false))
181+
fmt.Fprint(buf, genArgument(opt, false))
182182
}
183183

184184
fmt.Fprintf(buf, "\n")
185185
return buf.String()
186186
}
187187

188188
// Removes the "Default:..." part in the descriptions.
189-
var fixDesc, _ = regexp.Compile(" Default: [a-zA-z0-9-_]+ ?\\.")
189+
var fixDesc, _ = regexp.Compile(` Default: [a-zA-z0-9-_]+ ?\.`)
190190

191191
func genArgument(arg *Argument, aliasToArg bool) string {
192192
// These get handled by GenerateBodyBlock

0 commit comments

Comments
 (0)