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

Commit 35b7ed8

Browse files
authored
Merge pull request #6 from MichaelMure/gha-release
CI: add github action workflows
2 parents 28af51e + 67ad188 commit 35b7ed8

File tree

3 files changed

+79
-1
lines changed

3 files changed

+79
-1
lines changed

.github/workflows/build_test.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Go build and test
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
workflow_dispatch:
9+
10+
jobs:
11+
build:
12+
13+
strategy:
14+
matrix:
15+
go-version: [1.15.x]
16+
platform: [ubuntu-latest, macos-latest, windows-latest]
17+
18+
runs-on: ${{ matrix.platform }}
19+
20+
steps:
21+
22+
- name: Set up Go ${{ matrix.node-version }}
23+
uses: actions/setup-go@v2
24+
with:
25+
go-version: ${{ matrix.go-version }}
26+
27+
- name: Check out code
28+
uses: actions/checkout@v2
29+
30+
- name: Build
31+
run: make
32+
33+
- name: Setup minimal git config
34+
run: git config --global user.email "action@github.com" && git config --global user.name "GitHub Action"
35+
36+
- name: Test
37+
run: make test

.github/workflows/release.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Build release binaries
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
tags:
7+
- "v*"
8+
9+
jobs:
10+
build-release:
11+
runs-on: "ubuntu-latest"
12+
13+
steps:
14+
- name: Set up Go
15+
uses: actions/setup-go@v2
16+
with:
17+
go-version: 1.15.x
18+
19+
- name: Check out code
20+
uses: actions/checkout@v2
21+
22+
- name: Build
23+
run: make
24+
25+
- name: Setup minimal git config
26+
run: |
27+
git config --global user.email "action@github.com"
28+
git config --global user.name "GitHub Action"
29+
30+
- name: Test
31+
run: make test
32+
33+
- name: Build binaries
34+
run: go get github.com/mitchellh/gox && make releases
35+
36+
- uses: "marvinpinto/action-automatic-releases@latest"
37+
with:
38+
repo_token: "${{ secrets.GITHUB_TOKEN }}"
39+
draft: true
40+
prerelease: false
41+
files: dist/*

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ install:
1616
go install -ldflags "$(LDFLAGS)" .
1717

1818
releases:
19-
gox -ldflags "$(LDFLAGS)" -output "dist/{{.Dir}}_{{.OS}}_{{.Arch}}"
19+
gox -ldflags "$(LDFLAGS)" -osarch '!darwin/386' -output "dist/{{.Dir}}_{{.OS}}_{{.Arch}}"
2020

2121
test:
2222
go test -v -bench=. ./...

0 commit comments

Comments
 (0)