Skip to content

Commit

Permalink
Merge pull request #1 from arcanericky/gh-actions
Browse files Browse the repository at this point in the history
use GitHub Actions and GoReleaser
  • Loading branch information
arcanericky authored Feb 22, 2022
2 parents bef5e22 + e0e9a71 commit b76a4b3
Show file tree
Hide file tree
Showing 5 changed files with 94 additions and 22 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/builder.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
on: [push, pull_request]
name: Build
jobs:
test:
strategy:
matrix:
go-version: [1.17.x]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- name: Checkout code
uses: actions/checkout@v2
- name: Code format
run: diff -u <(echo -n) <(gofmt -d -s .)
- name: Vet
run: go vet ./...
- name: Unit tests
run: go test -race -coverprofile=coverage.out ./...
- name: Function coverage
run: go tool cover "-func=coverage.out"
- name: Upload coverage report
uses: codecov/codecov-action@v2
with:
file: ./coverage.out
- name: Build and Execute
run: |
go build -o jacksquat .
./jacksquat test --help
28 changes: 28 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Release

on:
push:
tags:
- '*'

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
-
name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.17.x
-
name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31 changes: 31 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
release:
draft: true
before:
hooks:
- go mod tidy
builds:
- main: .
binary: jacksquat
ldflags:
- -s -w
env:
- CGO_ENABLED=0
goos:
- linux
goarch:
- amd64
- arm
- arm64
ignore:
- goos: linux
goarch: 386
archives:
- name_template: "jacksquat_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
files:
- README.md
checksum:
name_template: 'checksums.txt'
snapshot:
name_template: "{{ .Tag }}-next"
changelog:
skip: true
22 changes: 0 additions & 22 deletions .travis.yml

This file was deleted.

3 changes: 3 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module github.com/arcanericky/jacksquat

go 1.17

0 comments on commit b76a4b3

Please sign in to comment.