diff --git a/.circleci/config.yml b/.circleci/config.yml index 939dcb1..929c0e6 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,55 +1,60 @@ version: 2 jobs: - go1.20: &base + go1.21: &base docker: - - image: cimg/go:1.20 + - image: cimg/go:1.21 steps: - run: go version - checkout - - run: go test -tags nikandfor_loc_unsafe -race -coverprofile=coverage.txt -covermode=atomic -v ./... - - run: bash <(curl -s https://codecov.io/bash) + - run: go test -tags nikandfor_loc_unsafe -race -v ./... + + go1.20: + <<: *base + docker: + - image: cimg/go:1.20 - go1.19: &base_next + go1.19: <<: *base docker: - image: cimg/go:1.19 - steps: - - run: go version - - checkout - - run: go test -tags nikandfor_loc_unsafe -race -v ./... go1.18: - <<: *base_next + <<: *base docker: - image: cimg/go:1.18 go1.17: - <<: *base_next + <<: *base docker: - image: cimg/go:1.17 go1.16: - <<: *base_next + <<: *base docker: - image: circleci/golang:1.16 working_directory: /go/wd go1.15: - <<: *base_next + <<: *base docker: - image: circleci/golang:1.15 go1.14: - <<: *base_next + <<: *base docker: - image: circleci/golang:1.14 - go1.20_safe: &base_safe + go1.21_safe: &base_safe <<: *base steps: - run: go version - checkout - - run: go test -race -cover -v ./... + - run: go test -race -v ./... + + go1.20_safe: + <<: *base_safe + docker: + - image: cimg/go:1.20 go1.19_safe: <<: *base_safe @@ -65,13 +70,15 @@ workflows: version: 2 build: jobs: + - go1.21_safe - go1.20_safe - go1.19_safe - go1.18_safe + - go1.21 - go1.20 - go1.19 - go1.18 - go1.17 - - go1.16 + #- go1.16 test passes in official docker image (arm64), but not in circleci - go1.15 - go1.14 diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml new file mode 100644 index 0000000..5f07346 --- /dev/null +++ b/.github/workflows/go.yml @@ -0,0 +1,31 @@ +# This workflow will build a golang project +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go + +name: Go + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +jobs: + + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Set up Go + uses: actions/setup-go@v3 + with: + go-version: "1.21" + + - name: Build + run: go build -v ./... + + - name: Test + run: go test -v -coverprofile=coverage.txt -covermode=atomic ./... + + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v3 diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml new file mode 100644 index 0000000..9cebd77 --- /dev/null +++ b/.github/workflows/golangci-lint.yml @@ -0,0 +1,24 @@ +name: golangci-lint +on: + push: + pull_request: +jobs: + golangci: + name: lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: golangci-lint + uses: golangci/golangci-lint-action@v2 + with: + # Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version. + version: latest + + # Optional: working directory, useful for monorepos + # working-directory: somedir + + # Optional: golangci-lint command line arguments. + # args: --issues-exit-code=0 + + # Optional: show only new issues if it's a pull request. The default value is `false`. + # only-new-issues: true diff --git a/README.md b/README.md index 1342630..79127a7 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ [![Documentation](https://pkg.go.dev/badge/github.com/nikandfor/loc)](https://pkg.go.dev/github.com/nikandfor/loc?tab=doc) -[![Build Status](https://travis-ci.com/nikandfor/loc.svg?branch=master)](https://travis-ci.com/nikandfor/loc) +[![Go workflow](https://github.com/nikandfor/json/actions/workflows/go.yml/badge.svg)](https://github.com/nikandfor/json/actions/workflows/go.yml) [![CircleCI](https://circleci.com/gh/nikandfor/loc.svg?style=svg)](https://circleci.com/gh/nikandfor/loc) [![codecov](https://codecov.io/gh/nikandfor/loc/tags/latest/graph/badge.svg)](https://codecov.io/gh/nikandfor/loc) [![GolangCI](https://golangci.com/badges/github.com/nikandfor/loc.svg)](https://golangci.com/r/github.com/nikandfor/loc)