name: Continuous Integration
on:
  push:
    branches-ignore:
      - main
    paths-ignore:
      - '.github/**'
      - '.gitgnore'
  pull_request:
    branches:
      - main

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

permissions:
  contents: read

env:
  GOTELEMETRY: off
  #CGO_ENABLED: 0

jobs:
  test:
    name: test
    strategy:
      matrix:
        os: [ubuntu-latest, macos-latest]
    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v6
      - uses: actions/setup-go@v6
        with:
          go-version: 'stable'
          #go-version-file: 'go.mod'
          check-latest: true
      - name: Run tests
        run: make test #go test -race ./...
  lint:
    permissions:
      contents: read  # for actions/checkout to fetch code
      pull-requests: read  # for golangci/golangci-lint-action to fetch pull requests
    name: lint
    strategy:
      matrix:
        os: [macos-latest, ubuntu-latest]
    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v6
      - uses: actions/setup-go@v6
        with:
          go-version: 'stable'
          #go-version-file: 'go.mod'
          check-latest: true
      - name: Lint
        run: make vet
      #- name: golangci-lint
      #  uses: golangci/golangci-lint-action@v8
      #  with:
      #    version: v2.1
