Skip to content

Commit 87881f2

Browse files
committed
Consolidate GitHub Actions
1 parent 92ce3c4 commit 87881f2

File tree

1 file changed

+24
-40
lines changed

1 file changed

+24
-40
lines changed

.github/workflows/main.yml

Lines changed: 24 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,35 @@ on:
22
pull_request:
33
push:
44
jobs:
5-
ubuntu-ci:
6-
runs-on: ubuntu-latest
5+
test:
6+
strategy:
7+
matrix:
8+
go-version:
9+
- 1.13.x
10+
os:
11+
- macos-latest
12+
- ubuntu-latest
13+
- windows-latest
14+
runs-on: ${{ matrix.os }}
715
steps:
816
- name: Set up Go
917
uses: actions/setup-go@v1
1018
with:
11-
go-version: 1.13.x
19+
go-version: ${{ matrix.go-version }}
1220
- name: Checkout
1321
uses: actions/checkout@v1
1422
- name: Download Go modules
1523
run: go mod download
1624
- name: Install tools
25+
if: matrix.os == 'ubuntu-latest'
1726
run: |
1827
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(go env GOPATH)/bin v1.22.2
1928
cd $(mktemp -d)
2029
go mod init tmp
2130
go get github.com/gobuffalo/packr/v2/packr2
2231
go get mvdan.cc/gofumpt/gofumports
2332
- name: Generate
33+
if: matrix.os == 'ubuntu-latest'
2434
run: |
2535
$(go env GOPATH)/bin/packr2
2636
go generate ./...
@@ -32,57 +42,31 @@ jobs:
3242
- name: Test
3343
run: go test -race ./...
3444
- name: Lint
45+
if: matrix.os == 'ubuntu-latest'
3546
run: $(go env GOPATH)/bin/golangci-lint run
3647
- name: Check formatting
48+
if: matrix.os == 'ubuntu-latest'
3749
run: |
3850
find . -name \*.go | xargs $(go env GOPATH)/bin/gofumports -w
3951
git diff --exit-code
4052
- name: Check completions
53+
if: matrix.os == 'ubuntu-latest'
4154
run: |
4255
go run . completion bash > completions/chezmoi-completion.bash
4356
go run . completion fish > completions/chezmoi.fish
4457
go run . completion zsh > completions/chezmoi.zsh
4558
git diff --exit-code
46-
macos-ci:
47-
runs-on: macos-latest
48-
steps:
49-
- name: Set up Go
50-
uses: actions/setup-go@v1
51-
with:
52-
go-version: 1.13.x
53-
- name: Checkout
54-
uses: actions/checkout@v1
55-
- name: Download Go modules
56-
run: go mod download
57-
- name: Build
58-
run: go build ./...
59-
- name: Run
60-
run: go run . --version
61-
- name: Test
62-
run: go test -race ./...
63-
windows-ci:
64-
runs-on: windows-latest
65-
steps:
66-
- name: Set up Go
67-
uses: actions/setup-go@v1
68-
with:
69-
go-version: 1.13.x
70-
- name: Checkout
71-
uses: actions/checkout@v1
72-
- name: Download Go modules
73-
run: go mod download
74-
- name: Build
75-
run: go build ./...
76-
- name: Run
77-
run: go run . --version
78-
- name: Test
79-
run: go test -race ./...
59+
- name: Test release
60+
if: matrix.os == 'ubuntu-latest'
61+
run: |
62+
sudo chown root:root /
63+
sudo snap install goreleaser --classic
64+
sudo snap install snapcraft --classic
65+
goreleaser release --skip-publish --snapshot
8066
release:
8167
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
8268
needs:
83-
- ubuntu-ci
84-
- macos-ci
85-
- windows-ci
69+
- test
8670
runs-on: ubuntu-latest
8771
steps:
8872
- name: Set up Go

0 commit comments

Comments
 (0)