Skip to content

Commit

Permalink
chore: update gh workflow script and update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
inhere committed Jun 13, 2022
1 parent 2ea7355 commit 5f61f42
Show file tree
Hide file tree
Showing 5 changed files with 106 additions and 38 deletions.
37 changes: 37 additions & 0 deletions .github/changelog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
title: '## Change Log'
# style allow: simple, markdown(mkdown), ghr(gh-release)
style: gh-release
# group names
names: [Refactor, Fixed, Feature, Update, Other]
# if empty will auto fetch by git remote
#repo_url: https://github.com/{{repoPath}}

filters:
# message length should >= 12
- name: msg_len
min_len: 12
# message words should >= 3
- name: words_len
min_len: 3
- name: keyword
keyword: format code
exclude: true
- name: keywords
keywords: format code, action test
exclude: true

# group match rules
# not matched will use 'Other' group.
rules:
- name: Refactor
start_withs: [refactor, break]
contains: ['refactor:']
- name: Fixed
start_withs: [fix]
contains: ['fix:']
- name: Feature
start_withs: [feat, new]
contains: [feature]
- name: Update
start_withs: [update, 'up:']
contains: [' update']
68 changes: 43 additions & 25 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
name: unit-tests
name: Unit-Tests
on:
pull_request:
paths:
- 'go.mod'
- '**.go'
- '**.yml'

push:
paths:
- 'go.mod'
- '**.go'
- '**.yml'
- 'go.mod'

jobs:

Expand All @@ -19,31 +18,50 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
go_version: [1.15, 1.16, 1.17, 1.18]
os: [ubuntu-latest, windows-latest, macOS-latest]

steps:
- name: Check out code
uses: actions/checkout@v3
# https://github.com/actions/setup-go
- name: Use Go ${{ matrix.go_version }}
timeout-minutes: 3
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go_version }}

- name: Run unit tests
# run: go test -v -cover ./...
# must add " for profile.cov on windows OS
run: go test -v -coverprofile="profile.cov" ./...

- name: Send coverage
uses: shogo82148/actions-goveralls@v1
if: ${{ matrix.os == 'ubuntu-latest' }}
with:
path-to-profile: profile.cov
flag-name: Go-${{ matrix.go_version }}
parallel: true
- name: Check out code
uses: actions/checkout@v3

- name: Setup Go Faster
uses: WillAbides/setup-go-faster@v1.7.0
timeout-minutes: 3
with:
go-version: ${{ matrix.go_version }}

- name: Revive check
uses: morphy2k/revive-action@v2.3.1
if: ${{ matrix.os == 'ubuntu-latest' }}
with:
# Exclude patterns, separated by semicolons (optional)
exclude: "./internal/..."

- name: Run staticcheck
uses: reviewdog/action-staticcheck@v1
if: ${{ github.event_name == 'pull_request'}}
with:
github_token: ${{ secrets.github_token }}
# Change reviewdog reporter if you need [github-pr-check,github-check,github-pr-review].
reporter: github-pr-check
# Report all results. [added,diff_context,file,nofilter].
filter_mode: added
# Exit with 1 when it find at least one finding.
fail_on_error: true

- name: Run unit tests
# run: go test -v -cover ./...
# must add " for profile.cov on Windows OS
run: go test -v -coverprofile="profile.cov" ./...

- name: Send coverage
uses: shogo82148/actions-goveralls@v1
if: ${{ matrix.os == 'ubuntu-latest' }}
with:
path-to-profile: profile.cov
flag-name: Go-${{ matrix.go_version }}
parallel: true

# notifies that all test jobs are finished.
# https://github.com/shogo82148/actions-goveralls
Expand Down
31 changes: 22 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,39 @@ jobs:
strategy:
fail-fast: true
matrix:
go: [1.17]
go_version: [1.17]

steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup Go Faster
uses: WillAbides/setup-go-faster@v1.7.0
timeout-minutes: 3
with:
go-version: ${{ matrix.go_version }}

- name: Setup ENV
# https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable
run: |
echo "RELEASE_TAG=${GITHUB_REF:10}" >> $GITHUB_ENV
echo "RELEASE_NAME=$GITHUB_WORKFLOW" >> $GITHUB_ENV
- name: Display Env
run: env
- name: Generate changelog
run: |
go install github.com/gookit/gitw/cmd/chlog@latest
chlog -config .github/changelog.yml -output changelog.md prev last
# https://github.com/actions/create-release
- uses: meeDamian/github-release@2.0
# https://github.com/softprops/action-gh-release
- name: Create release and upload assets
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
gzip: false
token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ env.RELEASE_TAG }}
name: ${{ env.RELEASE_TAG }}
# files: kite-${{ env.RELEASE_TAG }}.phar
tag_name: ${{ env.RELEASE_TAG }}
body_path: changelog.md
token: ${{ secrets.GITHUB_TOKEN }}
# files: macos-chlog.exe
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@

Simple and fast web framework for build golang HTTP applications.

> NOTICE: `v1.3.x` is not fully compatible with `v1.2.x` version
- Fast route match, support route group
- Support route path params and named routing
- Support cache recently accessed dynamic routes
Expand All @@ -36,6 +34,8 @@ go get github.com/gookit/rux

## Quick start

> NOTICE: `v1.3.x` is not fully compatible with `v1.2.x` version
```go
package main

Expand Down
4 changes: 2 additions & 2 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@

`rux` 简单且快速的 Go web 框架,支持中间件,兼容 http.Handler 接口。

> NOTICE: `v1.3.x` 不完全兼容 `v1.2.x` 版本
- 支持路由参数,支持路由组,支持给路由命名
- 支持方便的静态文件/目录处理
- 支持缓存最近访问的动态路由以获得更高性能
Expand All @@ -36,6 +34,8 @@ go get github.com/gookit/rux

## 快速开始

> NOTICE: `v1.3.x` 不完全兼容 `v1.2.x` 版本
```go
package main

Expand Down

0 comments on commit 5f61f42

Please sign in to comment.