Skip to content

Commit

Permalink
added github actions files
Browse files Browse the repository at this point in the history
  • Loading branch information
hedzr committed Sep 25, 2020
1 parent 4288f72 commit 1f3ed8f
Show file tree
Hide file tree
Showing 2 changed files with 192 additions and 0 deletions.
39 changes: 39 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# This is a comment.
# Each line is a file pattern followed by one or more owners.

# These owners will be the default owners for everything in
# the repo. Unless a later match takes precedence,
# @global-owner1 and @global-owner2 will be requested for
# review when someone opens a pull request.
#* @global-owner1 @global-owner2

# Order is important; the last matching pattern takes the most
# precedence. When someone opens a pull request that only
# modifies JS files, only @js-owner and not the global
# owner(s) will be requested for a review.
#*.js @js-owner

# You can also use email addresses if you prefer. They'll be
# used to look up users just like we do for commit author
# emails.
#*.go docs@example.com

# In this example, @doctocat owns any files in the build/logs
# directory at the root of the repository and any of its
# subdirectories.
#/build/logs/ @doctocat

# The `docs/*` pattern will match files like
# `docs/getting-started.md` but not further nested files like
# `docs/build-app/troubleshooting.md`.
#docs/* docs@example.com

# In this example, @octocat owns any file in an apps directory
# anywhere in your repository.
#apps/ @octocat

# In this example, @doctocat owns any file in the `/docs`
# directory in the root of your repository.
#/docs/ @doctocat

* @hedzr
153 changes: 153 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
name: Go

on:
push:
branches: [ v2 ]
# Sequence of patterns matched against refs/tags
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
pull_request:
branches: [ v2 ]
# types: [assigned, opened, synchronize, reopened]

#on: [push, pull_request]

jobs:
test:
strategy:
matrix:
go-version: [1.11.x, 1.12.x, 1.13.x, 1.14.x]
#os: [ubuntu-latest, macos-latest, windows-latest]
os: [ubuntu-latest]
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- name: Checkout code
uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Test
run: go test ./...

coverage:
#needs: test
env:
COVERALLS_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
runs-on: ubuntu-latest
steps:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.14.x
- name: Checkout code
uses: actions/checkout@v2
#with:
# path: ./src/github.com/${{ github.repository }}
- uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Test & Coverage
run: go test -v -coverprofile=profile.cov ./...
- name: Send coverage
uses: shogo82148/actions-goveralls@v1
with:
path-to-profile: profile.cov
parallel: true

# build:
# #env:
# # GOPATH: ${{ github.workspace }}
# # GO111MODULE: off
# runs-on: ubuntu-latest
# steps:
# - name: Install Go
# uses: actions/setup-go@v2
# with:
# go-version: 1.14.x
# - name: Checkout code
# uses: actions/checkout@v2
# #with:
# # path: ./src/github.com/${{ github.repository }}
# - uses: actions/cache@v2
# with:
# path: ~/go/pkg/mod
# key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
# restore-keys: |
# ${{ runner.os }}-go-
# - name: Build
# run: |
# for dir in cmdr std; do
# for GOOS in windows linux darwin; do
# for GOARCH in amd64; do
# suf=; if [[ $GOOS == "windows" ]]; then suf=".exe"; fi
# go build -v -o bin/tcp-tool-$dir-$GOOS-$GOARCH$suf ./examples/$dir
# gzip bin/tcp-tool-$dir-$GOOS-$GOARCH$suf
# done
# done
# done
# - name: upload artifacts
# uses: actions/upload-artifact@master
# if: startsWith(github.ref, 'refs/tags/v')
# with:
# name: binaries
# path: bin/
#
# - name: Upload binaries to release
# uses: svenstaro/upload-release-action@v2
# if: startsWith(github.ref, 'refs/tags/v')
# with:
# repo_token: ${{ secrets.GITHUB_TOKEN }}
# file: bin/*
# tag: ${{ github.ref }}
# overwrite: true
# file_glob: true
# #body:
## - name: Create Release
## id: create_release
## uses: actions/create-release@v1
## env:
## GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
## with:
## tag_name: ${{ github.ref }}
## release_name: Release ${{ github.ref }}
## draft: false
## prerelease: false
## - name: Upload Release Asset
## id: upload-release-asset
## uses: actions/upload-release-asset@v1
## env:
## GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
## with:
## upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
## asset_path: bin/*
## asset_name: my-artifact.zip
## asset_content_type: application/zip

# notifies coveralls that all test jobs are finished
finish:
name: Finish
needs: coverage
runs-on: ubuntu-latest
steps:
- uses: shogo82148/actions-goveralls@v1
with:
parallel-finished: true








0 comments on commit 1f3ed8f

Please sign in to comment.