name: test

on:
  push:
    branches: [ "main" ]
    paths-ignore: [ '*.md', '*.asciidoc' ]
  pull_request:
    branches: [ "main" ]
    paths-ignore: [ '*.md', '*.asciidoc' ]

permissions:
  contents: read


## Concurrency is only allowed in the main branch.
## So old builds, running for old commits within the same Pull Request, are cancelled
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

jobs:

  pre-commit:
    name: Run pre-commit
    runs-on: ubuntu-latest
    steps:
    - uses: elastic/oblt-actions/pre-commit@v1

  lint:
    runs-on: ubuntu-latest
    timeout-minutes: 5
    steps:
    - uses: actions/checkout@v6
    - uses: actions/setup-python@v6
      with:
        python-version: '3.10'
    - run: .ci/scripts/lint.sh

  test:
    runs-on: ubuntu-latest
    timeout-minutes: 10
    strategy:
      matrix:
        python: [ '3.8', '3.9', '3.10', '3.11', '3.12', '3.13', '3.14' ]
      fail-fast: false
    steps:
    - uses: actions/checkout@v6
    - uses: actions/setup-python@v6
      with:
        python-version: ${{ matrix.python }}
    - run: .ci/scripts/test.sh ${{ matrix.python }}
