Skip to content

Commit 615ce99

Browse files
committed
Adds Github action for testing
Plus small tweaks to get the build matrix passing
1 parent 1a8484b commit 615ce99

File tree

3 files changed

+24
-6
lines changed

3 files changed

+24
-6
lines changed

.github/workflows/test.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Go
2+
3+
on: [push]
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
strategy:
9+
matrix:
10+
go-version: ["1.7", "1.x"]
11+
12+
steps:
13+
- uses: actions/checkout@v3
14+
- name: Setup Go ${{ matrix.go-version }}
15+
uses: actions/setup-go@v3
16+
with:
17+
go-version: ${{ matrix.go-version }}
18+
- name: Test
19+
run: go test

githubhook_test.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
package githubhook_test
1+
package githubhook
22

33
import (
44
"crypto/hmac"
55
"crypto/sha1"
66
"encoding/hex"
77
"fmt"
8-
"github.com/rjz/githubhook"
98
"net/http"
109
"strings"
1110
"testing"
@@ -20,12 +19,12 @@ func expectErrorMessage(t *testing.T, msg string, err error) {
2019
}
2120

2221
func expectNewError(t *testing.T, msg string, r *http.Request) {
23-
_, err := githubhook.New(r)
22+
_, err := New(r)
2423
expectErrorMessage(t, msg, err)
2524
}
2625

2726
func expectParseError(t *testing.T, msg string, r *http.Request) {
28-
_, err := githubhook.Parse([]byte(testSecret), r)
27+
_, err := Parse([]byte(testSecret), r)
2928
expectErrorMessage(t, msg, err)
3029
}
3130

@@ -77,7 +76,7 @@ func TestValidSignature(t *testing.T) {
7776
r.Header.Add("x-github-event", "bogus event")
7877
r.Header.Add("x-github-delivery", "bogus id")
7978

80-
if _, err := githubhook.Parse([]byte(testSecret), r); err != nil {
79+
if _, err := Parse([]byte(testSecret), r); err != nil {
8180
t.Error(fmt.Sprintf("Unexpected error '%s'", err))
8281
}
8382
}

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module github.com/rjz/githubhook
22

3-
go 1.4
3+
go 1.7

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy