|
| 1 | +# Tests with pytest the package and monitors the coverage and sends it to coveralls.io |
| 2 | +# Coverage is only send to coveralls.io when no pytest tests fail |
| 3 | +name: "Tests & Coverage" |
| 4 | + |
| 5 | +on: [push] |
| 6 | + |
| 7 | +# Cancel jobs on new push |
| 8 | +concurrency: |
| 9 | + group: ${{ github.workflow }}-${{ github.ref || github.run_id }} |
| 10 | + cancel-in-progress: true |
| 11 | + |
| 12 | +jobs: |
| 13 | + build: |
| 14 | + name: "${{ matrix.name-suffix }} at py${{ matrix.python-version }} on ${{ matrix.os }}" |
| 15 | + runs-on: ${{ matrix.os }} |
| 16 | + |
| 17 | + strategy: |
| 18 | + fail-fast: false |
| 19 | + matrix: |
| 20 | + include: |
| 21 | + - name-suffix: "coverage" |
| 22 | + os: ubuntu-latest |
| 23 | + python-version: "3.11" |
| 24 | + - name-suffix: "basic" |
| 25 | + os: ubuntu-latest |
| 26 | + python-version: "3.10" |
| 27 | + - name-suffix: "basic" |
| 28 | + os: ubuntu-latest |
| 29 | + python-version: "3.12" |
| 30 | + - name-suffix: "basic" |
| 31 | + os: windows-latest |
| 32 | + python-version: "3.11" |
| 33 | + |
| 34 | + steps: |
| 35 | + - name: Checkout repo |
| 36 | + uses: actions/checkout@v3 |
| 37 | + |
| 38 | + - name: Set up Python |
| 39 | + uses: actions/setup-python@v4 |
| 40 | + with: |
| 41 | + python-version: ${{ matrix.python-version }} |
| 42 | + |
| 43 | + - name: Set up Conda |
| 44 | + if: runner.os == 'Windows' |
| 45 | + uses: conda-incubator/setup-miniconda@v2 |
| 46 | + with: |
| 47 | + miniconda-version: "latest" |
| 48 | + python-version: ${{ matrix.python-version }} |
| 49 | + activate-environment: testenv |
| 50 | + |
| 51 | + - name: Install dependencies |
| 52 | + run: | |
| 53 | + python -m pip install --upgrade pip wheel setuptools |
| 54 | + python -m pip install .[dev] |
| 55 | +
|
| 56 | + - name: Run tests |
| 57 | + if: ${{ !(runner.os == 'Linux' && matrix.python-version == 3.9 && matrix.name-suffix == 'coverage') }} |
| 58 | + run: | |
| 59 | + python -m pytest --disable-warnings --color=yes -v |
| 60 | +
|
| 61 | + - name: Run tests, coverage and send to coveralls |
| 62 | + if: runner.os == 'Linux' && matrix.python-version == 3.9 && matrix.name-suffix == 'coverage' |
| 63 | + run: | |
| 64 | + coverage run --source=windpowerlib -m pytest --disable-warnings --color=yes -v |
| 65 | + coveralls |
| 66 | + env: |
| 67 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 68 | + COVERALLS_SERVICE_NAME: github |
0 commit comments