diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..e3e28a7 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,52 @@ +name: ci +on: + push: + pull_request: + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Go + uses: actions/setup-go@v5 + with: + go-version: 'stable' + + - name: Run linters + shell: bash --noprofile --norc -x -eo pipefail {0} + run: | + $(exit $(go fmt ./... | wc -l)) + go vet ./... + + test: + runs-on: ubuntu-latest-8-cores + + strategy: + matrix: + go: [ "1.16", "1.23" ] + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Go + uses: actions/setup-go@v5 + with: + go-version: ${{ matrix.go }} + + - name: Test and coverage + shell: bash --noprofile --norc -x -eo pipefail {0} + run: | + if [ "${{ matrix.go }}" = "1.23" ]; then + go test -v -race -covermode=atomic -coverprofile=coverage.out ./... + else + go test -v -race + fi + + - name: Coveralls + if: matrix.go == '1.23' + uses: coverallsapp/github-action@v2 + with: + file: coverage.out \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 82652db..0000000 --- a/.travis.yml +++ /dev/null @@ -1,20 +0,0 @@ -language: go -sudo: false -arch: -- amd64 -- ppc64le -go: -- "1.16" -- "1.23" - -install: -- go get -t ./... -- go get github.com/mattn/goveralls - -script: -- go fmt ./... -- go vet ./... -- go test -v -- go test -v --race -- go test -v -covermode=count -coverprofile=coverage.out -- $HOME/gopath/bin/goveralls -coverprofile coverage.out -service travis-ci diff --git a/unique_test.go b/unique_test.go index df97901..13ebfe7 100644 --- a/unique_test.go +++ b/unique_test.go @@ -11,6 +11,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:build !race // +build !race package nuid