ci: switches release process to gh actions and goreleaser (#87)

Also preserves coveralls and appveyor. Closes #58
This commit is contained in:
Manuel Vogel 2021-01-16 06:48:01 +01:00 committed by GitHub
parent d6315435a3
commit c41bf3ab9a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 112 additions and 41 deletions

26
.github/workflows/release.yml vendored Normal file
View file

@ -0,0 +1,26 @@
name: goreleaser
on:
push:
tags:
- '*'
jobs:
goreleaser:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.15
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

37
.github/workflows/test.yml vendored Normal file
View file

@ -0,0 +1,37 @@
name: tests
on:
pull_request:
types: ['opened', 'synchronize']
paths-ignore:
- 'README.md'
push:
branches:
- master
paths-ignore:
- 'README.md'
jobs:
unit:
runs-on: ubuntu-20.04
strategy:
fail-fast: true
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.15
- name: Run tests
run: |
make test
- name: Install goveralls
env:
GO111MODULE: off
run: go get github.com/mattn/goveralls
- name: Send coverage
env:
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: goveralls -coverprofile=cover.out -service=github

48
.goreleaser.yml Normal file
View file

@ -0,0 +1,48 @@
# This is an example .goreleaser.yml file with some sane defaults.
# Make sure to check the documentation at http://goreleaser.com
project_name: git-chglog
before:
hooks:
# You may remove this if you don't use go modules.
- go mod download
builds:
- dir: cmd/git-chglog
env:
- CGO_ENABLED=0
goos:
- linux
- windows
- darwin
goarch:
- amd64
- arm
- arm64
goarm:
- 6
archives:
- format_overrides:
- goos: windows
format: zip
checksum:
name_template: 'checksums.txt'
changelog:
sort: asc
snapshot:
name_template: "{{ .Tag }}-next"
brews:
- tap:
owner: git-chglog
name: homebrew-git-chglog
homepage: "https://godoc.org/github.com/git-chglog/git-chglog"
description: "CHANGELOG generator implemented in Go (Golang)."
test: |
system "#{bin}/git-chglog --help"
install: |
bin.install "git-chglog"

View file

@ -1,24 +0,0 @@
language: go
notifications:
email: false
go:
- 1.15
before_install:
- GO111MODULE=off go get github.com/mattn/goveralls
before_script:
- export TZ=Asia/Tokyo
- sudo timedatectl set-timezone Asia/Tokyo
- timedatectl
script:
- make test
after_success:
- goveralls -service=travis-ci
before_deploy:
- GO111MODULE=off go get github.com/mitchellh/gox
- GO111MODULE=off go get github.com/tcnksm/ghr
deploy:
provider: script
script: ./scripts/release.sh
on:
tags: true
branch: master

View file

@ -11,13 +11,7 @@ build:
.PHONY: test
test:
go test -v `go list ./...`
.PHONY: coverage
coverage:
goverage -coverprofile=cover.out `go list ./...`
go tool cover -func=cover.out
@rm -rf cover.out
go test -covermode atomic -coverprofile cover.out -v ./...
.PHONY: install
install:

View file

@ -1,10 +0,0 @@
#!/bin/bash
REPO_ROOT=$(git rev-parse --show-toplevel)
echo "Start release ..."
gox -os="darwin linux windows" -arch="amd64 386" -output="$REPO_ROOT/dist/{{.Dir}}_{{.OS}}_{{.Arch}}" ./cmd/git-chglog
ghr --username git-chglog --token $GITHUB_TOKEN --replace `grep 'Version =' ./cmd/git-chglog/version.go | sed -E 's/.*"(.+)"$$/\1/'` dist/
echo "Released!"