Handle zero weights in cluster and non-cluster mappings, add new tests #238
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: jwt testing | |
| on: [push, pull_request] | |
| jobs: | |
| test: | |
| name: ${{ matrix.config.kind }} ${{ matrix.config.os }} | |
| strategy: | |
| matrix: | |
| include: | |
| - go: stable | |
| os: ubuntu-latest | |
| canonical: true | |
| - go: stable | |
| os: windows-latest | |
| canonical: false | |
| env: | |
| GO111MODULE: "on" | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 1 | |
| - name: Setup Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: ${{matrix.go}} | |
| - name: Install deps | |
| shell: bash --noprofile --norc -x -eo pipefail {0} | |
| run: | | |
| go install honnef.co/go/tools/cmd/staticcheck@latest | |
| go install github.com/client9/misspell/cmd/misspell@latest | |
| go install github.com/wadey/gocovmerge@latest | |
| - name: Lint | |
| shell: bash --noprofile --norc -x -eo pipefail {0} | |
| run: | | |
| cd v2 | |
| GO_LIST=$(go list ./...) | |
| go build | |
| $(exit $(go fmt $GO_LIST | wc -l)) | |
| go vet $GO_LIST | |
| which misspell | |
| find . -type f -name "*.go" | xargs misspell -error -locale US | |
| staticcheck $GO_LIST | |
| if: matrix.canonical | |
| - name: Tests | |
| shell: bash --noprofile --norc -x -eo pipefail {0} | |
| run: | | |
| set -e | |
| mkdir -p cov | |
| cd v2 | |
| go get -t ./... | |
| go test -v -race -covermode=atomic -coverprofile=../cov/v2.out -coverpkg=github.com/nats-io/jwt/v2 . | |
| cd v1compat | |
| go test -v -race -covermode=atomic -coverprofile=../../cov/v1.out -coverpkg=github.com/nats-io/jwt/v2/v1compat . | |
| cd ../.. | |
| gocovmerge ./cov/*.out > ./coverage.out | |
| set +e | |
| if: matrix.canonical | |
| - name: Tests (Windows) | |
| shell: bash --noprofile --norc -x -eo pipefail {0} | |
| run: | | |
| set -e | |
| cd v2 | |
| go get -t ./... | |
| go test -v -race . | |
| set +e | |
| if: runner.os == 'Windows' | |
| - name: Coverage | |
| uses: shogo82148/actions-goveralls@v1 | |
| with: | |
| # this needs to be where it can find a go.mod | |
| working-directory: ./v2 | |
| # this path-to-profile is relative to the working-directory | |
| path-to-profile: ../coverage.out | |
| if: matrix.canonical |