|
| 1 | +# This workflow will install Python dependencies, run tests and lint with a variety of Python versions |
| 2 | +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions |
| 3 | + |
| 4 | +name: Tests |
| 5 | + |
| 6 | +on: |
| 7 | + push: |
| 8 | + branches: [ devel, master ] |
| 9 | + pull_request: |
| 10 | + branches: [ master ] |
| 11 | + |
| 12 | +jobs: |
| 13 | + pre_job: |
| 14 | + runs-on: ubuntu-latest |
| 15 | + outputs: |
| 16 | + should_skip: ${{ steps.skip_check.outputs.should_skip }} |
| 17 | + steps: |
| 18 | + - id: skip_check |
| 19 | + uses: fkirc/skip-duplicate-actions@v5 |
| 20 | + with: |
| 21 | + concurrent_skipping: same_content_newer |
| 22 | + skip_after_successful_duplicate: 'true' |
| 23 | + test: |
| 24 | + needs: pre_job |
| 25 | + if: needs.pre_job.outputs.should_skip != 'true' |
| 26 | + timeout-minutes: 10 |
| 27 | + runs-on: ubuntu-latest |
| 28 | + strategy: |
| 29 | + fail-fast: false |
| 30 | + matrix: |
| 31 | + python-version: ['3.8', '3.9', '3.10', '3.11'] |
| 32 | + steps: |
| 33 | + - uses: actions/checkout@v3 |
| 34 | + - name: Set up Python ${{ matrix.python-version }} |
| 35 | + uses: actions/setup-python@v4 |
| 36 | + with: |
| 37 | + python-version: ${{ matrix.python-version }} |
| 38 | + - name: Install dependencies |
| 39 | + run: | |
| 40 | + python -m pip install --upgrade pip |
| 41 | + python -m pip install flake8 pytest |
| 42 | + if [ -f requirements.txt ]; then python -m pip install -r requirements.txt; fi |
| 43 | + - name: Lint with flake8 |
| 44 | + run: | |
| 45 | + # stop the build if there are Python syntax errors or undefined names |
| 46 | + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics |
| 47 | + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide |
| 48 | + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics |
| 49 | + - name: Test with pytest |
| 50 | + run: | |
| 51 | + pytest |
0 commit comments