git » kxd » main » tree

[main] / .github / workflows / tests.yaml

name: "tests"

on:
  push:
    branches: [ "main", "next" ]
  pull_request:
    # The branches below must be a subset of the branches above
    branches: [ "main", "next" ]
  schedule:
    - cron: '26 21 * * 6'
  workflow_dispatch:

permissions:
  contents: read

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

jobs:
  tests:
    runs-on: ubuntu-latest
    timeout-minutes: 5
    strategy:
      matrix:
        # Test against stable, and the oldest supported version.
        go: [ 'stable', '1.26.x' ]
    steps:
      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
        with:
          persist-credentials: false
      - uses: actions/setup-go@d8cbb8045d7f43706b9177cceb36c1f91a6644d5 # v7.1.0
        with:
          go-version: ${{ matrix.go }}
          check-latest: true
          # No external dependencies (and no go.sum), nothing to cache.
          cache: false
      - name: test
        run: make test

  coverage:
    needs: tests
    runs-on: ubuntu-latest
    timeout-minutes: 5
    steps:
      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
        with:
          persist-credentials: false
      - uses: actions/setup-go@d8cbb8045d7f43706b9177cceb36c1f91a6644d5 # v7.1.0
        with:
          go-version: 'stable'
          check-latest: true
          cache: false
      - name: coverage tests
        run: ./tests/cover.sh
      - name: upload
        uses: codecov/codecov-action@303a32d7a59b442fa8d48b6a1cc6825c09c847a5 # v7.1.1
        with:
          token: ${{ secrets.CODECOV_TOKEN }}
          files: .cover-merged.out