Skip to content

Commit

Permalink
ci: fix docs
Browse files Browse the repository at this point in the history
  • Loading branch information
percevalw committed Oct 7, 2024
1 parent e002838 commit 7601e68
Show file tree
Hide file tree
Showing 6 changed files with 97 additions and 36 deletions.
25 changes: 22 additions & 3 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,44 @@ on:

env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
# UV_INDEX_STRATEGY: "unsafe-first-match"
# UV_EXTRA_INDEX_URL: "https://download.pytorch.org/whl/cpu"
PIP_EXTRA_INDEX_URL: "https://download.pytorch.org/whl/cpu"

jobs:
Documentation:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- uses: actions/setup-python@v4
with:
cache: 'pip'
python-version: "3.9"
# cache: 'pip'

- run: echo WEEK=$(date +%V) >>$GITHUB_ENV
shell: bash

# - uses: hynek/setup-cached-uv@v1
# with:
# cache-suffix: -docs-${{ matrix.python-version }}-${{ env.WEEK }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install '.[dev]'
# This is fragile, but not critical. Move to uv and index-strategy asap when we drop py37
pip install pytorch --extra-index-url $PIP_EXTRA_INDEX_URL
pip install '.[docs]'
# uv venv
# uv pip install '.[docs]'

- name: Set up Git
run: |
git config user.name ${{ github.actor }}
git config user.email ${{ github.actor }}@users.noreply.github.com
- name: Build documentation
run: |
git fetch origin gh-pages
source .venv/bin/activate
mike delete $BRANCH_NAME
mike deploy --push $BRANCH_NAME
9 changes: 8 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ on:
release:
types: [published]

env:
# UV_INDEX_STRATEGY: "unsafe-first-match"
# UV_EXTRA_INDEX_URL: "https://download.pytorch.org/whl/cpu"
PIP_EXTRA_INDEX_URL: "https://download.pytorch.org/whl/cpu"

jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}/${{ matrix.arch || '*' }}
Expand Down Expand Up @@ -77,7 +82,9 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install '.[dev]'
# This is fragile, but not critical. Move to uv and index-strategy asap when we drop py37
pip install pytorch --extra-index-url $PIP_EXTRA_INDEX_URL
pip install '.[docs]'
- name: Set up Git
run: |
git config user.name ${{ github.actor }}
Expand Down
51 changes: 32 additions & 19 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ on:
push:
branches: [master]

env:
# UV_INDEX_STRATEGY: "unsafe-first-match"
# UV_EXTRA_INDEX_URL: "https://download.pytorch.org/whl/cpu"
PIP_EXTRA_INDEX_URL: "https://download.pytorch.org/whl/cpu"

jobs:
linting:
name: Linting
Expand Down Expand Up @@ -46,9 +51,9 @@ jobs:
- run: echo WEEK=$(date +%V) >>$GITHUB_ENV
shell: bash

- uses: hynek/setup-cached-uv@v1
with:
cache-suffix: -tests-${{ matrix.python-version }}-${{ env.WEEK }}
# - uses: hynek/setup-cached-uv@v1
# with:
# cache-suffix: -tests-${{ matrix.python-version }}-${{ env.WEEK }}

- name: Set up Java
uses: actions/setup-java@v2
Expand All @@ -63,29 +68,32 @@ jobs:

- name: Install dependencies
run: |
uv venv
pip install poetry
source .venv/bin/activate
uv pip install -e '.[dev,setup]' pytest-xdist pip
# This is fragile, but not critical. Move to uv and index-strategy asap when we drop py37
pip install pytorch --extra-index-url $PIP_EXTRA_INDEX_URL
pip install -e '.[dev,setup]' pytest-xdist pip
# uv venv
# source .venv/bin/activate
# uv pip install -e '.[dev,setup]' pytest-xdist pip

- name: Test with Pytest on Python ${{ matrix.python-version }}
env:
UMLS_API_KEY: ${{ secrets.UMLS_API_KEY }}
run: |
source .venv/bin/activate
coverage run -m pytest --ignore tests/test_docs.py # -n auto
# coverage combine
# mv .coverage .coverage.${{ matrix.python-version }}
# source .venv/bin/activate # put above
if: matrix.python-version != '3.9'

- name: Test with Pytest on Python ${{ matrix.python-version }}
env:
UMLS_API_KEY: ${{ secrets.UMLS_API_KEY }}
run: |
source .venv/bin/activate
coverage run -m pytest # -n auto
# coverage combine
# mv .coverage .coverage.${{ matrix.python-version }}
# source .venv/bin/activate # put above
if: matrix.python-version == '3.9'

- name: Upload coverage data
Expand Down Expand Up @@ -121,19 +129,23 @@ jobs:
- run: echo WEEK=$(date +%V) >>$GITHUB_ENV
shell: bash

