Skip to content

Commit

Permalink
Add GH workflows for doc builds and API checks
Browse files Browse the repository at this point in the history
  • Loading branch information
vshampor committed Apr 13, 2023
1 parent f7f5a9f commit 7764a61
Show file tree
Hide file tree
Showing 10 changed files with 121 additions and 23 deletions.
File renamed without changes.
38 changes: 38 additions & 0 deletions .github/workflows/api_changes_check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: API changes check
on:
pull_request_target:
branches:
- develop

env:
API_DOC_HTML_ROOT_RELATIVE_PATH: autoapi

concurrency:
group: ci-${{ github.head_ref }}-${{ github.workflow }}
cancel-in-progress: true

jobs:
call-build-api-doc:
uses: ./.github/workflows/build_html_doc.yml
compare-api-doc-with-develop:
needs: call-build-api-doc
runs-on: ubuntu-latest
steps:
- name: Download built HTML doc as artifact from previous step
uses: alehechka/download-tartifact@v2
with:
name: html_doc_artifact
- name: Checkout latest doc_pages branch tip
uses: actions/checkout@v3
with:
ref: doc_pages
path: previous_doc_state
- name: Get changed file names in API doc path
id: diff
run: |
cd html_build/html/$API_DOC_HTML_ROOT_RELATIVE_PATH
find . -name "*.html" -exec diff -qrBZ {} $GITHUB_WORKSPACE/previous_doc_state/$API_DOC_HTML_ROOT_RELATIVE_PATH/{} \;
- uses: actions-ecosystem/action-add-labels@v1
if: ${{ steps.diff.outputs }} != ""
with:
labels: API
40 changes: 40 additions & 0 deletions .github/workflows/build_and_publish_doc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Build complete docs and publish to GH Pages
on:
push:
branches:
- develop

env:
GH_PAGES_BRANCH: doc_pages

permissions:
contents: write
jobs:
call-build-html-doc:
uses: ./.github/workflows/build_html_doc.yml
call-build-schema-page:
uses: ./.github/workflows/build_schema_page.yml
publish:
concurrency:
group: ci-${{ github.head_ref }}-${{ github.workflow }}
cancel-in-progress: true
needs: [call-build-html-doc, call-build-schema-page]
runs-on: ubuntu-latest
steps:
- name: Checkout main repo # the github-pages-deploy-action seems to require this step
uses: actions/checkout@v3
- name: Download HTML doc build artifact
uses: alehechka/download-tartifact@v2
with:
name: html_doc_artifact
- name: Download schema doc build artifact
uses: alehechka/download-tartifact@v2
with:
name: schema_doc_artifact
path: html_build/html
- name: Publish built docs on Github Pages branch ${{ env.GH_PAGES_BRANCH }}
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: html_build/html
token: ${{ secrets.PUSH_TO_GH_PAGES_BRANCH }}
branch: ${{ env.GH_PAGES_BRANCH }}
24 changes: 24 additions & 0 deletions .github/workflows/build_html_doc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: HTML documentation build
on:
workflow_call:
jobs:
build-html:
runs-on: ubuntu-latest
concurrency:
group: ci-${{ github.head_ref }}-${{ github.workflow }}
cancel-in-progress: true
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install NNCF and doc requirements
run: |
pip install -e .
pip install -r docs/api/requirements.txt
- name: Build API docs
run: |
sphinx-build -M html docs/api/source html_build
- name: Upload built HTMLs as job artifact
uses: alehechka/upload-tartifact@v2
with:
name: html_doc_artifact
path: html_build/html
28 changes: 14 additions & 14 deletions .github/workflows/build_schema_page.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
name: Config schema HTML build
on:
push:
pull_request_target:
branches:
- develop
- test_for_doc_build_trigger
paths:
- nncf/config/**
permissions:
contents: write
workflow_call:
jobs:
build-and-deploy:
concurrency: ci-${{ github.ref }} # Recommended if you intend to make multiple deployments in quick succession.
build-config-schema-html:
concurrency:
group: ci-${{ github.head_ref }}-${{ github.workflow }}
cancel-in-progress: true
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install and Build # This example project is built using npm and outputs the result to the 'build' folder. Replace with the commands required to build your project, or remove this step entirely if your site is pre-built.
- name: Install and Build
run: |
pip install json-schema-for-humans
pip install -e .
python -c 'import jstyleson; from nncf.config import NNCFConfig; jstyleson.dump(NNCFConfig.schema(), open("./schema.json", "w"), indent=2)'
mkdir schema_html_build
generate-schema-doc --deprecated-from-description schema.json schema_html_build/index.html
- name: Deploy
uses: JamesIves/github-pages-deploy-action@v4
mkdir schema
generate-schema-doc --deprecated-from-description schema.json schema/index.html
- name: Upload result as artifact
uses: alehechka/upload-tartifact@v2
with:
folder: schema_html_build # The folder the action should deploy.
token: ${{ secrets.PUSH_TO_GH_PAGES_BRANCH }}
branch: doc_pages
name: schema_doc_artifact
path: schema
4 changes: 2 additions & 2 deletions .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: "Pull Request Labeler"
on: [pull_request_target]

jobs:
triage:
set-label:
permissions:
contents: read
pull-requests: write
Expand All @@ -11,5 +11,5 @@ jobs:
- uses: actions/labeler@v4
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
configuration-path: '.github/labeler.yml'
configuration-path: '.github/action_configs/labeler.yml'
sync-labels: true
2 changes: 1 addition & 1 deletion .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries

name: Upload Python Package
name: Publish release Python package to PyPI

on:
release:
Expand Down
4 changes: 2 additions & 2 deletions docs/api/source/index.rst
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
NNCF doc testing!
NNCF documentation
================================

.. toctree::
:caption: Contents:
:maxdepth: 3

API Reference<autoapi/nncf/index>
JSON configuration file schema<./schema.html#http://>
JSON configuration file schema<./schema#http://>

2 changes: 0 additions & 2 deletions nncf/onnx/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,8 @@
import numpy as np
import onnxruntime as rt

from nncf.common.api_marker import api
from nncf.common.engine import Engine

@api()
class ONNXEngine(Engine):
"""
Engine for ONNX backend using ONNXRuntime to infer the model.
Expand Down
2 changes: 0 additions & 2 deletions nncf/openvino/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import openvino.runtime as ov

from nncf.api.compression import TModel
from nncf.common.api_marker import api
from nncf.data import Dataset
from nncf.data.dataset import DataProvider

Expand Down Expand Up @@ -117,7 +116,6 @@ def calc_per_sample_metrics(compiled_model: ov.CompiledModel,

# TODO(andrey-churkin): This class should be refactored. We will be able to do that when
# we will have POT code in NNCF.
@api()
class OVEngine(pot.IEEngine):
"""
Implementation of the engine for OpenVINO backend.
Expand Down

0 comments on commit 7764a61

Please sign in to comment.