|
| 1 | +name: Build |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ main, develop ] |
| 6 | + pull_request: |
| 7 | + branches: [ main ] |
| 8 | + |
| 9 | +jobs: |
| 10 | + build: |
| 11 | + |
| 12 | + runs-on: ubuntu-latest |
| 13 | + strategy: |
| 14 | + matrix: |
| 15 | + python-version: [3.9] |
| 16 | + |
| 17 | + steps: |
| 18 | + - uses: actions/checkout@v2 |
| 19 | + - name: Set up Python ${{ matrix.python-version }} |
| 20 | + uses: actions/setup-python@v2 |
| 21 | + with: |
| 22 | + python-version: ${{ matrix.python-version }} |
| 23 | + - name: Install dependencies |
| 24 | + run: | |
| 25 | + python -m pip install --upgrade pip |
| 26 | + pip install -r requirements.txt |
| 27 | + pip install -r test-requirements.txt |
| 28 | + - name: Lint with flake8 |
| 29 | + run: | |
| 30 | + # stop the build if there are Python syntax errors or undefined names |
| 31 | + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics |
| 32 | + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide |
| 33 | + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics |
| 34 | + - name: Install locally |
| 35 | + run: | |
| 36 | + python ./setup.py install |
| 37 | + - name: Test with pytest |
| 38 | + run: | |
| 39 | + python -m pytest --junitxml=build/test-results-${{ matrix.python-version }}.xml |
| 40 | + - name: Upload pytest test results |
| 41 | + uses: actions/upload-artifact@v2 |
| 42 | + with: |
| 43 | + name: pytest-results-${{ matrix.python-version }} |
| 44 | + path: build/test-results-${{ matrix.python-version }}.xml |
| 45 | + # Use always() to always run this step to publish test results when there are test failures |
| 46 | + if: ${{ always() }} |
| 47 | + - name: Upload coverage |
| 48 | + uses: actions/upload-artifact@v2 |
| 49 | + with: |
| 50 | + name: coverage |
| 51 | + path: build/coverage.xml |
0 commit comments