|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ main, master, develop ] |
| 6 | + pull_request: |
| 7 | + branches: [ main, master ] |
| 8 | + |
| 9 | +jobs: |
| 10 | + test: |
| 11 | + runs-on: ${{ matrix.os }} |
| 12 | + strategy: |
| 13 | + fail-fast: false |
| 14 | + matrix: |
| 15 | + os: [ubuntu-latest, windows-latest, macos-latest] |
| 16 | + python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12'] |
| 17 | + |
| 18 | + steps: |
| 19 | + - uses: actions/checkout@v3 |
| 20 | + |
| 21 | + - name: Set up Python ${{ matrix.python-version }} |
| 22 | + uses: actions/setup-python@v4 |
| 23 | + with: |
| 24 | + python-version: ${{ matrix.python-version }} |
| 25 | + |
| 26 | + - name: Install dependencies |
| 27 | + run: | |
| 28 | + python -m pip install --upgrade pip |
| 29 | + pip install -e . |
| 30 | + pip install pytest pytest-cov flake8 black mypy |
| 31 | +
|
| 32 | + - name: Lint with flake8 |
| 33 | + run: | |
| 34 | + # stop the build if there are Python syntax errors or undefined names |
| 35 | + flake8 src --count --select=E9,F63,F7,F82 --show-source --statistics |
| 36 | + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide |
| 37 | + flake8 src --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics |
| 38 | +
|
| 39 | + - name: Format check with black |
| 40 | + run: | |
| 41 | + black --check src/ |
| 42 | +
|
| 43 | + - name: Type check with mypy |
| 44 | + run: | |
| 45 | + mypy src/ --ignore-missing-imports |
| 46 | +
|
| 47 | + - name: Test with pytest |
| 48 | + run: | |
| 49 | + pytest tests/ -v --cov=src/gpp_decrypt --cov-report=xml --cov-report=term |
| 50 | +
|
| 51 | + - name: Upload coverage reports to Codecov |
| 52 | + if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11' |
| 53 | + uses: codecov/codecov-action@v3 |
| 54 | + with: |
| 55 | + file: ./coverage.xml |
| 56 | + flags: unittests |
| 57 | + name: codecov-umbrella |
| 58 | + fail_ci_if_error: false |
0 commit comments