File size: 3,017 Bytes
db5855f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
name: code_check

on:
  workflow_dispatch:
  pull_request:
    branches:
      - 'main'
      - 'latest'
    paths:
      - 'notebooks/**.ipynb'
      - 'notebooks/**.py'
      - 'requirements.txt'
      - '.ci/*'
      - '.github/workflows/*.yml'
      - '.github/workflows/.env'
  push:
    branches:
      - 'main'
      - 'latest'
    paths:
      - 'notebooks/**.ipynb'
      - 'notebooks/**.py'
      - 'requirements.txt'
      - '.ci/*'
      - '.github/workflows/*.yml'
      - '.github/workflows/.env'

jobs:
  build_codecheck:
    strategy:
      fail-fast: false
    runs-on: ubuntu-20.04 # change cachepip step when changing this
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4
      - name: Dotenv Action
        id: dotenv
        uses: xom9ikk/dotenv@v1.0.2
        with:
          path: ./.github/workflows
      - name: Set up Python
        uses: actions/setup-python@v5
        with:
          python-version: 3.8 # change cachepip step when changing this
      - name: Cache OpenVINO Pip Packages
        id: cachepip
        uses: actions/cache@v3
        with:
          path: |
            pipcache
          key: ${{ env.PIP_CACHE_KEY }}-ubuntu-20.04-3.8
      - name: Cache openvino packages
        if: steps.cachepip.outputs.cache-hit != 'true'
        run: |
          python -m pip install --upgrade pip
          mkdir pipcache
          python -m pip install --cache-dir pipcache --no-deps openvino openvino-dev nncf
          cp -r pipcache pipcache_openvino
          python -m pip uninstall -y openvino openvino-dev nncf
      - name: Install dependencies
        run: |
          python -m pip install --upgrade pip
          python -m pip install -r .ci/dev-requirements.txt --cache-dir pipcache
          python -m ipykernel install --user --name openvino_env
      - name: Make pipcache directory with OpenVINO packages
        # Only cache OpenVINO packages. mv works cross-platform
        if: steps.cachepip.outputs.cache-hit != 'true'
        run: |
          mv pipcache pipcache_full
          mv pipcache_openvino pipcache
      - name: Pip freeze
        run: |
          python -m pip freeze
      - name: Check install
        run: |
          python check_install.py
      - name: Test Jupyterlab
        run: |
          jupyter lab notebooks --help
      - name: Flake8
        run: |
          nbqa flake8 --ignore=E124,E203,E231,E266,E402,E501,E703,F821,W503,W291,W293 --nbqa-exclude="(tensorflow-training-openvino)|(pytorch-quantization-aware-training)" notebooks
      - name: Black
        run: |
          black --check -l 160 .
      - name: Test READMEs and requirements
        run: |
          python -m pytest .ci/test_notebooks.py
      - name: Test links from READMEs
        run: |
          python .ci/check_links.py
      - name: Test table of content and device widget
        run: |
          python .ci/check_notebooks.py