name: ci-ristretto-tests
on:
  push:
    branches:
      - main
  pull_request:
    branches:
      - main
  schedule:
    - cron: "31 * * * *"
jobs:
  ristretto-tests:
    runs-on: ubuntu-20.04
    steps:
      - uses: actions/checkout@v3
      - name: Get Go Version
        run: |
          #!/bin/bash
          GOVERSION=$({ [ -f .go-version ] && cat .go-version; })
          echo "GOVERSION=$GOVERSION" >> $GITHUB_ENV
      - name: Setup Go
        uses: actions/setup-go@v3
        with:
          go-version: ${{ env.GOVERSION }}
      - name: Run Unit Tests
        run: go test -timeout=20m -race -covermode atomic -coverprofile=covprofile ./...
      - name: Save coverage profile
        uses: actions/upload-artifact@v3
        with:
          name: covprofile
          path: ./covprofile
