|
| 1 | +# This workflow will install Python dependencies, run tests and lint with a variety of Python versions |
| 2 | +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python |
| 3 | + |
| 4 | +name: Python package |
| 5 | + |
| 6 | +on: |
| 7 | + push: |
| 8 | + branches: [ "master" ] |
| 9 | + pull_request: |
| 10 | + branches: [ "master" ] |
| 11 | + |
| 12 | +jobs: |
| 13 | + build: |
| 14 | + |
| 15 | + runs-on: ubuntu-latest |
| 16 | + strategy: |
| 17 | + fail-fast: false |
| 18 | + matrix: |
| 19 | + python-version: ["3.9", "3.10", "3.11", "3.12"] |
| 20 | + |
| 21 | + steps: |
| 22 | + - uses: actions/checkout@v3 |
| 23 | + - name: Set up Python ${{ matrix.python-version }} |
| 24 | + uses: actions/setup-python@v3 |
| 25 | + with: |
| 26 | + python-version: ${{ matrix.python-version }} |
| 27 | + - name: Install dependencies |
| 28 | + run: | |
| 29 | + "${SHELL}" <(curl -L micro.mamba.pm/install.sh) |
| 30 | + eval "$(micromamba shell hook --shell bash)" |
| 31 | + micromamba activate base |
| 32 | + micromamba install pytest-cov pytest-mpl xarray netcdf4 pandas numpy scikit-learn scipy pyproj cartopy metpy ipywidgets python=${{ matrix.python-version }} -c conda-forge |
| 33 | + python -m pip install . |
| 34 | + - name: Test with pytest |
| 35 | + run: | |
| 36 | + eval "$(micromamba shell hook --shell bash)" |
| 37 | + micromamba activate base |
| 38 | + coverage run --source=pyxlma -m pytest --mpl --mpl-baseline-path=tests/truth/images/ --mpl-generate-summary=html,json --mpl-results-path=tests/mpl-results/ tests/ |
| 39 | + coverage xml |
| 40 | + - name: Upload coverage reports to Codecov |
| 41 | + uses: codecov/codecov-action@v3 |
| 42 | + env: |
| 43 | + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |
| 44 | + - name: Upload matplotlib test results |
| 45 | + if: always() |
| 46 | + uses: actions/upload-artifact@v3 |
| 47 | + with: |
| 48 | + name: matplotlib-results |
| 49 | + path: tests/mpl-results/ |
0 commit comments