Skip to content

Commit

Permalink
add workflows (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
JunNishimura committed Apr 25, 2024
1 parent 245c9eb commit 5e8ebcb
Show file tree
Hide file tree
Showing 4 changed files with 128 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version: 2
updates:
- directory: /
package-ecosystem: "gomod"
schedule:
interval: "weekly"
day: "monday"
time: "10:00"
target-branch: "develop"
groups:
dev-dependencies:
patterns:
- "*"
21 changes: 21 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: lint

on:
push:
branches:
- '**'

jobs:
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v4
with:
go-version: 1.22
- uses: actions/checkout@v3

- name: golangci-lint
uses: golangci/golangci-lint-action@v3.4.0
with:
version: latest
55 changes: 55 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: release cli to the GitHub Release

on:
workflow_dispatch:
inputs:
method:
description: |
Which number to increment in the semantic versioning.
Set 'major', 'minor', or 'patch'.
required: true

jobs:
release:
name: release
runs-on: ubuntu-latest
steps:
- name: check actor
if: github.actor != 'JunNishimura'
run: exit 1
- name: check branch
if: github.ref != 'refs/heads/main'
run: exit 1
- name: wait tests
id: test_result
uses: Sibz/await-status-action@v1.0.1
with:
contexts: test-status
authToken: ${{ secrets.GITHUB_TOKEN }}
timeout: 30
- name: check test result
if: steps.test_result.outputs.result != 'success'
run: |
echo "failed ${{ steps.test_result.outputs.failedCheckNames }}"
echo "failed ${{ steps.test_result.outputs.failedCheckStates }}"
exit 1
- name: checkout sources
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: bump-up semantic version
uses: kyoh86/git-vertag-action@v1.1
with:
method: "${{ github.event.inputs.method }}"
- name: setup Go
uses: actions/setup-go@v3
with:
go-version-file: go.mod
cache: true
- name: run goreleaser
uses: goreleaser/goreleaser-action@v4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAP_GITHUB_TOKEN: ${{ secrets.TAP_GITHUB_TOKEN }}
with:
args: release --rm-dist
39 changes: 39 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: test

on:
push:
branches:
- '**'

jobs:
test:
name: test
strategy:
fail-fast: false
max-parallel: 3
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: checkout
uses: actions/checkout@v2
- name: setup Golang
uses: actions/setup-go@v2
with:
go-version: 1.22
- name: get dependencies
run: go get -v -t -d ./...
- name: test code
run: go test ./...

test-status:
name: test status
runs-on: ubuntu-latest
needs: test
steps:
- name: set check status success
uses: Sibz/github-status-action@v1
with:
context: test-status
authToken: ${{ secrets.GITHUB_TOKEN }}
state: success

0 comments on commit 5e8ebcb

Please sign in to comment.