diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml new file mode 100644 index 00000000..73389bc2 --- /dev/null +++ b/.github/workflows/testing.yml @@ -0,0 +1,50 @@ +name: Tests + +on: + push: + branches: + - master + pull_request: + +jobs: + test: + name: Test and lint + strategy: + matrix: + go-version: [ + 1.9.x, + 1.10.x, + 1.11.x, + 1.12.x, + 1.13.x, + 1.14.x + ] + platform: [ubuntu-latest, windows-latest] + runs-on: ${{ matrix.platform }} + + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-go@v2 + with: + go-version: 1.14 + + # Caching go modules to speed up the run + - uses: actions/cache@v1 + with: + path: ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- + + - name: Run go fmt + if: runner.os != 'Windows' + run: diff -u <(echo -n) <(gofmt -d -s .) + + - name: Run go vet + run: make vet + + - name: Run staticcheck + run: make staticcheck + + - name: Run Unit tests. + run: make test \ No newline at end of file