name: Test Linux

on:
  push:
    branches:
      - '**'

  pull_request:

  schedule:
    - cron: '17 5 * * *'

jobs:
  test-linux:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/setup-node@v2
        with:
          node-version: 16

      - uses: actions/setup-go@v4
        with:
          go-version: 1.20.1

      - uses: actions/checkout@v3

      - run: go generate

      - run: go run ./lib/utils/ci-test -race -coverprofile=coverage.out ./...

      - run: go run github.com/ysmood/got/cmd/check-cov@latest

      - uses: actions/upload-artifact@v2
        if: ${{ always() }}
        with:
          name: cdp-log-linux
          path: |
            tmp/cdp-log
            coverage.out
