From 57617aa598470905472bfda86f259ae33da256f3 Mon Sep 17 00:00:00 2001 From: seiya <20365512+seiyab@users.noreply.github.com> Date: Sat, 27 Apr 2024 06:22:52 +0900 Subject: [PATCH] setup tools --- .editorconfig | 5 +++++ .github/workflows/go.yml | 42 ++++++++++++++++++++++++++++++++++++ .github/workflows/review.yml | 18 ++++++++++++++++ .reviewdog.yml | 5 +++++ 4 files changed, 70 insertions(+) create mode 100644 .editorconfig create mode 100644 .github/workflows/go.yml create mode 100644 .github/workflows/review.yml create mode 100644 .reviewdog.yml diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..9029500 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,5 @@ +root = true + +[*] +end_of_line = lf +insert_final_newline = true \ No newline at end of file diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml new file mode 100644 index 0000000..80574c9 --- /dev/null +++ b/.github/workflows/go.yml @@ -0,0 +1,42 @@ +name: Go + +on: + push: + branches: ["main"] + pull_request: + branches: ["main"] + +jobs: + build-and-test: + strategy: + matrix: + go-version: ["1.18", "1.19", "1.20", "1.21", "1.22"] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: ${{ matrix.go-version }} + + - name: Build + run: go build -v ./... + + - name: Test + run: go test -v ./... + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: "1.22" + + - name: Set up Staticcheck + run: go install honnef.co/go/tools/cmd/staticcheck@latest + + - name: Run Staticcheck + run: staticcheck ./... diff --git a/.github/workflows/review.yml b/.github/workflows/review.yml new file mode 100644 index 0000000..2fa5dc6 --- /dev/null +++ b/.github/workflows/review.yml @@ -0,0 +1,18 @@ +name: reviewdog +on: [pull_request] +jobs: + reviewdog: + name: reviewdog + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-go@v4 + with: + go-version: "1.21" # gost requires go 1.21 or later + - name: Install gost + run: go install github.com/seiyab/gost@latest + - uses: reviewdog/action-setup@v1 + - name: Run reviewdog + env: + REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: reviewdog -reporter=github-pr-review -runners=gost diff --git a/.reviewdog.yml b/.reviewdog.yml new file mode 100644 index 0000000..1bf031e --- /dev/null +++ b/.reviewdog.yml @@ -0,0 +1,5 @@ +runner: + gost: + cmd: go vet -vettool="$(which gost)" ./... + format: govet + level: warning