Skip to content
This repository was archived by the owner on Aug 30, 2024. It is now read-only.

Commit 17cd0ba

Browse files
committed
chore: Clean up CI scripts
* Build with Go provided by GitHub instead of building inside a Dockerfile, which should speed up the build * Condense build steps to avoid repeatedly downloading cached Go packages, which should speed up the build * Run goimports using golangci-lint, rather than running gofmt and goimports manually in make fmt * Skip signing/notarizing Darwin binary in build, since this takes a long time and is done in release * Only build/test for pull requests against master * Remove unnecessary steps in ci/image/Dockerfile * goimports is managed by golangci-lint * grep is already installed in the base image
1 parent c30c076 commit 17cd0ba

File tree

5 files changed

+30
-43
lines changed

5 files changed

+30
-43
lines changed

.github/workflows/build.yaml

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
name: build
2-
on: [push]
2+
on:
3+
push:
4+
branches: [ master ]
5+
pull_request:
6+
branches: [ master ]
37

48
jobs:
59
build:
@@ -19,20 +23,8 @@ jobs:
1923
steps:
2024
- name: Checkout
2125
uses: actions/checkout@v1
22-
- name: Install Gon
23-
run: |
24-
brew tap mitchellh/gon
25-
brew install mitchellh/gon/gon
26-
- name: Import Signing Certificates
27-
uses: Apple-Actions/import-codesign-certs@v1
28-
with:
29-
p12-file-base64: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_P12_BASE64 }}
30-
p12-password: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_PASSWORD }}
3126
- name: Build
32-
run: make build/macos
33-
env:
34-
AC_USERNAME: ${{ secrets.AC_USERNAME }}
35-
AC_PASSWORD: ${{ secrets.AC_PASSWORD }}
27+
run: unset CI && make build/macos
3628
- name: Upload
3729
uses: actions/upload-artifact@v2
3830
with:

.github/workflows/test.yaml

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
name: test
2-
on: [push]
2+
on:
3+
push:
4+
branches: [ master ]
5+
pull_request:
6+
branches: [ master ]
37

48
jobs:
5-
fmt:
9+
staticcheck:
610
runs-on: ubuntu-latest
711
steps:
812
- uses: actions/checkout@v1
@@ -12,20 +16,30 @@ jobs:
1216
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
1317
restore-keys: |
1418
${{ runner.os }}-go-
15-
- name: fmt
16-
uses: ./ci/image
19+
- uses: actions/setup-go@v2
1720
with:
18-
args: make -j fmt
19-
- run: ./ci/scripts/files_changed.sh
21+
go-version: '^1.15.1' # The Go version to download (if necessary) and use.
22+
23+
- name: Ensure dependencies up-to-date
24+
run: make fmt
25+
- name: Check that "make fmt" is clean
26+
run: ./ci/scripts/files_changed.sh
27+
28+
- name: Ensure documentation up-to-date
29+
run: make gendocs
30+
- name: Check that "make gendocs" is clean
31+
run: ./ci/scripts/files_changed.sh
32+
2033
lint:
2134
runs-on: ubuntu-latest
2235
steps:
23-
- uses: actions/checkout@v2
24-
- name: golangci-lint
36+
- uses: actions/checkout@v1
37+
- name: Run golangci-lint
2538
uses: golangci/golangci-lint-action@v2
2639
with:
2740
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
2841
version: v1.29
42+
2943
test:
3044
runs-on: ubuntu-latest
3145
steps:
@@ -40,18 +54,3 @@ jobs:
4054
uses: ./ci/image
4155
with:
4256
args: make -j test/go
43-
gendocs:
44-
runs-on: ubuntu-latest
45-
steps:
46-
- uses: actions/checkout@v1
47-
- uses: actions/cache@v1
48-
with:
49-
path: ~/go/pkg/mod
50-
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
51-
restore-keys: |
52-
${{ runner.os }}-go-
53-
- name: generate-docs
54-
uses: ./ci/image
55-
with:
56-
args: make -j gendocs
57-
- run: ./ci/scripts/files_changed.sh

.golangci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ linters:
4444
- rowserrcheck
4545
- scopelint
4646
- goprintffuncname
47-
- gofmt
47+
- goimports
4848
- godot
4949
- ineffassign
5050
- gocritic

Makefile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,9 @@ build/linux:
2020

2121
fmt:
2222
go mod tidy
23-
gofmt -w -s .
24-
goimports -w "-local=$$(go list -m)" .
2523

2624
lint:
27-
golangci-lint run -c .golangci.yml
25+
golangci-lint run
2826

2927
gendocs:
3028
rm -rf ./docs

ci/image/Dockerfile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,4 @@ FROM golang:1
33
ENV GOFLAGS="-mod=readonly"
44
ENV CI=true
55

6-
RUN go get golang.org/x/tools/cmd/goimports
76
RUN go get github.com/mattn/goveralls
8-
RUN apt update && apt install grep

0 commit comments

Comments
 (0)