name: Test Linux

on:
  push:
    branches:
      - '**'

  pull_request:

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

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

    steps:
      - uses: actions/setup-go@v5
        with:
          go-version: 1.22

      - uses: actions/checkout@v4

      - run: go generate

      - run: go run ./lib/utils/ci-test -race -coverprofile=coverage.out -run=^Test . ./lib/utils ./lib/proto ./lib/cdp ./lib/defaults ./lib/devices ./lib/launcher ./lib/input

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

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