|
| 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: Python Unit Tests |
| 5 | + |
| 6 | +on: |
| 7 | + push: |
| 8 | + branches: [ "main", develop ] |
| 9 | + pull_request: |
| 10 | + branches: [ "main", develop ] |
| 11 | + |
| 12 | +jobs: |
| 13 | + python-3-9: |
| 14 | + runs-on: ${{ matrix.os }} |
| 15 | + strategy: |
| 16 | + fail-fast: false |
| 17 | + matrix: |
| 18 | + os: ["ubuntu-latest"] |
| 19 | + python-version: ["3.9"] |
| 20 | + defaults: |
| 21 | + run: |
| 22 | + shell: bash -l {0} |
| 23 | + steps: |
| 24 | + - uses: actions/checkout@v3 |
| 25 | + - uses: conda-incubator/setup-miniconda@v2 |
| 26 | + with: |
| 27 | + auto-update-conda: true |
| 28 | + python-version: ${{ matrix.python-version }} |
| 29 | + activate-environment: anaconda-client-env |
| 30 | + environment-file: envs/environment_3_9.yml |
| 31 | + auto-activate-base: false |
| 32 | + channels: conda-forge |
| 33 | + use-mamba: true |
| 34 | + - name: Install dependencies |
| 35 | + run: | |
| 36 | + python -m pip install --upgrade pip |
| 37 | + python -m pip install flake8 nose pinocchio nose-exclude coverage |
| 38 | + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi |
| 39 | + - name: Lint with flake8 |
| 40 | + run: | |
| 41 | + # stop the build if there are Python syntax errors or undefined names |
| 42 | + # flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics |
| 43 | + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide |
| 44 | + flake8 mowl --count --exit-zero --max-complexity=20 --max-line-length=127 --statistics |
| 45 | + - name: Test with nose |
| 46 | + run: | |
| 47 | + nosetests tests |
| 48 | +
|
| 49 | + python-3-10: |
| 50 | + |
| 51 | + runs-on: ${{ matrix.os }} |
| 52 | + strategy: |
| 53 | + fail-fast: false |
| 54 | + matrix: |
| 55 | + os: ["ubuntu-latest"] |
| 56 | + python-version: ["3.10"] |
| 57 | + defaults: |
| 58 | + run: |
| 59 | + shell: bash -l {0} |
| 60 | + steps: |
| 61 | + - uses: actions/checkout@v3 |
| 62 | + - uses: conda-incubator/setup-miniconda@v2 |
| 63 | + with: |
| 64 | + auto-update-conda: true |
| 65 | + python-version: ${{ matrix.python-version }} |
| 66 | + activate-environment: anaconda-client-env |
| 67 | + environment-file: envs/environment_3_10.yml |
| 68 | + auto-activate-base: false |
| 69 | + channels: conda-forge |
| 70 | + use-mamba: true |
| 71 | + - name: Install dependencies |
| 72 | + run: | |
| 73 | + python -m pip install --upgrade pip |
| 74 | + python -m pip install flake8 pytest coverage pytest-faulthandler |
| 75 | + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi |
| 76 | + - name: Lint with flake8 |
| 77 | + run: | |
| 78 | + # stop the build if there are Python syntax errors or undefined names |
| 79 | + # flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics |
| 80 | + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide |
| 81 | + flake8 mowl --count --exit-zero --max-complexity=20 --max-line-length=127 --statistics |
| 82 | + - name: Test with pytest |
| 83 | + run: | |
| 84 | + pytest -m "not slow" -p no:faulthandler |
| 85 | +
|
| 86 | +
|
| 87 | + python-3-11: |
| 88 | + |
| 89 | + runs-on: ${{ matrix.os }} |
| 90 | + strategy: |
| 91 | + fail-fast: false |
| 92 | + matrix: |
| 93 | + os: ["ubuntu-latest"] |
| 94 | + python-version: ["3.11"] |
| 95 | + defaults: |
| 96 | + run: |
| 97 | + shell: bash -l {0} |
| 98 | + steps: |
| 99 | + - uses: actions/checkout@v3 |
| 100 | + - uses: conda-incubator/setup-miniconda@v2 |
| 101 | + with: |
| 102 | + auto-update-conda: true |
| 103 | + python-version: ${{ matrix.python-version }} |
| 104 | + activate-environment: anaconda-client-env |
| 105 | + environment-file: envs/environment_3_11.yml |
| 106 | + auto-activate-base: false |
| 107 | + channels: conda-forge |
| 108 | + use-mamba: true |
| 109 | + - name: Install dependencies |
| 110 | + run: | |
| 111 | + python -m pip install --upgrade pip |
| 112 | + python -m pip install flake8 pytest coverage pytest-faulthandler |
| 113 | + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi |
| 114 | + - name: Lint with flake8 |
| 115 | + run: | |
| 116 | + # stop the build if there are Python syntax errors or undefined names |
| 117 | + # flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics |
| 118 | + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide |
| 119 | + flake8 mowl --count --exit-zero --max-complexity=20 --max-line-length=127 --statistics |
| 120 | + - name: Test with pytest |
| 121 | + run: | |
| 122 | + pytest -m "not slow" -p no:faulthandler |
| 123 | +
|
| 124 | + python-3-12: |
| 125 | + |
| 126 | + runs-on: ${{ matrix.os }} |
| 127 | + strategy: |
| 128 | + fail-fast: false |
| 129 | + matrix: |
| 130 | + os: ["ubuntu-latest"] |
| 131 | + python-version: ["3.12"] |
| 132 | + defaults: |
| 133 | + run: |
| 134 | + shell: bash -l {0} |
| 135 | + steps: |
| 136 | + - uses: actions/checkout@v3 |
| 137 | + - uses: conda-incubator/setup-miniconda@v2 |
| 138 | + with: |
| 139 | + auto-update-conda: true |
| 140 | + python-version: ${{ matrix.python-version }} |
| 141 | + activate-environment: anaconda-client-env |
| 142 | + environment-file: envs/environment_3_12.yml |
| 143 | + auto-activate-base: false |
| 144 | + channels: conda-forge |
| 145 | + use-mamba: true |
| 146 | + - name: Install dependencies |
| 147 | + run: | |
| 148 | + python -m pip install --upgrade pip |
| 149 | + python -m pip install flake8 pytest coverage pytest-faulthandler |
| 150 | + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi |
| 151 | + - name: Lint with flake8 |
| 152 | + run: | |
| 153 | + # stop the build if there are Python syntax errors or undefined names |
| 154 | + # flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics |
| 155 | + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide |
| 156 | + flake8 mowl --count --exit-zero --max-complexity=20 --max-line-length=127 --statistics |
| 157 | + - name: Test with pytest |
| 158 | + run: | |
| 159 | + pytest -m "not slow" -p no:faulthandler |
0 commit comments