Skip to content

Commit

Permalink
chore: test
Browse files Browse the repository at this point in the history
  • Loading branch information
elliotxx committed Aug 2, 2023
1 parent a6025cf commit 0909a34
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 44 deletions.
46 changes: 2 additions & 44 deletions .github/workflows/check.yaml
Original file line number Diff line number Diff line change
@@ -1,58 +1,16 @@
# Reference from:
# https://github.com/c-bata/go-prompt/blob/master/.github/workflows/test.yml
name: Check
name: Commit and PR Lint
on:
pull_request:
types: [opened, edited, synchronize, reopened]
branches:
- main
- feat/app-config
push:
branches:
- main
jobs:
Test:
name: Unit tests with coverage
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Go 1.19
uses: actions/setup-go@v2
with:
go-version: 1.19

- run: go build ./...
- run: go vet ./...

- name: Running go tests with coverage
env:
GO111MODULE: on
run: make cover
- name: Send coverage
uses: shogo82148/actions-goveralls@v1
with:
path-to-profile: coverage.out

GolangLint:
name: Golang Lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Go 1.19
uses: actions/setup-go@v2
with:
go-version: 1.19
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
version: v1.52.2

# Lints Pull Request commits with commitlint.
#
# Rules can be referenced:
Expand Down
54 changes: 54 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Reference from:
# https://github.com/c-bata/go-prompt/blob/master/.github/workflows/test.yml
name: Test and Lint of Go
on:
pull_request:
branches:
- main
push:
branches:
- main
jobs:
Test:
name: Unit tests with coverage
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Go 1.19
uses: actions/setup-go@v2
with:
go-version: 1.19

- run: go build ./...
- run: go vet ./...

- name: Running go tests with coverage
env:
GO111MODULE: on
run: make cover
- name: Send coverage
uses: shogo82148/actions-goveralls@v1
with:
path-to-profile: coverage.out

GolangLint:
name: Golang Lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Go 1.19
uses: actions/setup-go@v2
with:
go-version: 1.19
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
version: v1.52.2

0 comments on commit 0909a34

Please sign in to comment.