diff --git a/.github/workflows/reviewdog.yml b/.github/workflows/reviewdog.yml index 464efd7..da463d6 100644 --- a/.github/workflows/reviewdog.yml +++ b/.github/workflows/reviewdog.yml @@ -6,10 +6,8 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out code into the Go module directory - uses: actions/checkout@v1 - - name: golangci-lint - uses: reviewdog/action-golangci-lint@v1 - # uses: docker://reviewdog/action-golangci-lint:v1 # pre-build docker image + uses: actions/checkout@v4 with: - github_token: ${{ secrets.GITHUB_TOKEN }} - golangci_lint_flags: "--config=.golangci.yml ./..." + fetch-depth: 0 + - name: golangci-lint + uses: reviewdog/action-golangci-lint@v2 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 19ca596..7b645e2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,35 +1,25 @@ +name: test + on: push: - branches: - - master + branches: ["master"] pull_request: -name: test + branches: ["master"] + jobs: - test: - strategy: - matrix: - platform: [ubuntu-latest] - env: - PIXELA_USER: ${{ secrets.PIXELA_USER }} - PIXELA_TOKEN: ${{ secrets.PIXELA_TOKEN }} - runs-on: ${{ matrix.platform }} + build-and-test: + runs-on: ubuntu-latest steps: - - name: Install Go - if: success() - uses: actions/setup-go@v2 - with: - go-version: '^1.15' # The Go version to download (if necessary) and use. - - name: Checkout code - uses: actions/checkout@v2 - - name: Use Cache - uses: actions/cache@v2 - with: - path: ~/go/pkg/mod - key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-go- - - name: Download Modules - if: steps.cache.outputs.cache-hit != 'true' - run: go mod download - - name: Run tests - run: go test -v -covermode=atomic + - uses: actions/checkout@v4 + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version-file: "go.mod" + cache: true + - name: Install dependencies + run: | + go get . + - name: Test + run: go test ./... -race -coverprofile=coverage.out -covermode=atomic + - name: Run octocov + uses: k1LoW/octocov-action@v1 diff --git a/.octocov.yml b/.octocov.yml new file mode 100644 index 0000000..10a6f36 --- /dev/null +++ b/.octocov.yml @@ -0,0 +1,22 @@ +# generated by octocov init +coverage: + if: true +codeToTestRatio: + code: + - "**/*.go" + - "!**/*_test.go" + test: + - "**/*_test.go" +testExecutionTime: + if: true +diff: + datastores: + - artifact://${GITHUB_REPOSITORY} +comment: + if: is_pull_request +summary: + if: true +report: + if: is_default_branch + datastores: + - artifact://${GITHUB_REPOSITORY} diff --git a/go.mod b/go.mod index eb33ef7..6d46f41 100644 --- a/go.mod +++ b/go.mod @@ -1,8 +1,13 @@ module github.com/budougumi0617/nrseg -go 1.15 +go 1.23 require ( github.com/google/go-cmp v0.5.4 golang.org/x/tools v0.0.0-20210101214203-2dba1e4ea05c ) + +require ( + golang.org/x/mod v0.3.0 // indirect + golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect +)