Skip to content

Commit

Permalink
set-up pipelines
Browse files Browse the repository at this point in the history
  • Loading branch information
pPrecel committed Jun 20, 2023
1 parent c9891b9 commit 4aafd77
Show file tree
Hide file tree
Showing 5 changed files with 138 additions and 0 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: release

on:
push:
tags:
- '*'

jobs:
release:
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.20
-
name: GoReleaser
uses: goreleaser/[email protected]
with:
args: release --rm-dist
env:
GITHUB_REF_NAME: ${{ env.GIT_REF }}
GITHUB_TOKEN: ${{ secrets.GORELEASER_GITHUB_TOKEN }}
27 changes: 27 additions & 0 deletions .github/workflows/tests-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

name: build
jobs:

build:
strategy:
matrix:
platform: [macos-latest, ubuntu-latest]
runs-on: ${{ matrix.platform }}
steps:
-
uses: actions/checkout@v3
-
uses: actions/setup-go@v3
with:
go-version: 1.20
-
name: Verify
run: make verify-ci
-
name: Build
run: make build
51 changes: 51 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
env:
- GO111MODULE=on

before:
hooks:
- go mod tidy

builds:
- env:
- CGO_ENABLED=0
binary: pkup
main: ./main.go
ldflags:
- -s -w -X main.version=v{{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}} -X main.builtBy=goreleaser
goos:
- linux
- darwin
goarch:
- "386"
- amd64
- arm
- arm64
goarm:
- "7"

archives:
- files:
- README.md
- LICENSE

brews:
- homepage: "http://github.com/pPrecel/pkup-gen"
description: "Simple tool to generate PKUP artifacts."
tap:
owner: pPrecel
name: homebrew-tap
goarm: "7"
commit_msg_template: "Brew formula update for {{ .ProjectName }} version {{ .Tag }}"
folder: Formula
license: "MIT"
test: |
system "#{bin}/pkup"
install: |
bin.install "pkup"
checksum:
name_template: 'checksums.txt'
snapshot:
name_template: "{{ incpatch .Version }}"
changelog:
sort: asc
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
.PHONY: build
build:
go build -o .out/pkup main.go

.PHONY: verify
verify:
./hack/verify.sh
27 changes: 27 additions & 0 deletions hack/verify.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash

set -e

echo ">==( go mod verify )==="
go mod verify
echo "<==( OK )==="
echo ""

echo ">==( gofmt -d . )==="
fmt=$(gofmt -l .)
if [ "$fmt" != "" ]; then
echo $fmt
exit 1
fi
echo "<==( OK )==="
echo ""

echo ">==( go vet ./... )==="
go vet ./...
echo "<==( OK )==="
echo ""

echo ">==( go test --cover --race -timeout 30s ./... )==="
go test --cover --race -timeout 30s ./...
echo "<==( OK )==="
echo ""

0 comments on commit 4aafd77

Please sign in to comment.