name: Tests

on:
  push:
    branches: [ main ]
  pull_request:
    branches: [ main ]

jobs:
  build:
    runs-on: ubuntu-latest
    strategy:
      # You can use PyPy versions in python-version.
      # For example, pypy2 and pypy3
      matrix:
        python-version: [
          '3.9',
          '3.10',
          '3.11',
          '3.12',
          '3.13',
        ]
        certbot-version: [
          '2.11.1',
          '3.3.0',
          '4.2.0',
        ]

    steps:
    - uses: actions/checkout@v2
    - uses: actions/setup-python@v1
      with:
        python-version: ${{ matrix.python-version }}

    - name: Install Requirements
      run: |
        pip3 install -r requirements.txt
        pip3 install certbot~=$CERTBOT_VERSION .
        pip3 freeze
      env:
        CERTBOT_VERSION: ${{ matrix.certbot-version }}

    - name: flake8 Linter
      run:  python3 -m flake8 certbot_dns_desec

    - name: Unit tests
      run: python3 -m unittest certbot_dns_desec/dns_desec_test.py
