Skip to content

Commit

Permalink
ci: set up GitHub Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
unknwon committed Aug 30, 2021
1 parent 1f0e29a commit 9b99baa
Show file tree
Hide file tree
Showing 7 changed files with 119 additions and 0 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Go
on:
push:
branches: [ main ]
paths:
- '**.go'
- 'go.mod'
- '.golangci.yml'
- '.github/workflows/go.yml'
pull_request:
paths:
- '**.go'
- 'go.mod'
- '.golangci.yml'
- '.github/workflows/go.yml'
env:
GOPROXY: "https://proxy.golang.org"

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v2
with:
version: latest
args: --timeout=30m

test:
name: Test
strategy:
matrix:
go-version: [ 1.16.x ]
platform: [ ubuntu-latest, macos-latest, windows-latest ]
runs-on: ${{ matrix.platform }}
steps:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- name: Checkout code
uses: actions/checkout@v2
- name: Run tests with coverage
run: go test -v -race -coverprofile=coverage -covermode=atomic ./...
- name: Upload coverage report to Codecov
uses: codecov/[email protected]
with:
file: ./coverage
flags: unittests
28 changes: 28 additions & 0 deletions .github/workflows/lsif.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: LSIF
on:
push:
paths:
- '**.go'
- 'go.mod'
- '.github/workflows/lsif.yml'
env:
GOPROXY: "https://proxy.golang.org"

jobs:
lsif-go:
if: github.repository == 'flamego/auth'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Generate LSIF data
uses: sourcegraph/lsif-go-action@master
- name: Upload LSIF data to sourcegraph.com
continue-on-error: true
uses: docker://sourcegraph/src-cli:latest
with:
args: lsif upload -github-token=${{ secrets.GITHUB_TOKEN }}
- name: Upload LSIF data to sourcegraph.unknwon.cn
continue-on-error: true
uses: docker://sourcegraph/src-cli:latest
with:
args: -endpoint=https://sourcegraph.unknwon.cn lsif upload -github-token=${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@

# Dependency directories (remove the comment below to include it)
# vendor/
/.idea
21 changes: 21 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
linters-settings:
nakedret:
max-func-lines: 0 # Disallow any unnamed return statement

linters:
enable:
- deadcode
- errcheck
- gosimple
- govet
- ineffassign
- staticcheck
- structcheck
- typecheck
- unused
- varcheck
- nakedret
- gofmt
- rowserrcheck
- unconvert
- goimports
5 changes: 5 additions & 0 deletions auth.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// Copyright 2021 Flamego. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.

package auth
9 changes: 9 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
coverage:
range: "60...95"
status:
project:
default:
threshold: 1%

comment:
layout: 'diff'
3 changes: 3 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module github.com/flamego/auth

go 1.16

0 comments on commit 9b99baa

Please sign in to comment.