File: check-and-publish.yml

package info (click to toggle)
eccodes-python 2%3A2.45.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,048 kB
  • sloc: python: 7,752; ansic: 280; sh: 94; makefile: 81; cpp: 30
file content (94 lines) | stat: -rw-r--r-- 2,586 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
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 --diff -v .
      - run: flake8 .

  checks:
    strategy:
      fail-fast: false
      matrix:
        platform: [ubuntu-latest, macos-latest, windows-latest]
        python-version: ['3.9', '3.10', '3.11', '3.12']
        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: ECCODES_PYTHON_USE_FINDLIBS=1 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'
          ECCODES_PYTHON_USE_FINDLIBS: '1'

      - run: pytest
        if: matrix.method != 'conda' || matrix.platform != 'windows-latest'
        env:
          ECCODES_PYTHON_USE_FINDLIBS: '1'
      # pytest -v --cov=. --cov-report=xml --cov-branch .

      - name: Upload coverage to Codecov
        uses: codecov/codecov-action@v1
        if: 'false'