name: Build

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

jobs:

  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2

      - name: Set up Go
        uses: actions/setup-go@v2
        with:
          go-version: 1.17

      - name: Run golangci-lint
        uses: golangci/golangci-lint-action@v2.5.2
        with:
          # version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
          version: latest
          # the token is used for fetching patch of a pull request to show only new issues
          github-token: ${{ github.token }}

      - name: Build
        run: go build -v ./...

      - name: Setup Redis
        uses: zhulik/redis-action@1.1.0

      - name: Test
        run: go test -v ./...
