Skip to content

Commit 33f1b34

Browse files
authored
Replace Travis with Github Actions (#190)
* Replace Travis with Github Actions * Fix context timeout error * Add Github workflow badge * Add coverage to actions
1 parent 2f839c8 commit 33f1b34

File tree

4 files changed

+44
-21
lines changed

4 files changed

+44
-21
lines changed

.github/workflows/tests.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: tests
2+
3+
on:
4+
push:
5+
branches: [master]
6+
pull_request:
7+
branches: [master]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
go: [1.16.x, 1.17.x, 1.18.x]
16+
steps:
17+
- uses: actions/checkout@v2
18+
19+
- name: Set up Go
20+
uses: actions/setup-go@v2
21+
with:
22+
go-version: ${{ matrix.go }}
23+
24+
- name: Install goveralls
25+
run: go install github.com/mattn/goveralls@latest
26+
27+
- name: Build
28+
run: go build -v ./...
29+
30+
- name: Run tests
31+
run: go test -race -covermode=atomic -coverprofile=covprofile -v ./...
32+
33+
- name: Update coverage
34+
env:
35+
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
36+
run: goveralls -coverprofile=covprofile -service=github

.travis.yml

Lines changed: 0 additions & 17 deletions
This file was deleted.

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
APNS/2 is a go package designed for simple, flexible and fast Apple Push Notifications on iOS, OSX and Safari using the new HTTP/2 Push provider API.
44

5-
[![Build Status](https://travis-ci.org/sideshow/apns2.svg?branch=master)](https://travis-ci.org/sideshow/apns2) [![Coverage Status](https://coveralls.io/repos/sideshow/apns2/badge.svg?branch=master&service=github)](https://coveralls.io/github/sideshow/apns2?branch=master) [![GoDoc](https://godoc.org/github.com/sideshow/apns2?status.svg)](https://godoc.org/github.com/sideshow/apns2)
5+
[![Build Status](https://github.com/sideshow/apns2/actions/workflows/tests.yml/badge.svg)](https://github.com/sideshow/apns2/actions/workflows/tests.yml) [![Coverage Status](https://coveralls.io/repos/sideshow/apns2/badge.svg?branch=master&service=github)](https://coveralls.io/github/sideshow/apns2?branch=master) [![GoDoc](https://godoc.org/github.com/sideshow/apns2?status.svg)](https://godoc.org/github.com/sideshow/apns2)
66

77
## Features
88

@@ -27,6 +27,7 @@ go get -u github.com/sideshow/apns2
2727
```
2828

2929
If you are running the test suite you will also need to install testify:
30+
3031
```sh
3132
go get -u github.com/stretchr/testify
3233
```
@@ -60,7 +61,7 @@ func main() {
6061
// client := apns2.NewClient(cert).Development()
6162
// For apps published to the app store or installed as an ad-hoc distribution use Production()
6263

63-
client := apns2.NewClient(cert).Production()
64+
client := apns2.NewClient(cert).Production()
6465
res, err := client.Push(notification)
6566

6667
if err != nil {

client_test.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"crypto/elliptic"
77
"crypto/rand"
88
"crypto/tls"
9+
"errors"
910
"fmt"
1011
"io/ioutil"
1112
"net"
@@ -139,8 +140,10 @@ func TestDialTLSTimeout(t *testing.T) {
139140
if _, e = dialTLS("tcp", address, nil); e == nil {
140141
t.Fatal("Dial completed successfully")
141142
}
142-
if !strings.Contains(e.Error(), "timed out") {
143-
t.Errorf("resulting error not a timeout: %s", e)
143+
// Go 1.7.x and later will return a context deadline exceeded error
144+
// Previous versions will return a time out
145+
if !strings.Contains(e.Error(), "timed out") && !errors.Is(e, context.DeadlineExceeded) {
146+
t.Errorf("Unexpected error: %s", e)
144147
}
145148
}
146149

0 commit comments

Comments
 (0)