git » dnss » 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: '41 22 * * 6'

jobs:
  gotests:
    runs-on: ubuntu-latest
    timeout-minutes: 5
    strategy:
      matrix:
        # Oldest supported version, and latest.
        go-version: [ '1.21.x', '1.x' ]
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-go@v5
        with:
          go-version: ${{ matrix.go-version }}
          check-latest: true
          cache: true

      - run: go test ./...
      - run: go test -race ./...

  integration:
    needs: gotests
    runs-on: ubuntu-latest
    timeout-minutes: 5
    steps:
      - uses: actions/checkout@v4
      - name: Build test image
        run: |
          docker info
          docker build -t dnss-test -f tests/Dockerfile .
      - name: Run tests
        run: docker run --name test1 dnss-test
      - name: Extract coverage results
        run: >
          docker cp test1:/go/src/blitiri.com.ar/go/dnss/.coverage/merged.out
          .
      - name: Upload coverage results
        uses: codecov/codecov-action@v4
        with:
          token: ${{ secrets.CODECOV_TOKEN }}
          file: merged.out