Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add documentation workflow #547

Merged
merged 6 commits into from
Sep 20, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
147 changes: 147 additions & 0 deletions .github/workflows/generate-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
name: Generate documentation
on:
push:
branches:
- main
- release*
tags:
- '[0-9]+.[0-9]+*'

env:
PACKAGE_NAME: numba-dppy
python: 3.8
artifact_name: -c dppy_label_dev
1e-to marked this conversation as resolved.
Show resolved Hide resolved
dependencies: dpnp=0.7.1=*_41
CHANNELS: -c dppy/label/dev -c defaults -c numba -c intel -c numba/label/dev -c conda-forge --override-channels
1e-to marked this conversation as resolved.
Show resolved Hide resolved

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Set pkgs_dirs
run: |
echo "pkgs_dirs: [~/.conda/pkgs]" >> ~/.condarc
- name: Cache conda packages
uses: actions/cache@v2
env:
CACHE_NUMBER: 0 # Increase to reset cache
with:
path: ~/.conda/pkgs
key:
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ env.python }}-${{hashFiles('**/meta.yaml') }}
restore-keys: |
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ env.python }}-
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-
- name: Add conda to system path
run: echo $CONDA/bin >> $GITHUB_PATH
- name: Install conda-build
run: conda install conda-build
- name: Build conda package
run: |
VERSIONS="--python ${{ env.python }}"
TEST="--no-test"
conda build \
$TEST \
$VERSIONS \
$CHANNELS \
conda-recipe
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ env.python }} ${{ env.artifact_name }}
path: /usr/share/miniconda/conda-bld/linux-64/${{ env.PACKAGE_NAME }}-*.tar.bz2
1e-to marked this conversation as resolved.
Show resolved Hide resolved

generate-docs:
needs: build
runs-on: ubuntu-latest

steps:
- name: Download artifact
uses: actions/download-artifact@v2
with:
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ env.python }} ${{ env.artifact_name }}
- name: Set pkgs_dirs
run: |
echo "pkgs_dirs: [~/.conda/pkgs]" >> ~/.condarc
- name: Cache conda packages
uses: actions/cache@v2
env:
CACHE_NUMBER: 0 # Increase to reset cache
with:
path: ~/.conda/pkgs
key:
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ env.python }}-${{hashFiles('**/meta.yaml') }}
restore-keys: |
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ env.python }}-
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-
- name: Add conda to system path
run: echo $CONDA/bin >> $GITHUB_PATH
- name: Install conda-build
run: conda install conda-build
- name: Create conda channel
run: |
mkdir -p $GITHUB_WORKSPACE/channel/linux-64
mv ${PACKAGE_NAME}-*.tar.bz2 $GITHUB_WORKSPACE/channel/linux-64
conda index $GITHUB_WORKSPACE/channel
# Test channel
conda search $PACKAGE_NAME -c $GITHUB_WORKSPACE/channel --override-channels
- name: Install numba-dppy
run: |
CHANNELS="-c $GITHUB_WORKSPACE/channel ${{ env.CHANNELS }}"
conda install $PACKAGE_NAME python=${{ env.python }} ${{ env.dependencies }} $CHANNELS
# Test installed packages
conda list
- name: Add library
run: echo "OCL_ICD_FILENAMES=libintelocl.so" >> $GITHUB_ENV
Comment on lines +62 to +63
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it necessary w/o tests?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it is the main problem why module doesn't import

- name: Check version
run: python -c "import numba_dppy; print(numba_dppy.__version__)"

- name: Install documentation tools
run: pip install sphinx autodoc recommonmark sphinx-rtd-theme sphinxcontrib-apidoc
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Capture branch and tag
id: capture_tag
run: |
echo "${GITHUB_REF#refs/heads/}"
echo "${GITHUB_REF#refs/tags/}"
echo ::set-output name=tag_number::${GITHUB_REF#refs/tags/}
- name: Build docs
run: |
make clean
make html
working-directory: ./docs

- name: Deploy docs (Main)
if: github.ref == 'refs/heads/main'
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
destination_dir : dev
publish_dir: docs/_build/html/
allow_empty_commit : true
commit_message: ${{ github.event.head_commit.message }}
- name: Deploy docs (Next release)
if: startsWith(github.ref, 'refs/heads/release')
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
destination_dir : next_release
publish_dir: docs/_build/html/
allow_empty_commit : true
commit_message: ${{ github.event.head_commit.message }}
- name: Deploy docs (Tags)
if: startsWith(github.ref, 'refs/tags/')
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
destination_dir : ${{ steps.capture_tag.outputs.tag_number }}
publish_dir: docs/_build/html/
allow_empty_commit : true
commit_message: ${{ github.event.head_commit.message }}
3 changes: 2 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
# sys.path.insert(0, os.path.abspath('.'))

import sphinx_rtd_theme
import numba_dppy

# -- Project information -----------------------------------------------------

Expand All @@ -23,7 +24,7 @@
author = "Intel"

# The full version, including alpha/beta/rc tags
release = "0.14.3"
release = numba_dppy.__version__


# -- General configuration ---------------------------------------------------
Expand Down