|
| 1 | +name: "Test & Build" |
| 2 | +on: [push, workflow_dispatch] |
| 3 | +jobs: |
| 4 | + codeanalysis: |
| 5 | + name: "Code Quality" |
| 6 | + runs-on: ubuntu-latest |
| 7 | + |
| 8 | + steps: |
| 9 | + - name: Checkout repository |
| 10 | + uses: actions/checkout@v2 |
| 11 | + |
| 12 | + - name: Lint |
| 13 | + uses: ricardochaves/[email protected] |
| 14 | + continue-on-error: true |
| 15 | + with: |
| 16 | + python-root-list: "src" |
| 17 | + |
| 18 | + test: |
| 19 | + name: "Test" |
| 20 | + runs-on: ${{ matrix.os-version }} |
| 21 | + env: |
| 22 | + LANG: en_US.UTF-8 |
| 23 | + strategy: |
| 24 | + matrix: |
| 25 | + python-version: [3.5, 3.6, 3.7, 3.8, 3.9] |
| 26 | + os-version: [ubuntu-latest, windows-latest, macos-latest] |
| 27 | + |
| 28 | + steps: |
| 29 | + - name: Checkout repository |
| 30 | + uses: actions/checkout@v2 |
| 31 | + |
| 32 | + - name: Set up Python ${{ matrix.python-version }} |
| 33 | + uses: actions/setup-python@v2 |
| 34 | + with: |
| 35 | + python-version: ${{ matrix.python-version }} |
| 36 | + |
| 37 | + - name: Install dependencies (Ubuntu) |
| 38 | + if: matrix.os-version == 'ubuntu-latest' |
| 39 | + run: | |
| 40 | + sudo apt-get update |
| 41 | + sudo apt-get install build-essential libkrb5-dev |
| 42 | +
|
| 43 | + - name: Install dependencies (Common) |
| 44 | + run: | |
| 45 | + # Setup tox |
| 46 | + pip install --upgrade pip |
| 47 | + pip install tox tox-gh-actions codecov |
| 48 | +
|
| 49 | + - name: Run Tests |
| 50 | + run: | |
| 51 | + tox |
| 52 | + codecov |
| 53 | +
|
| 54 | +
|
| 55 | + gh-pages: |
| 56 | + name: "Build Documentation" |
| 57 | + runs-on: ubuntu-latest |
| 58 | + needs: test |
| 59 | + if: startsWith(github.ref, 'refs/tags/') # run only on tagged commits |
| 60 | + |
| 61 | + steps: |
| 62 | + - name: Checkout repository |
| 63 | + uses: actions/checkout@v2 |
| 64 | + |
| 65 | + - name: Set up Python |
| 66 | + uses: actions/setup-python@v2 |
| 67 | + with: |
| 68 | + python-version: 3.6 |
| 69 | + |
| 70 | + - name: Setup environment |
| 71 | + run: | |
| 72 | + mv doc docs |
| 73 | + sudo apt-get install build-essential |
| 74 | + pip install sphinx six |
| 75 | +
|
| 76 | + - name: Check documentation |
| 77 | + uses: ammaraskar/sphinx-problem-matcher@master |
| 78 | + |
| 79 | + - name: Build documentation |
| 80 | + run: sphinx-build -Ean -b html -j auto -D todo_include_todos=0 ./docs ./docs/_build/html |
| 81 | + |
| 82 | + - name: Archive artifacts |
| 83 | + uses: actions/upload-artifact@v2 |
| 84 | + with: |
| 85 | + name: html-docs |
| 86 | + path: ./docs/_build/html |
| 87 | + |
| 88 | + build: |
| 89 | + name: "Build Package" |
| 90 | + runs-on: ubuntu-latest |
| 91 | + needs: test |
| 92 | + if: startsWith(github.ref, 'refs/tags/') # run only on tagged commits |
| 93 | + |
| 94 | + steps: |
| 95 | + - name: Checkout repository |
| 96 | + uses: actions/checkout@v2 |
| 97 | + |
| 98 | + - name: Setup Python |
| 99 | + uses: actions/setup-python@v2 |
| 100 | + |
| 101 | + - name: Install dependencies |
| 102 | + run: | |
| 103 | + pip install --upgrade pip |
| 104 | + pip install setuptools wheel twine |
| 105 | +
|
| 106 | + - name: Build Package |
| 107 | + run: | |
| 108 | + python setup.py sdist bdist_wheel |
| 109 | +
|
| 110 | + - name: Archive artifacts |
| 111 | + # Archive distribution files for use by auto (or manual) PyPI upload |
| 112 | + uses: actions/upload-artifact@v2 |
| 113 | + with: |
| 114 | + name: pypi-dist |
| 115 | + path: ./dist |
| 116 | + |
| 117 | + publish: |
| 118 | + name: "Publish" |
| 119 | + runs-on: ubuntu-latest |
| 120 | + needs: [gh-pages, build] |
| 121 | + steps: |
| 122 | + - name: Create Release |
| 123 | + uses: softprops/action-gh-release@v1 |
| 124 | + with: |
| 125 | + draft: true |
| 126 | + body: "Test Release" |
| 127 | + |
| 128 | + - name: Download a Documentation |
| 129 | + uses: actions/download-artifact@v2 |
| 130 | + with: |
| 131 | + name: html-docs |
| 132 | + |
| 133 | + - name: Display structure of downloaded files |
| 134 | + run: ls -R |
| 135 | + |
| 136 | +# - name: Upload Documentation |
| 137 | +# uses: crazy-max/ghaction-github-pages@v2 |
| 138 | +# with: |
| 139 | +# target_branch: gh-pages |
| 140 | +# build_dir: ./docs/_build/_html |
| 141 | + |
| 142 | +# - name: Publish to PyPI |
| 143 | +# uses: pypa/gh-action-pypi-publish@release/v1 |
| 144 | +# with: |
| 145 | +# user: __token__ |
| 146 | +# password: ${{ secrets.PYPI_API_TOKEN }} |
| 147 | +# verbose: true |
| 148 | + |
0 commit comments