Skip to content

Commit

Permalink
Migrate documentation to PDM (#4266)
Browse files Browse the repository at this point in the history
  • Loading branch information
dhruvkb authored May 6, 2024
1 parent 1736a13 commit 7912d0f
Show file tree
Hide file tree
Showing 12 changed files with 810 additions and 609 deletions.
2 changes: 1 addition & 1 deletion .github/actions/setup-env/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ runs:
shell: bash
run: |
pip install -U pip
pip install pipenv
pip install pipenv pdm
# Node.js
- name: Setup pnpm
Expand Down
2 changes: 2 additions & 0 deletions .github/filters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ frontend:
- tsconfig.base.json
- .npmrc
- .pnpmfile.cjs
py_packages:
- packages/python/**
js_packages:
- packages/js/**
- package.json
Expand Down
51 changes: 51 additions & 0 deletions .github/workflows/ci_cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ jobs:
frontend: ${{ contains(fromJson(steps.paths-filter.outputs.changes), 'frontend') }}
documentation: ${{ contains(fromJson(steps.paths-filter.outputs.changes), 'documentation') }}
ci_cd: ${{ contains(fromJson(steps.paths-filter.outputs.changes), 'ci_cd') }}
py_packages: ${{ contains(fromJson(steps.paths-filter.outputs.changes), 'py_packages') }}
js_packages: ${{ contains(fromJson(steps.paths-filter.outputs.changes), 'js_packages') }}
steps:
- name: Checkout repository
Expand Down Expand Up @@ -519,6 +520,56 @@ jobs:
- name: Pass
run: echo 'Django checks are skipped because API is unchanged.'

py-package-checks:
name: Run checks for Python packages/*
if: |
needs.get-changes.outputs.py_packages == 'true'
runs-on: ubuntu-latest
needs:
- get-changes
- lint
strategy:
fail-fast: false
matrix:
packages:
- packages/python/openverse-attribution
script:
- build
- test

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup CI env
uses: ./.github/actions/setup-env
with:
install_recipe: packages/python/openverse-attribution/install

- name: Run Python packages checks
run: pdm run -p ${{ matrix.packages }} ${{ matrix.script }}

# This job runs when `py-package-checks` doesn't and always passes, thus
# allowing PRs to meet the required checks criteria and be merged.
bypass-py-package-checks:
name: Run checks for Python packages/*
if: |
!cancelled() &&
needs.py-package-checks.result == 'skipped'
runs-on: ubuntu-latest
needs:
- py-package-checks
strategy:
fail-fast: false
matrix:
name:
- build
- unit_test

steps:
- name: Pass
run: echo 'Checks for Python packages are skipped because they are unchanged.'

############
# Frontend #
############
Expand Down
2 changes: 1 addition & 1 deletion api/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description = "API for the Openverse project"
readme = "README.md"
license = {text = "MIT"}
authors = [
{name = "Openverse", email = "openverse@wordpress.org" },
{name = "Openverse Contributors", email = "openverse@wordpress.org"},
]

requires-python = "==3.11.*"
Expand Down
17 changes: 0 additions & 17 deletions documentation/Pipfile

This file was deleted.

585 changes: 0 additions & 585 deletions documentation/Pipfile.lock

This file was deleted.

10 changes: 5 additions & 5 deletions documentation/justfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ NO_COLOR := "\\033[0m"


# Install dependencies
install:
pipenv install --dev
install *args:
pdm install {{ args }}

##########
# Sphinx #
Expand Down Expand Up @@ -69,15 +69,15 @@ create-ip project_dirname ip_name:
# Serve a live-reload documentation site
live port="50230": clean
pipenv run sphinx-autobuild -b html . _serve/ --port {{ port }}
pdm run sphinx-autobuild -b html . _serve/ --port {{ port }}

# Compile the documentation into a static site
build *args: clean
pipenv run sphinx-build {{ args }} -b html . _build/
pdm run sphinx-build {{ args }} -b html . _build/

# Serve the compiled docs using a simple HTTP server
serve port="50231":
pipenv run python -m http.server -d _build/ {{ port }}
pdm run python -m http.server -d _build/ {{ port }}

# Delete the live server and build output directories
clean:
Expand Down
Loading

0 comments on commit 7912d0f

Please sign in to comment.