| name: CI | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| push: | |
| branches: | |
| - main | |
| - ci-* | |
| env: | |
| HF_ALLOW_CODE_EVAL: 1 | |
| jobs: | |
| check_code_quality: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: "3.8" | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install .[quality] | |
| - name: Check quality | |
| run: | | |
| ruff check tests src benchmarks metrics utils setup.py # linter | |
| ruff format --check tests src benchmarks metrics utils setup.py # formatter | |
| test: | |
| needs: check_code_quality | |
| strategy: | |
| matrix: | |
| test: ['unit', 'integration'] | |
| os: [ubuntu-latest, windows-latest] | |
| deps_versions: [deps-latest, deps-minimum] | |
| continue-on-error: ${{ matrix.test == 'integration' }} | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Python 3.8 | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: "3.8" | |
| - name: Upgrade pip | |
| run: python -m pip install --upgrade pip | |
| - name: Pin setuptools-scm | |
| if: ${{ matrix.os == 'ubuntu-latest' }} | |
| run: echo "installing pinned version of setuptools-scm to fix seqeval installation on 3.7" && pip install "setuptools-scm==6.4.2" | |
| - name: Install dependencies | |
| run: | | |
| pip install .[tests,metrics-tests] | |
| pip install -r additional-tests-requirements.txt --no-deps | |
| python -m spacy download en_core_web_sm | |
| python -m spacy download fr_core_news_sm | |
| - name: Install dependencies (latest versions) | |
| if: ${{ matrix.deps_versions == 'deps-latest' }} | |
| run: pip install --upgrade pyarrow huggingface-hub dill | |
| - name: Install dependencies (minimum versions) | |
| if: ${{ matrix.deps_versions != 'deps-latest' }} | |
| run: pip install pyarrow==8.0.0 huggingface-hub==0.19.4 transformers dill==0.3.1.1 | |
| - name: Test with pytest | |
| run: | | |
| python -m pytest -rfExX -m ${{ matrix.test }} -n 2 --dist loadfile -sv ./tests/ | |
| test_py310: | |
| needs: check_code_quality | |
| strategy: | |
| matrix: | |
| test: ['unit'] | |
| os: [ubuntu-latest, windows-latest] | |
| deps_versions: [deps-latest] | |
| continue-on-error: false | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Python 3.10 | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: "3.10" | |
| - name: Upgrade pip | |
| run: python -m pip install --upgrade pip | |
| - name: Install dependencies | |
| run: pip install .[tests] | |
| - name: Test with pytest | |
| run: | | |
| python -m pytest -rfExX -m ${{ matrix.test }} -n 2 --dist loadfile -sv ./tests/ | |