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 ea2355b
Show file tree
Hide file tree
Showing 6 changed files with 99 additions and 36 deletions.
21 changes: 19 additions & 2 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,42 @@ 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:
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]'
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
11 changes: 10 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 @@ -70,18 +75,22 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

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

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install '.[dev]'
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
Expand Down
55 changes: 35 additions & 20 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 All @@ -16,7 +21,11 @@ jobs:
with:
# requites to grab the history of the PR
fetch-depth: 0

- uses: actions/setup-python@v4
with:
cache: 'pip'

- uses: pre-commit/[email protected]
with:
extra_args: --color=always --from-ref ${{ github.event.pull_request.base.sha }} --to-ref ${{ github.event.pull_request.head.sha }}
Expand Down Expand Up @@ -46,9 +55,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 @@ -60,32 +69,34 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'

- name: Install dependencies
run: |
uv venv
pip install poetry
source .venv/bin/activate
uv pip install -e '.[dev,setup]' pytest-xdist pip
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
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
if: matrix.python-version == '3.9'

- name: Upload coverage data
Expand Down Expand Up @@ -116,24 +127,26 @@ jobs:
- uses: actions/setup-python@v4
with:
python-version: "3.9"
# cache: 'pip'
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 }}
# - 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]'
pip install '.[docs]'
# uv venv
# uv pip install '.[docs]'


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

simple-installation:
name: Simple installation
Expand All @@ -148,15 +161,17 @@ jobs:
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'

- 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 ea2355b

Please sign in to comment.