stages:
  - test
  - build

pages:
  stage: build
  image: zoo.smok.co/build/build:pages
  before_script:
    - pip3 install --break-system-packages --upgrade Cython setuptools pip
    - pip3 install --break-system-packages -r requirements.txt
    - python3 setup.py build_ext --inplace
  script:
    - cd docs
    - make html
    - mv _build/html ../public
  artifacts:
    paths:
      - "public"
  only:
    - master
  needs: []

.test_python:
  stage: test
  before_script:
    - pip install --upgrade Cython setuptools pip coverage nose2
    - pip install -r requirements.txt
    - python setup.py build_ext --inplace
  variables:
    TESTING: "1"
  script:
    - python -m coverage run -m nose2 -vv -F
    - python -m coverage report
  coverage: /TOTAL.*\s+(\d+\%)/


test_python38:
  extends: .test_python
  image: python:3.8



test_python39:
  extends: .test_python
  image: python:3.9


test_python310:
  extends: .test_python
  image: python:3.10



test_python311:
  extends: .test_python
  image: python:3.11


.build_python:
  only:
    - master
  stage: build
  script:
    - pip install --break-system-packages --upgrade Cython setuptools pip
    - pip install --break-system-packages -r requirements.txt
    - python setup.py bdist_wheel
    - cp dist/*.whl .
  artifacts:
    paths:
      - "*.whl"


build_python38:
  extends: .build_python
  image: python:3.8

build_python39:
  extends: .build_python
  image: python:3.9


build_python310:
  extends: .build_python
  image: python:3.10


build_python311:
  extends: .build_python
  image: python:3.11


build_python311_armv7l:
  extends: .build_python
  image: zoo.smok.co/build/build:armv7l-python3.11