From 915f62d8263c0b799fbc117a901e6c2db968ed5b Mon Sep 17 00:00:00 2001 From: Abdou Seck Date: Wed, 15 Nov 2023 15:25:21 -0500 Subject: [PATCH] CICD: Clean up workflows and add workflow to build and release docs --- .github/workflows/dockerize.yaml | 2 +- .github/workflows/docs.yaml | 28 ++++++++++++++++++++++++++++ .github/workflows/release.yaml | 2 +- .github/workflows/run_tests.yaml | 4 ++-- docs/source/api_intro.rst | 2 +- docs/source/conf.py | 20 +++++++++----------- 6 files changed, 42 insertions(+), 16 deletions(-) create mode 100644 .github/workflows/docs.yaml diff --git a/.github/workflows/dockerize.yaml b/.github/workflows/dockerize.yaml index 23f3f7a..5139135 100644 --- a/.github/workflows/dockerize.yaml +++ b/.github/workflows/dockerize.yaml @@ -35,7 +35,7 @@ jobs: tags: mitir/simeon:${{ env.SOURCE_TAG }} - name: Publish Latest Tag - id: docker_build_laest + id: docker_build_latest uses: docker/build-push-action@v2 with: push: true diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml new file mode 100644 index 0000000..98f0b5d --- /dev/null +++ b/.github/workflows/docs.yaml @@ -0,0 +1,28 @@ +name: documentation + +on: [push, pull_request, workflow_dispatch] + +permissions: + contents: write + +jobs: + docs: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v3 + - name: Install dependencies + run: | + pip install -r requirements_dev.txt + - name: Sphinx build + working-directory: ${{ github.workspace }}/docs + run: | + make html + - name: Deploy to GitHub Pages + uses: peaceiris/actions-gh-pages@v3 + if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} + with: + publish_branch: gh-pages + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: docs/build/ + force_orphan: true \ No newline at end of file diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index ce08d3e..2827939 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -26,7 +26,7 @@ jobs: - name: Build package run: python -m build - name: Publish package - uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 + uses: pypa/gh-action-pypi-publish@release/v1 with: user: __token__ password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/.github/workflows/run_tests.yaml b/.github/workflows/run_tests.yaml index 1fc20bf..a7f3013 100644 --- a/.github/workflows/run_tests.yaml +++ b/.github/workflows/run_tests.yaml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [3.7, 3.8, 3.9] + python-version: [3.9, 3.10, 3.11] steps: - uses: actions/checkout@v3 @@ -24,6 +24,6 @@ jobs: python -m pip install --upgrade pip pip install wheel pip install .[geoip,test] - - name: Test with pytest + - name: Test with tox run: | tox diff --git a/docs/source/api_intro.rst b/docs/source/api_intro.rst index 1fead84..553c71d 100644 --- a/docs/source/api_intro.rst +++ b/docs/source/api_intro.rst @@ -4,7 +4,7 @@ The python API of this tool is divided into the following sections: - upload: Handles the uploading of data to GCS and BigQuery. It matches up with the ``simeon push`` command -- report: Handles the generation of seconary tables in BigQuery. It matches up with the ``simeon report`` command +- report: Handles the generation of secondary tables in BigQuery. It matches up with the ``simeon report`` command Components of the :class:`~simeon.download` package diff --git a/docs/source/conf.py b/docs/source/conf.py index a7d7256..b4b4076 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -12,19 +12,17 @@ # import os import sys + sys.path.insert( - 0, - os.path.dirname( - os.path.dirname(os.path.dirname(os.path.abspath(__file__))) - ) + 0, os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) ) # -- Project information ----------------------------------------------------- -project = 'simeon' -copyright = '2021, MIT Institutional Research' -author = 'MIT Institutional Research' +project = "simeon" +copyright = "2021, MIT Institutional Research" +author = "MIT Institutional Research" # -- General configuration --------------------------------------------------- @@ -33,11 +31,11 @@ # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. extensions = [ - 'sphinx.ext.autodoc', + "sphinx.ext.autodoc", ] # Add any paths that contain templates here, relative to this directory. -templates_path = ['_templates'] +templates_path = ["_templates"] # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. @@ -50,9 +48,9 @@ # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. # -html_theme = 'alabaster' +html_theme = "alabaster" # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ['_static'] \ No newline at end of file +html_static_path = ["_static"]