| name: Run tests |
| on: |
| push: |
| branches: [main] |
| pull_request: |
| branches: [main] |
| env: |
| GO111MODULE: on |
| jobs: |
| test: |
| strategy: |
| matrix: |
| go-version: [1.15.x, 1.18.x] |
| os: [ubuntu-latest] |
| runs-on: ${{ matrix.os }} |
| steps: |
| |
| - name: Install Go |
| uses: actions/setup-go@v2 |
| with: |
| go-version: ${{ matrix.go-version }} |
| |
| - name: Checkout code |
| uses: actions/checkout@v2 |
| |
| - name: Vet and build |
| run: | |
| go vet ./... |
| go build ./... |
| |
| - name: Install mockgen |
| run: | |
| go install github.com/golang/mock/mockgen |
| |
| - name: Run test script |
| run: | |
| ./ci/test.sh |
| ./ci/check_panic_handling.sh |
| |
| - name: Run Go tests all |
| if: ${{ startsWith(matrix.go-version, '1.18') }} |
| run: | |
| for i in $(find $PWD -name go.mod); do |
| pushd $(dirname $i) |
| go test ./... |
| popd |
| done |
| |
| - name: Run Go tests some |
| if: ${{ startsWith(matrix.go-version, '1.18') == false }} |
| run: | |
| go test ./... |