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

Skip to content

Commit 59174a0

Browse files
authored
chore: refurbish CI setup (#90)
1 parent da8faf4 commit 59174a0

File tree

18 files changed

+129
-78
lines changed

18 files changed

+129
-78
lines changed

.github/workflows/go-test.yml

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

.github/workflows/go.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Go
2+
on:
3+
push:
4+
branches: [ main ]
5+
paths:
6+
- '**.go'
7+
- 'go.mod'
8+
- '.golangci.yml'
9+
- '.github/workflows/go.yml'
10+
pull_request:
11+
paths:
12+
- '**.go'
13+
- 'go.mod'
14+
- '.golangci.yml'
15+
- '.github/workflows/go.yml'
16+
env:
17+
GOPROXY: "https://proxy.golang.org"
18+
19+
jobs:
20+
lint:
21+
name: Lint
22+
runs-on: ubuntu-latest
23+
steps:
24+
- name: Checkout code
25+
uses: actions/checkout@v2
26+
- name: Run golangci-lint
27+
uses: golangci/golangci-lint-action@v2
28+
with:
29+
version: latest
30+
args: --timeout=30m
31+
- name: Check Go module tidiness
32+
shell: bash
33+
run: |
34+
go mod tidy
35+
STATUS=$(git status --porcelain go.mod go.sum)
36+
if [ ! -z "$STATUS" ]; then
37+
echo "Running go mod tidy modified go.mod and/or go.sum"
38+
exit 1
39+
fi
40+
41+
test:
42+
name: Test
43+
strategy:
44+
matrix:
45+
go-version: [ 1.18.x ]
46+
platform: [ ubuntu-latest ]
47+
runs-on: ${{ matrix.platform }}
48+
steps:
49+
- name: Install Go
50+
uses: actions/setup-go@v2
51+
with:
52+
go-version: ${{ matrix.go-version }}
53+
- name: Checkout code
54+
uses: actions/checkout@v2
55+
- name: Run tests with coverage
56+
run: go test -v -race ./...

.github/workflows/lsif.yml

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,28 @@
11
name: LSIF
22
on:
3-
- push
3+
push:
4+
paths:
5+
- '**.go'
6+
- 'go.mod'
7+
- '.github/workflows/lsif.yml'
8+
env:
9+
GOPROXY: "https://proxy.golang.org"
10+
411
jobs:
512
lsif-go:
13+
if: github.repository == 'sourcegraph/docsite'
614
runs-on: ubuntu-latest
7-
container: sourcegraph/lsif-go
815
steps:
9-
- uses: actions/checkout@v1
16+
- uses: actions/checkout@v2
1017
- name: Generate LSIF data
11-
run: lsif-go
12-
- name: Upload LSIF data
13-
run: src lsif upload -github-token=${{ secrets.GITHUB_TOKEN }}
18+
uses: sourcegraph/lsif-go-action@master
19+
- name: Upload LSIF data to sourcegraph.com
20+
continue-on-error: true
21+
uses: docker://sourcegraph/src-cli:latest
22+
with:
23+
args: lsif upload -github-token=${{ secrets.GITHUB_TOKEN }}
24+
- name: Upload LSIF data to S2
25+
continue-on-error: true
26+
uses: docker://sourcegraph/src-cli:latest
27+
with:
28+
args: -endpoint=https://sourcegraph.sourcegraph.com lsif upload -github-token=${{ secrets.GITHUB_TOKEN }}

.travis.yml

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

cmd/docsite/check.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ func init() {
1414
)
1515

1616
handler := func(args []string) error {
17-
flagSet.Parse(args)
17+
_ = flagSet.Parse(args)
1818
site, _, err := siteFromFlags()
1919
if err != nil {
2020
return err
@@ -25,7 +25,7 @@ func init() {
2525
}
2626
if len(problems) > 0 {
2727
for _, problem := range problems {
28-
fmt.Fprintln(os.Stderr, problem)
28+
_, _ = fmt.Fprintln(os.Stderr, problem)
2929
}
3030
return fmt.Errorf("%d problems found", len(problems))
3131
}

cmd/docsite/cmd.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ func (c commander) run(flagSet *flag.FlagSet, cmdName string, usage *template.Te
6969
}
7070
}
7171
if !flagSet.Parsed() {
72-
flagSet.Parse(args)
72+
_ = flagSet.Parse(args)
7373
}
7474

7575
// Print usage if the command is "help".
@@ -82,21 +82,21 @@ func (c commander) run(flagSet *flag.FlagSet, cmdName string, usage *template.Te
8282
for _, cmd_ := range c {
8383
cmd := cmd_
8484
cmd.FlagSet.Usage = func() {
85-
fmt.Fprintln(commandLine.Output(), "Usage:")
86-
fmt.Fprintln(commandLine.Output())
87-
fmt.Fprintf(commandLine.Output(), " %s [options] %s", cmdName, cmd.FlagSet.Name())
85+
_, _ = fmt.Fprintln(commandLine.Output(), "Usage:")
86+
_, _ = fmt.Fprintln(commandLine.Output())
87+
_, _ = fmt.Fprintf(commandLine.Output(), " %s [options] %s", cmdName, cmd.FlagSet.Name())
8888
if hasFlags(cmd.FlagSet) {
89-
fmt.Fprint(commandLine.Output(), " [command options]")
89+
_, _ = fmt.Fprint(commandLine.Output(), " [command options]")
9090
}
91-
fmt.Fprintln(commandLine.Output())
91+
_, _ = fmt.Fprintln(commandLine.Output())
9292
if cmd.LongDescription != "" {
93-
fmt.Fprintln(commandLine.Output())
94-
fmt.Fprintln(commandLine.Output(), cmd.LongDescription)
95-
fmt.Fprintln(commandLine.Output())
93+
_, _ = fmt.Fprintln(commandLine.Output())
94+
_, _ = fmt.Fprintln(commandLine.Output(), cmd.LongDescription)
95+
_, _ = fmt.Fprintln(commandLine.Output())
9696
}
9797
if hasFlags(cmd.FlagSet) {
98-
fmt.Fprintln(commandLine.Output(), "The command options are:")
99-
fmt.Fprintln(commandLine.Output())
98+
_, _ = fmt.Fprintln(commandLine.Output(), "The command options are:")
99+
_, _ = fmt.Fprintln(commandLine.Output())
100100
cmd.FlagSet.PrintDefaults()
101101
}
102102
}

cmd/docsite/fs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ func init() {
1313
)
1414

1515
handler := func(args []string) error {
16-
flagSet.Parse(args)
16+
_ = flagSet.Parse(args)
1717
site, _, err := siteFromFlags()
1818
if err != nil {
1919
return err

cmd/docsite/info.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ func init() {
1010
flagSet := flag.NewFlagSet("info", flag.ExitOnError)
1111

1212
handler := func(args []string) error {
13-
flagSet.Parse(args)
13+
_ = flagSet.Parse(args)
1414
_, conf, err := siteFromFlags()
1515
if err != nil {
1616
return err

cmd/docsite/search.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ func init() {
1616
)
1717

1818
handler := func(args []string) error {
19-
flagSet.Parse(args)
19+
_ = flagSet.Parse(args)
2020
site, _, err := siteFromFlags()
2121
if err != nil {
2222
return err

cmd/docsite/serve.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ func init() {
1919
)
2020

2121
handler := func(args []string) error {
22-
flagSet.Parse(args)
22+
_ = flagSet.Parse(args)
2323

2424
host, port, err := net.SplitHostPort(*httpAddr)
2525
if err != nil {

0 commit comments

Comments
 (0)