mirror of
https://github.com/navidys/tvxwidgets.git
synced 2025-05-11 19:29:26 +08:00
89 lines
2.2 KiB
YAML
89 lines
2.2 KiB
YAML
name: validate pull requests
|
|
on:
|
|
pull_request:
|
|
|
|
jobs:
|
|
commit:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: get pr commits
|
|
id: 'get-pr-commits'
|
|
uses: tim-actions/get-pr-commits@v1.1.0
|
|
with:
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: DCO check
|
|
uses: tim-actions/dco@master
|
|
with:
|
|
commits: ${{ steps.get-pr-commits.outputs.commits }}
|
|
|
|
- name: check subject line length
|
|
uses: tim-actions/commit-message-checker-with-regex@v0.3.1
|
|
with:
|
|
commits: ${{ steps.get-pr-commits.outputs.commits }}
|
|
pattern: '^.{0,72}(\n.*)*$'
|
|
error: 'Subject too long (max 72)'
|
|
|
|
codespell:
|
|
name: codespell check
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- uses: codespell-project/actions-codespell@master
|
|
with:
|
|
check_filenames: true
|
|
skip: ./.git,./vendor,*_test.go,go.sum,go.mod,*_test.go
|
|
|
|
golangci-lint:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-go@v5
|
|
with:
|
|
# cannot use 1.21.X latest version since golangci-lint has an issue.
|
|
go-version: '1.21.4'
|
|
cache: false
|
|
- run: |
|
|
make .install.golangci-lint
|
|
make lint
|
|
|
|
unit_test:
|
|
name: Unit test
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version: '1.20'
|
|
id: go
|
|
|
|
- name: Check out code into the Go module directory
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Get dependencies
|
|
run: |
|
|
export GOBIN=$(pwd)/bin/
|
|
make .install.ginkgo
|
|
|
|
- name: Generate coverage report
|
|
run: |
|
|
export GOBIN=$(pwd)/bin/
|
|
make test-unit
|
|
|
|
- name: Upload coverage to Codecov
|
|
uses: codecov/codecov-action@v3
|
|
env:
|
|
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
|
with:
|
|
file: .coverage/coverprofile
|
|
name: codecov-umbrella
|
|
fail_ci_if_error: true
|
|
|
|
goreportcard:
|
|
name: update reportcard
|
|
if: github.event.pull_request.merged == true
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: creekorful/goreportcard-action@v1.0
|