Skip to content

Commit

Permalink
ci設定
Browse files Browse the repository at this point in the history
  • Loading branch information
mazrean committed Jan 13, 2024
1 parent 6e4e7da commit dd227b1
Show file tree
Hide file tree
Showing 4 changed files with 142 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
version: 2
updates:
- package-ecosystem: gomod
directory: "/"
schedule:
interval: weekly
day: saturday
time: "00:00"
timezone: Asia/Tokyo
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: weekly
day: saturday
time: "00:00"
timezone: Asia/Tokyo
50 changes: 50 additions & 0 deletions .github/workflows/benchmark.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Benchmark

on:
pull_request:

jobs:
benchmark:
name: Benchmark
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- run: mkdir -p ./profile
- run: |
{
echo "stdout<<EOF"
go test -benchmem -bench . -cpuprofile ./profile/cpu.out -memprofile ./profile/mem.out
echo "EOF"
} >> $GITHUB_OUTPUT
id: bench
- uses: actions/upload-artifact@v4
id: artifact
with:
name: profile
path: profile
- run: |
cat << EOF > ./body.txt
## Benchmark Result
\`\`\`text
${{ steps.bench.outputs.stdout }}
\`\`\`
<details>
<summary>pprof command</summary>
\`\`\`sh
unzip <(gh api /repos/${{ github.repository }}/actions/artifacts/${{ steps.artifact.outputs.artifact-id }}/zip)
go tool pprof -http :6060 profile/cpu.out
\`\`\`
</details>
EOF
gh pr comment ${{ github.event.pull_request.number }} --edit-last -F ./body.txt --repo ${{ github.repository }}
env:
GH_TOKEN: ${{ github.token }}
38 changes: 38 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: CI

on:
push:
branches:
- 'main'
pull_request:

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: golangci-lint
uses: reviewdog/[email protected]
with:
go_version_file: go.mod
reporter: github-pr-review
github_token: ${{ secrets.GITHUB_TOKEN }}
fail_on_error: true
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- run: go test ./... -v -coverprofile=./coverage.txt -race -vet=off
- name: Upload coverage data
uses: codecov/[email protected]
with:
file: ./coverage.txt
- uses: actions/upload-artifact@v4
with:
name: coverage.txt
path: coverage.txt
38 changes: 38 additions & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
run:
skip-dirs:
- mock
linters:
enable:
- govet
- errcheck
- staticcheck
- unused
- gosimple
- structcheck
- varcheck
- ineffassign
- typecheck
- revive
- gofmt
- asasalint
- asciicheck
- bidichk
- errname
- errorlint
- exhaustive
- exportloopref
- forcetypeassert
- gocheckcompilerdirectives
- gocritic
- goheader
- goimports
- gosec
- misspell
- nakedret
- nilerr
- nosprintfhostport
- sqlclosecheck
- testpackage
- unconvert
- unparam
- whitespace

0 comments on commit dd227b1

Please sign in to comment.