JeffYang52415's picture
chore: test cd in PR
d47a391 unverified
name: CI
on:
pull_request:
branches: [main]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12"]
fail-fast: false
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
- name: Install Poetry
run: |
pipx install poetry
- name: Configure Poetry
run: |
poetry config virtualenvs.create true
poetry config virtualenvs.in-project true
- name: Cache Poetry virtualenv
uses: actions/cache@v3
with:
path: ./.venv
key: venv-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}
- name: Install dependencies
run: |
poetry install
- name: Run pre-commit hooks
uses: pre-commit/[email protected]
with:
extra_args: --all-files
env:
PRE_COMMIT_CACHE_KEY: ${{ hashFiles('.pre-commit-config.yaml', 'pyproject.toml') }}
- name: Run tests with coverage
run: |
poetry run pytest --cov=llmdataparser --cov-report=xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
fail_ci_if_error: true
- name: Build documentation
run: |
poetry add mkdocs mkdocs-material --group dev
cp README.md docs/index.md
poetry run mkdocs build
if: matrix.python-version == '3.12'
- name: Upload documentation artifact
uses: actions/upload-artifact@v3
with:
name: documentation
path: site/
if: matrix.python-version == '3.12'