diff --git a/.github/dependabot.yaml b/.github/dependabot.yaml new file mode 100644 index 0000000..9a56402 --- /dev/null +++ b/.github/dependabot.yaml @@ -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 \ No newline at end of file diff --git a/.github/workflows/benchmark.yaml b/.github/workflows/benchmark.yaml new file mode 100644 index 0000000..d6c43b0 --- /dev/null +++ b/.github/workflows/benchmark.yaml @@ -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<> $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 }} + \`\`\` + +
+ pprof command + \`\`\`sh + unzip <(gh api /repos/${{ github.repository }}/actions/artifacts/${{ steps.artifact.outputs.artifact-id }}/zip) + go tool pprof -http :6060 profile/cpu.out + \`\`\` +
+ EOF + + gh pr comment ${{ github.event.pull_request.number }} --edit-last -F ./body.txt --repo ${{ github.repository }} + env: + GH_TOKEN: ${{ github.token }} diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..3137cc8 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -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/action-golangci-lint@v2.5 + 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/codecov-action@v3.1.4 + with: + file: ./coverage.txt + - uses: actions/upload-artifact@v4 + with: + name: coverage.txt + path: coverage.txt diff --git a/.golangci.yaml b/.golangci.yaml new file mode 100644 index 0000000..762b560 --- /dev/null +++ b/.golangci.yaml @@ -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