Skip to content

Commit 2ce56b5

Browse files
chore(ci): initial
1 parent f4598e1 commit 2ce56b5

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed

.github/workflows/ci.yml

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: CI
2+
on:
3+
push:
4+
branches:
5+
- '**'
6+
pull_request:
7+
branches:
8+
- '**'
9+
10+
jobs:
11+
lint:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v2
15+
- name: golangci-lint
16+
run: |
17+
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s
18+
./bin/golangci-lint run -v
19+
build:
20+
runs-on: ${{ matrix.os }}
21+
needs: lint
22+
strategy:
23+
fail-fast: true
24+
matrix:
25+
os: [macos-latest, windows-latest, ubuntu-latest]
26+
steps:
27+
- uses: actions/checkout@v2
28+
- uses: actions/setup-go@v1
29+
with:
30+
go-version: 1.14
31+
32+
- name: Build
33+
run: go build ./cmd/commit-analyzer-cz/
34+
35+
- name: Test
36+
run: go test -v ./...
37+
release:
38+
runs-on: ubuntu-latest
39+
needs: build
40+
steps:
41+
- uses: actions/checkout@v2
42+
- uses: actions/setup-go@v1
43+
with:
44+
go-version: 1.14
45+
- run: echo "::add-path::~/go/bin"
46+
- name: Get release dependencies
47+
run: |
48+
go get github.com/mitchellh/gox
49+
go get github.com/tcnksm/ghr
50+
- uses: go-semantic-release/action@v1
51+
id: semrel
52+
with:
53+
github-token: ${{ secrets.GITHUB_TOKEN }}
54+
ghr: true
55+
- run: |
56+
gox -parallel 4 -osarch="linux/amd64 darwin/amd64 linux/arm windows/amd6" -ldflags="-extldflags '-static' -s -w" -output="bin/{{.Dir}}_v${{steps.semrel.outputs.version}}_{{.OS}}_{{.Arch}}" ./cmd/commit-analyzer-cz/
57+
if: steps.semrel.outputs.version != ''
58+
- run: ghr $(cat .ghr) bin/
59+
if: steps.semrel.outputs.version != ''
60+
env:
61+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)