|
| 1 | +name: python-package |
| 2 | + |
| 3 | +on: push |
| 4 | + |
| 5 | +jobs: |
| 6 | + pkg-install: |
| 7 | + runs-on: ubuntu-latest |
| 8 | + steps: |
| 9 | + - uses: actions/checkout@v2 |
| 10 | + - name: Set up Python 3.7 |
| 11 | + uses: actions/setup-python@v1 |
| 12 | + with: |
| 13 | + python-version: 3.7 |
| 14 | + architecture: x64 |
| 15 | + - name: Cache python modules |
| 16 | + |
| 17 | + env: |
| 18 | + cache-name: cache-pkg-requirements |
| 19 | + with: |
| 20 | + path: ~/.cache/pip |
| 21 | + key: ${{ runner.os }}-install-${{ env.cache-name }}-${{ hashFiles('requirements.txt') }} |
| 22 | + restore-keys: | |
| 23 | + ${{ runner.os }}-install-${{ env.cache-name }}- |
| 24 | + ${{ runner.os }}-install- |
| 25 | + ${{ runner.os }}- |
| 26 | + - name: Install package |
| 27 | + run: | |
| 28 | + python -m pip install --upgrade pip |
| 29 | + pip install -e . |
| 30 | +
|
| 31 | + pkg-test: |
| 32 | + runs-on: ubuntu-latest |
| 33 | + needs: pkg-install |
| 34 | + steps: |
| 35 | + - uses: actions/checkout@v2 |
| 36 | + - name: Set up Python 3.7 |
| 37 | + uses: actions/setup-python@v1 |
| 38 | + with: |
| 39 | + python-version: 3.7 |
| 40 | + architecture: x64 |
| 41 | + - name: Cache python modules |
| 42 | + |
| 43 | + env: |
| 44 | + cache-name: cache-pkg-requirements |
| 45 | + with: |
| 46 | + path: ~/.cache/pip |
| 47 | + key: ${{ runner.os }}-install-${{ env.cache-name }}-${{ hashFiles('requirements.txt') }} |
| 48 | + restore-keys: | |
| 49 | + ${{ runner.os }}-install-${{ env.cache-name }}- |
| 50 | + ${{ runner.os }}-install- |
| 51 | + ${{ runner.os }}- |
| 52 | + - name: Install dependencies |
| 53 | + run: | |
| 54 | + python -m pip install --upgrade pip |
| 55 | + pip install -e . |
| 56 | + pip install -r .github/workflows/requirements.txt |
| 57 | +
|
| 58 | + - name: Run unittests |
| 59 | + run: | |
| 60 | + coverage run -m unittest discover test/ |
| 61 | + coverage xml |
| 62 | +
|
| 63 | + - name: Upload coverage to Codecov |
| 64 | + |
| 65 | + with: |
| 66 | + file: ./coverage.xml # optional |
| 67 | + flags: unittests # optional |
| 68 | + fail_ci_if_error: true # optional (default = false) |
| 69 | + |
| 70 | + flake8-py3: |
| 71 | + runs-on: ubuntu-latest |
| 72 | + steps: |
| 73 | + - uses: actions/checkout@v2 |
| 74 | + - name: Set up Python 3.7 |
| 75 | + uses: actions/setup-python@v1 |
| 76 | + with: |
| 77 | + python-version: 3.7 |
| 78 | + architecture: x64 |
| 79 | + - name: Run flake8 |
| 80 | + run: | |
| 81 | + pip install flake8 |
| 82 | + flake8 --version |
| 83 | + flake8 ./ |
| 84 | +
|
| 85 | + docs-build: |
| 86 | + runs-on: ubuntu-latest |
| 87 | + needs: pkg-install |
| 88 | + steps: |
| 89 | + - uses: actions/checkout@v2 |
| 90 | + - name: Set up Python 3.7 |
| 91 | + uses: actions/setup-python@v1 |
| 92 | + with: |
| 93 | + python-version: 3.7 |
| 94 | + architecture: x64 |
| 95 | + - name: Cache python modules |
| 96 | + |
| 97 | + env: |
| 98 | + cache-name: cache-pkg-requirements |
| 99 | + with: |
| 100 | + path: ~/.cache/pip |
| 101 | + key: ${{ runner.os }}-install-${{ env.cache-name }}-${{ hashFiles('requirements.txt') }} |
| 102 | + restore-keys: | |
| 103 | + ${{ runner.os }}-install-${{ env.cache-name }}- |
| 104 | + ${{ runner.os }}-install- |
| 105 | + ${{ runner.os }}- |
| 106 | + - name: Install dependencies |
| 107 | + run: | |
| 108 | + python -m pip install --upgrade pip |
| 109 | + pip install -e . |
| 110 | + pip install -r docs/requirements.txt |
| 111 | +
|
| 112 | + - name: Build documentation |
| 113 | + run: | |
| 114 | + sphinx-build docs/source docs/build -a |
0 commit comments