Skip to content

Commit

Permalink
introduce tagpr GitHub Action
Browse files Browse the repository at this point in the history
  • Loading branch information
Songmu committed Aug 20, 2023
1 parent 0f408d5 commit 8414124
Show file tree
Hide file tree
Showing 9 changed files with 107 additions and 39 deletions.
22 changes: 22 additions & 0 deletions .github/actions/release/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: release
description: release gotesplit
inputs:
tag:
description: tag name to be released
default: ''
token:
description: GitHub token
required: true
runs:
using: composite
steps:
- name: setup go
uses: actions/setup-go@v4
with:
go-version-file: go.mod
- name: release
run: |
make crossbuild upload
shell: bash
env:
GITHUB_TOKEN: ${{ inputs.token }}
4 changes: 4 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
changelog:
exclude:
labels:
- tagpr
12 changes: 2 additions & 10 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,8 @@ jobs:
release:
runs-on: ubuntu-latest
steps:
- name: setup go
uses: actions/setup-go@v3
with:
go-version: 1.x
- name: checkout
uses: actions/checkout@v3
- uses: ./.github/actions/release
with:
fetch-depth: 0
- name: release
env:
GITHUB_TOKEN: ${{ secrets.github_token }}
run: |
make crossbuild upload
token: ${{ secrets.GITHUB_TOKEN }}
42 changes: 42 additions & 0 deletions .github/workflows/reviewdog.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: reviewdog
on: [pull_request]

jobs:
staticcheck:
name: staticcheck
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v3
with:
persist-credentials: false
- name: staticcheck
uses: reviewdog/action-staticcheck@v1
with:
reporter: github-pr-review
level: warning

misspell:
name: misspell
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v3
with:
persist-credentials: false
- name: misspell
uses: reviewdog/action-misspell@v1
with:
reporter: github-pr-review
level: warning
locale: "US"

actionlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
persist-credentials: false
- uses: reviewdog/action-actionlint@v1
with:
reporter: github-pr-review
13 changes: 0 additions & 13 deletions .github/workflows/reviewdog.yml

This file was deleted.

25 changes: 25 additions & 0 deletions .github/workflows/tagpr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: tagpr
on:
push:
branches:
- "main"
jobs:
tagpr:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v3
- name: setup go
uses: actions/setup-go@v4
with:
go-version-file: go.mod
- name: tagpr
id: tagpr
uses: Songmu/tagpr@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: ./.github/actions/release
with:
tag: ${{ steps.tagpr.outputs.tag }}
token: ${{ secrets.GITHUB_TOKEN }}
if: "steps.tagpr.outputs.tag != ''"
18 changes: 7 additions & 11 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ on:
push:
branches:
- "**"
pull_request: {}
jobs:
test:
runs-on: ${{ matrix.os }}
Expand All @@ -15,18 +14,15 @@ jobs:
- macOS-latest
- windows-latest
steps:
- name: checkout
uses: actions/checkout@v3
- name: setup go
uses: actions/setup-go@v3
uses: actions/setup-go@v4
with:
go-version: 1.x
- name: Set git to use LF
run: |
git config --global core.autocrlf false
git config --global core.eol lf
if: "matrix.os == 'windows-latest'"
- name: checkout
uses: actions/checkout@v2
go-version-file: go.mod
- name: test
run: go test -race -coverprofile coverage.out -covermode atomic
- name: Upload coverage to Codecov
env:
GITHUB_TOKEN: ${{ secrets.github_token }}
- name: Send coverage
uses: codecov/codecov-action@v1
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ release: devel-deps
CREDITS: deps devel-deps
godzil credits -w

DIST_DIR = dist/v$(VERSION)
.PHONY: crossbuild
DIST_DIR = dist
.PHONY: go.sum crossbuild
crossbuild: CREDITS
rm -rf $(DIST_DIR)
env CGO_ENABLED=0 godzil crossbuild -pv=v$(VERSION) -build-ldflags=$(BUILD_LDFLAGS) \
Expand All @@ -42,4 +42,4 @@ crossbuild: CREDITS

.PHONY: upload
upload:
ghr -body="$$(godzil changelog --latest -F markdown)" v$(VERSION) dist/v$(VERSION)
ghr v$(VERSION) $(DIST_DIR)
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ jobs:
parallelism: [3]
index: [0,1,2]
steps:
- uses: actions/setup-go@v2
- uses: actions/checkout@v2
- uses: actions/setup-go@v4
- uses: actions/checkout@v3
- name: Run tests parallelly
run: |
curl -sfL https://raw.githubusercontent.com/Songmu/gotesplit/main/install.sh | sh -s
Expand Down

0 comments on commit 8414124

Please sign in to comment.