- uses: hynek/setup-cached-uv@v1
with:
cache-suffix: -docs-${{ matrix.python-version }}-${{ env.WEEK }}
# - uses: hynek/setup-cached-uv@v1
# with:
# cache-suffix: -docs-${{ matrix.python-version }}-${{ env.WEEK }}

- name: Install dependencies
run: |
uv venv
uv pip install '.[dev]'
# This is fragile, but not critical. Move to uv and index-strategy asap when we drop py37
pip install pytorch --extra-index-url $PIP_EXTRA_INDEX_URL
pip install '.[docs]'
# uv venv
# uv pip install '.[docs]'


- name: Build documentation
run: |
source .venv/bin/activate
mkdocs build --clean
# source .venv/bin/activate # put above

simple-installation:
name: Simple installation
Expand All @@ -152,11 +164,12 @@ jobs:
- run: echo WEEK=$(date +%V) >>$GITHUB_ENV
shell: bash

- uses: hynek/setup-cached-uv@v1
with:
cache-suffix: -simple-install-${{ matrix.python-version }}-${{ env.WEEK }}
# - uses: hynek/setup-cached-uv@v1
# with:
# cache-suffix: -simple-install-${{ matrix.python-version }}-${{ env.WEEK }}

- name: Install library
run: |
uv venv
uv pip install .
pip install .
# uv venv
# uv pip install .
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ install : .venv

documentation: .venv
. .venv/bin/activate
pip install -e '.[dev]'
pip install -e '.[docs]'
mkdocs serve

test: .venv
Expand Down
2 changes: 1 addition & 1 deletion contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ We use `MkDocs` for EDS-NLP's documentation. You can checkout the changes you ma

```console
# Install the requirements
$ pip install -e '.[dev]'
$ pip install -e '.[docs]'
---> 100%
color:green Installation successful

Expand Down
44 changes: 33 additions & 11 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ dependencies = [
"pytz",
"pysimstring>=1.2.1",
"regex",
"spacy>=3.1,<4.0.0,!=3.8.0",
"spacy>=3.1,<3.8",
"confit>=0.5.5",
"tqdm",
"umls-downloader>=0.1.1",
Expand Down Expand Up @@ -41,13 +41,39 @@ dev = [
"pre-commit>=2.21.0; python_version>='3.8'",
"pytest>=7.1.0",
"pytest-cov>=3.0.0",
"polars",

# Distributed inference
# Data libs
"koalas>=1.8.1; python_version<'3.8'",
"pyspark",
"polars",

# Machine Learning
"rich-logger>=0.3.1",
"torch>=1.13.0",
"foldedtensor>=0.3.2",
"safetensors>=0.3.0",
"transformers>=4.0.0,<5.0.0",
"accelerate>=0.20.3,<1.0.0",
"mlconjug3<3.9.0",
"scikit-learn>=1.0.0",

# Docs
# Docs (same as docs group)
"mike~=1.1.2",
"mkdocs-charts-plugin==0.0.8",
"mkdocs-img2fig-plugin==0.9.3",
"mkdocs-material~=9.2.0",
"mkdocs-section-index==0.3.4",
"mkdocs~=1.5.2",
"mkdocstrings~=0.20",
"mkdocstrings-python~=1.1",
"mkdocs-minify-plugin",
"mkdocs-redirects>=1.2.1;python_version>='3.8'",
"pybtex~=0.24.0",
"pathspec>=0.11.1", # required by vendored mkdocs-autorefs PR
"astunparse",
"griffe<0.39",
]
docs = [
"mike~=1.1.2",
"mkdocs-charts-plugin==0.0.8",
"mkdocs-img2fig-plugin==0.9.3",
Expand All @@ -61,17 +87,13 @@ dev = [
"pybtex~=0.24.0",
"pathspec>=0.11.1", # required by vendored mkdocs-autorefs PR
"astunparse",
"mlconjug3<3.9.0",
"griffe<0.39",

# Machine Learning
"rich-logger>=0.3.1",
"torch>=1.13.0",
"foldedtensor>=0.3.2",
"safetensors>=0.3.0",
"transformers>=4.0.0,<5.0.0",
"accelerate>=0.20.3,<1.0.0",
"scikit-learn>=1.0.0",
"safetensors>=0.3.0",
"rich-logger>=0.3.1",
]
setup = [
"typer"
Expand Down Expand Up @@ -274,7 +296,7 @@ where = ["."]
requires = [
"setuptools",
"cython>=0.25",
"spacy>=3.2,<4.0,!=3.8.0",
"spacy>=3.2,<3.8",
# to update from https://github.com/scipy/oldest-supported-numpy/blob/main/setup.cfg
# while setting numpy >= 1.15.0 due to spacy reqs
"numpy==1.15.0; python_version=='3.7' and platform_machine not in 'arm64|aarch64|loongarch64' and platform_system!='AIX' and platform_python_implementation != 'PyPy'",
Expand Down

0 comments on commit 7601e68

Please sign in to comment.