Skip to content

Commit

Permalink
transfer ci and releases to github
Browse files Browse the repository at this point in the history
  • Loading branch information
piranha committed Apr 14, 2023
1 parent 0a7b950 commit 66441e4
Show file tree
Hide file tree
Showing 10 changed files with 69 additions and 53 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: webhooker CI
on: [push]
jobs:
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
- run: go mod download
- run: pip install prysk
- run: make test

release:
if: github.ref_type == 'tag' && github.repository_owner == 'piranha'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
- run: make all
- name: Publish release
uses: softprops/action-gh-release@v1
with:
files: build/*.gz
tag_name: ${{ github.ref_name }}
3 changes: 0 additions & 3 deletions .travis.yml

This file was deleted.

21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2013 Alexander Solovyov

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
15 changes: 0 additions & 15 deletions LICENSE.txt

This file was deleted.

44 changes: 15 additions & 29 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,37 +1,23 @@
SOURCE = $(wildcard *.go)
SOURCE = $(wildcard *.go) go.mod go.sum
TAG ?= $(shell git describe --tags)
GOBUILD = go build -ldflags '-w'

ALL = $(foreach suffix,win.exe linux osx,\
build/webhooker-$(suffix))

all: $(ALL)

clean:
rm -f $(ALL)
GOBUILD = go build -ldflags "-w -X main.Version=${TAG}"

test:
go test
prysk tests/cmdline.t

win.exe = windows
osx = darwin
build/webhooker-%: $(SOURCE)
clean:
rm -f $(ALL)

win.exe.gz = GOOS=windows GOARCH=amd64
linux.gz = GOOS=linux GOARCH=amd64
mac-amd64.gz = GOOS=darwin GOARCH=amd64
mac-arm64.gz = GOOS=darwin GOARCH=arm64
build/webhooker-%.gz: $(SOURCE)
@mkdir -p $(@D)
CGO_ENABLED=0 GOOS=$(firstword $($*) $*) GOARCH=amd64 go build -o $@
CGO_ENABLED=0 $($*) $(GOBUILD) -o $(basename $@)
gzip $(basename $@)

ifndef desc
release:
@echo "Push a tag and run this as 'make release desc=tralala'"
else
release: $(ALL)
github-release release -u piranha -r webhooker -t "$(TAG)" -n "$(TAG)" --description "$(desc)"
@for x in $(ALL); do \
echo "Uploading $$x" && \
github-release upload -u piranha \
-r webhooker \
-t $(TAG) \
-f "$$x" \
-n "$$(basename $$x)"; \
done
endif
ALL = $(foreach suffix,mac-arm64 mac-amd64 linux win.exe,\
build/webhooker-$(suffix).gz)
all: $(ALL)
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/stretchr/objx v0.5.0 // indirect
golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4 // indirect
golang.org/x/sys v0.7.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
3 changes: 2 additions & 1 deletion go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8=
github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4 h1:EZ2mChiOa8udjfp6rRmswTbtZN/QzUQp4ptM4rnjHvc=
golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU=
golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
Expand Down
2 changes: 1 addition & 1 deletion tests/cmdline.t
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Usage:
-i, --interface= ip to listen on (default: 127.0.0.1)
-p, --port= port to listen on (default: 8000)
-l, --log= path to file for logging
-c, --config= read rules from this file
-c, --config= read rules linewise from this file
-d, --dump dump rules to console
-V, --version show version and exit
--help show this help message
Expand Down
4 changes: 2 additions & 2 deletions webhooker.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// (c) 2013-2023 Alexander Solovyov under terms of ISC License
// (c) 2013-2023 Alexander Solovyov

package main

Expand All @@ -24,7 +24,7 @@ var opts struct {
Interface string `short:"i" long:"interface" default:"127.0.0.1" description:"ip to listen on"`
Port string `short:"p" long:"port" default:"8000" description:"port to listen on"`
Log string `short:"l" long:"log" description:"path to file for logging"`
Config string `short:"c" long:"config" description:"read rules from this file"`
Config string `short:"c" long:"config" description:"read rules linewise from this file"`
Dump bool `short:"d" long:"dump" description:"dump rules to console"`
Version bool `short:"V" long:"version" description:"show version and exit"`
ShowHelp bool ` long:"help" description:"show this help message"`
Expand Down
2 changes: 1 addition & 1 deletion webhooker_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// (c) 2013 Alexander Solovyov under terms of ISC License
// (c) 2013 Alexander Solovyov

package main

Expand Down

0 comments on commit 66441e4

Please sign in to comment.