|
| 1 | +name: Documentation and Code Coverage |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + pull_request: |
| 6 | + types: |
| 7 | + - closed |
| 8 | + branches: |
| 9 | + - main |
| 10 | + |
| 11 | +jobs: |
| 12 | + run: |
| 13 | + name: Build documentation on ${{ matrix.os }} |
| 14 | + runs-on: ${{ matrix.os }} |
| 15 | + strategy: |
| 16 | + matrix: |
| 17 | + os: [ubuntu-latest] |
| 18 | + |
| 19 | + steps: |
| 20 | + - uses: actions/checkout@v3 |
| 21 | + |
| 22 | + - uses: actions/setup-python@v4 |
| 23 | + with: |
| 24 | + python-version: '3.12' |
| 25 | + |
| 26 | + - uses: tlylt/install-graphviz@v1 |
| 27 | + |
| 28 | + - name: Install pandoc |
| 29 | + run: sudo apt-get install -y pandoc |
| 30 | + |
| 31 | + - name: Install pytorch |
| 32 | + run: python -m pip install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cpu |
| 33 | + |
| 34 | + # - name: Install numpy, onnxruntime-training |
| 35 | + # run: python -m pip install numpy onnxruntime-training |
| 36 | + |
| 37 | + - name: Install requirements |
| 38 | + run: python -m pip install -r requirements.txt |
| 39 | + |
| 40 | + - name: Install requirements dev |
| 41 | + run: | |
| 42 | + python -m pip install -r requirements-dev.txt |
| 43 | +
|
| 44 | + - name: Cache pip |
| 45 | + uses: actions/cache@v4 |
| 46 | + with: |
| 47 | + path: ~/.cache/pip |
| 48 | + key: ${{ runner.os }}-pip-${{ hashFiles('requirements-dev.txt') }} |
| 49 | + restore-keys: | |
| 50 | + ${{ runner.os }}-pip- |
| 51 | + ${{ runner.os }}- |
| 52 | +
|
| 53 | + - name: pip freeze |
| 54 | + run: python -m pip freeze |
| 55 | + |
| 56 | + - name: Generate coverage report |
| 57 | + run: | |
| 58 | + pip install pytest |
| 59 | + pip install pytest-cov |
| 60 | + export PYTHONPATH=. |
| 61 | + UNITTEST_GOING=1 pytest --cov=./onnx_diagnostic/ --cov-report=xml --durations=10 _unittests |
| 62 | + export PYTHONPATH= |
| 63 | +
|
| 64 | + - name: Upload coverage reports to Codecov |
| 65 | + uses: codecov/codecov-action@v3 |
| 66 | + env: |
| 67 | + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |
| 68 | + |
| 69 | + - name: Install |
| 70 | + run: python -m pip install -e . -v |
| 71 | + |
| 72 | + - name: Copy license, changelogs |
| 73 | + run: | |
| 74 | + cp LICENSE* ./_doc |
| 75 | + cp CHANGELOGS* ./_doc |
| 76 | +
|
| 77 | + - name: Documentation |
| 78 | + continue-on-error: true |
| 79 | + run: UNITTEST_GOING=1 python -m sphinx ./_doc ./dist/html -n -w doc.txt |
| 80 | + |
| 81 | + - name: Summary |
| 82 | + run: cat doc.txt |
| 83 | + |
| 84 | + - name: Check for errors and warnings |
| 85 | + continue-on-error: true |
| 86 | + run: | |
| 87 | + if [[ $(grep ERROR doc.txt | grep -v 'Unknown target name: "l_shape"' | grep -v 'Unknown target name: "l_x"') ]]; then |
| 88 | + echo "Documentation produces errors." |
| 89 | + grep ERROR doc.txt |
| 90 | + exit 1 |
| 91 | + fi |
| 92 | + if [[ $(grep WARNING doc.txt) ]]; then |
| 93 | + echo "Documentation produces warnings." |
| 94 | + grep WARNING doc.txt |
| 95 | + exit 1 |
| 96 | + fi |
| 97 | +
|
| 98 | + - uses: actions/upload-artifact@v4 |
| 99 | + with: |
| 100 | + path: ./dist/html/** |
0 commit comments