Skip to content

Commit

Permalink
chore: switch travis to github actions. (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
appleboy authored Jun 22, 2021
1 parent 1262b56 commit 77e4132
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 3 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Run Tests

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
test:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
go: [1.13, 1.14, 1.15, 1.16]
name: ${{ matrix.os }} @ Go ${{ matrix.go }}
runs-on: ${{ matrix.os }}
env:
GO111MODULE: on
TESTTAGS: ${{ matrix.test-tags }}
GOPROXY: https://proxy.golang.org
steps:
- name: Set up Go ${{ matrix.go }}
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go }}

- name: Checkout Code
uses: actions/checkout@v2
with:
ref: ${{ github.ref }}

- name: golangci-lint
uses: golangci/golangci-lint-action@v2

- name: Run Tests
run: |
go install github.com/campoy/embedmd@latest
embedmd -d *.md
go test -v -covermode=atomic -coverprofile=coverage.out
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ func DefaultConfig() Config {
package main

import (
"log"

"github.com/gin-contrib/secure"
"github.com/gin-gonic/gin"
)
Expand Down Expand Up @@ -63,6 +65,8 @@ func main() {
})

// Listen and Server in 0.0.0.0:8080
router.Run()
if err := router.Run(); err != nil {
log.Fatal(err)
}
}
```
6 changes: 5 additions & 1 deletion example/code1/example.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package main

import (
"log"

"github.com/gin-contrib/secure"
"github.com/gin-gonic/gin"
)
Expand Down Expand Up @@ -28,5 +30,7 @@ func main() {
})

// Listen and Server in 0.0.0.0:8080
router.Run()
if err := router.Run(); err != nil {
log.Fatal(err)
}
}
6 changes: 5 additions & 1 deletion example/code2/example.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package main

import (
"log"

"github.com/gin-contrib/secure"
"github.com/gin-gonic/gin"
)
Expand All @@ -17,5 +19,7 @@ func main() {
c.String(200, "pong")
})

router.Run()
if err := router.Run(); err != nil {
log.Fatal(err)
}
}

0 comments on commit 77e4132

Please sign in to comment.