ECC-1742: Tests #200
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Check and publish | |
on: | |
push: | |
branches: [master, develop] | |
pull_request: | |
branches: [master, develop] | |
release: | |
types: [created] | |
jobs: | |
quality: | |
name: Code QA | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- run: pip install black flake8 isort | |
- run: black --version | |
- run: isort --check . | |
- run: black --check . | |
- run: flake8 . | |
checks: | |
strategy: | |
fail-fast: false | |
matrix: | |
platform: [ubuntu-latest, macos-latest, windows-latest] | |
python-version: ['3.8', '3.9', '3.10', '3.11'] | |
method: ['conda', 'ecmwflibs'] | |
exclude: | |
- platform: macos-latest | |
python-version: '3.9' | |
method: 'ecmwflibs' | |
name: Python ${{ matrix.python-version }} on ${{ matrix.platform }} (${{ matrix.method }}) | |
runs-on: ${{ matrix.platform }} | |
needs: quality | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- if: matrix.method == 'conda' | |
name: Setup conda | |
uses: s-weigand/setup-conda@v1 | |
with: | |
update-conda: true | |
python-version: ${{ matrix.python-version }} | |
conda-channels: anaconda, conda-forge | |
- name: Install tools | |
run: | | |
python -m pip install --upgrade pip | |
pip install pytest pytest-cov isort black flake8 | |
pip install --upgrade setuptools wheel | |
- if: matrix.method == 'conda' | |
run: conda install 'eccodes>=2.27.0' | |
- if: matrix.method == 'ecmwflibs' | |
name: Install ecmwflibs | |
run: pip install ecmwflibs | |
- run: python setup.py develop | |
- run: pip install -r tests/requirements.txt | |
- run: pip freeze | |
- run: env | sort | |
- run: python -m eccodes selfcheck | |
- run: pytest | |
if: matrix.method == 'conda' && matrix.platform == 'windows-latest' | |
env: | |
ECCODES_DEFINITION_PATH: 'C:/Miniconda/Library/share/eccodes/definitions' | |
ECCODES_SAMPLES_PATH: 'C:/Miniconda/Library/share/eccodes/samples' | |
- run: pytest | |
if: matrix.method != 'conda' || matrix.platform != 'windows-latest' | |
# pytest -v --cov=. --cov-report=xml --cov-branch . | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v1 | |
if: 'false' |