Migrate to new datamodel #434
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: tests-GH | |
on: | |
push: | |
branches: [main, develop] | |
pull_request: | |
branches: [main, develop] | |
jobs: | |
pytest: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
python: [3.8] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python }} | |
architecture: x64 | |
- name: Cache python modules | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-python-${{ matrix.python }}-${{ hashFiles('pyproject.toml') }}-test | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -e ".[test]" --upgrade | |
- name: Run unittests | |
env: | |
API_URL: ${{ secrets.API_URL }} | |
API_LOGIN: ${{ secrets.API_LOGIN }} | |
API_PWD: ${{ secrets.API_PWD }} | |
run: | | |
coverage run -m pytest tests/ | |
coverage xml | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: coverage-main | |
path: ./coverage.xml | |
codecov-upload: | |
runs-on: ubuntu-latest | |
needs: pytest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: coverage-main | |
path: ./coverage.xml | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} # Use the Codecov token from secrets | |
flags: unittests | |
fail_ci_if_error: true | |
docs: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
python: [3.8] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python }} | |
architecture: x64 | |
- name: Cache python modules | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-python-${{ matrix.python }}-${{ hashFiles('pyproject.toml') }}-docs | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -e ".[docs]" --upgrade | |
- name: Build documentation | |
run: sphinx-build docs/source docs/build -a | |
- name: Documentation sanity check | |
run: test -e docs/build/index.html || exit | |
headers: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- name: Check the headers | |
uses: frgfm/validate-python-headers@main | |
with: | |
license: 'Apache-2.0' | |
owner: 'Pyronear' | |
starting-year: 2020 | |
folders: 'pyroengine,docs,scripts,.github,src' | |
ignores: 'version.py,__init__.py' |