Update Github Actions

This commit is contained in:
Justin Hammond 2021-09-23 18:50:43 +08:00
parent 2ada6d0c20
commit 2056602d28
4 changed files with 141 additions and 7 deletions

46
.github/labeler.yml vendored Normal file
View file

@ -0,0 +1,46 @@
version: v1
labels:
- label: "type: feature"
sync: true
matcher:
title: "^feat: .*"
commits: "^feat: .*"
body: "(\\n|.)*- \\[x\\] feature(\\n|.)*"
- label: "type: bug"
sync: true
matcher:
title: "^fix: .*"
commits: "^fix: .*"
body: "(\\n|.)*- \\[x\\] (fix|bug)(\\n|.)*"
- label: "type: chore"
sync: true
matcher:
title: "^chore: .*"
commits: "^chore: .*"
body: "(\\n|.)*- \\[x\\] chore(\\n|.)*"
files: [ ".github/*" ]
- label: "type: docs"
sync: true
matcher:
title: "^docs: .*"
commits: "^docs: .*"
files: [ "*.md", "doc.go" ]
checks:
- context: "Semantic Pull Request"
url: "https://github.com/Fishwaldo/go-logadapter/blob/master/.github/labeler.yml"
description:
success: Ready for review & merge.
failure: Missing semantic label for merge.
labels:
any:
- 'type: feature'
- 'type: bug'
- 'type: chore'
- 'type: docs'
- 'type: maintenance'
- 'type: dependencies'

39
.github/release-drafter.yml vendored Normal file
View file

@ -0,0 +1,39 @@
name-template: 'v$RESOLVED_VERSION'
tag-template: 'v$RESOLVED_VERSION'
template: |
# What's Changed
$CHANGES
categories:
- title: 'Breaking'
label: 'type: breaking'
- title: 'New'
label: 'type: feature'
- title: 'Bug Fixes'
label: 'type: bug'
- title: 'Maintenance'
label: 'type: maintenance'
- title: 'Maintenance'
label: 'type: chore'
- title: 'Documentation'
label: 'type: docs'
- title: 'Dependency Updates'
label: 'type: dependencies'
version-resolver:
major:
labels:
- 'type: breaking'
minor:
labels:
- 'type: feature'
patch:
labels:
- 'type: bug'
- 'type: maintenance'
- 'type: docs'
- 'type: dependencies'
- 'type: security'
exclude-labels:
- 'skip-changelog'

View file

@ -21,15 +21,38 @@ jobs:
uses: actions/setup-go@v1
with:
go-version: ${{ matrix.go-version }}
- name: Checkout code
uses: actions/checkout@v1
- name: Install libusb-1.0-0-dev
run: sudo apt-get install libusb-1.0-0-dev
- name: Checkout code
uses: actions/checkout@v1
- name: Run tests
run: go test -v -race ./...
run: go test -v -race
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install libusb-1.0-0-dev
run: sudo apt-get install libusb-1.0-0-dev
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: go
- name: Autobuild
uses: github/codeql-action/autobuild@v1
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
codecov:
runs-on: ubuntu-latest
needs: test
needs: [ test, analyze ]
steps:
- name: Install Go
if: success()
@ -41,13 +64,14 @@ jobs:
- name: Install libusb-1.0-0-dev
run: sudo apt-get install libusb-1.0-0-dev
- name: Run tests
run: go test -v -race -covermode=atomic -coverprofile=coverage.out ./...
run: go mod tidy && go test -v -race -covermode=atomic -coverprofile=coverage.out ./...
- name: CodeCov
uses: codecov/codecov-action@v2
lint:
name: Lint project using GolangCI Lint
runs-on: ubuntu-latest
needs: test
needs: [ test, analyze ]
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v1
@ -57,6 +81,7 @@ jobs:
version: latest
only-new-issues: true
args: --issues-exit-code=0
goreadme:
runs-on: ubuntu-latest
needs: [codecov, lint]
@ -69,5 +94,20 @@ jobs:
badge-codecov: 'true'
badge-godoc: 'true'
email: 'justin@dynam.ac'
title: 'Go-DCDCUSB'
title: 'Go-LogAdapter'
# Optional: Token allows goreadme to comment the PR with diff preview.
github-token: '${{ secrets.GITHUB_TOKEN }}'
release:
#if: startsWith(github.ref, 'refs/tags/')
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
needs: [goreadme]
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v2
- uses: release-drafter/release-drafter@master
with:
prerelease: ${{ contains(github.ref, '-rc') || contains(github.ref, '-b') || contains(github.ref, '-a') }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

9
.github/workflows/labeler.yml vendored Normal file
View file

@ -0,0 +1,9 @@
on:
pull_request_target:
types: [ opened, reopened, edited, synchronize, ready_for_review, labeled, unlabeled ]
name: Labeler
jobs:
labeler:
runs-on: ubuntu-latest
steps:
- uses: fuxingloh/multi-labeler@v1