|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - dev |
| 7 | + - master |
| 8 | + pull_request: ~ |
| 9 | + |
| 10 | +jobs: |
| 11 | + lint: |
| 12 | + name: "Check style and lint" |
| 13 | + runs-on: ubuntu-latest |
| 14 | + steps: |
| 15 | + - uses: actions/checkout@v4 |
| 16 | + - name: Set up Python |
| 17 | + uses: actions/setup-python@v5 |
| 18 | + with: |
| 19 | + python-version: "3.12" |
| 20 | + - uses: actions/cache@v4 |
| 21 | + with: |
| 22 | + path: ${{ env.pythonLocation }} |
| 23 | + key: ${{ env.pythonLocation }}-${{ hashFiles('requirements.txt') }}-${{ hashFiles('test-requirements.txt') }} |
| 24 | + - name: Install dependencies |
| 25 | + run: | |
| 26 | + python -m pip install --upgrade pip |
| 27 | + pip install -r requirements.txt -r test-requirements.txt --upgrade --upgrade-strategy eager |
| 28 | + - name: Check isort |
| 29 | + run: isort tests pyheos --check-only |
| 30 | + - name: Check black |
| 31 | + run: black tests pyheos --check --fast --quiet |
| 32 | + - name: Check pylint |
| 33 | + run: pylint tests pyheos |
| 34 | + - name: Check flake8 |
| 35 | + run: flake8 tests pyheos --doctests |
| 36 | + |
| 37 | + tests: |
| 38 | + name: "Run tests on ${{ matrix.python-version }}" |
| 39 | + runs-on: ubuntu-latest |
| 40 | + needs: lint |
| 41 | + strategy: |
| 42 | + matrix: |
| 43 | + python-version: ["3.11", "3.12"] |
| 44 | + steps: |
| 45 | + - uses: actions/checkout@v4 |
| 46 | + - name: Set up Python |
| 47 | + uses: actions/setup-python@v5 |
| 48 | + with: |
| 49 | + python-version: ${{ matrix.python-version }} |
| 50 | + - uses: actions/cache@v4 |
| 51 | + with: |
| 52 | + path: ${{ env.pythonLocation }} |
| 53 | + key: ${{ env.pythonLocation }}-${{ hashFiles('requirements.txt') }}-${{ hashFiles('test-requirements.txt') }} |
| 54 | + - name: Install dependencies |
| 55 | + run: | |
| 56 | + python -m pip install --upgrade pip |
| 57 | + pip install -r requirements.txt -r test-requirements.txt --upgrade --upgrade-strategy eager |
| 58 | + - name: Run pytest on ${{ matrix.python-version }} |
| 59 | + run: pytest |
| 60 | + |
| 61 | + coverage: |
| 62 | + name: "Check code coverage" |
| 63 | + runs-on: ubuntu-latest |
| 64 | + needs: lint |
| 65 | + steps: |
| 66 | + - uses: actions/checkout@v4 |
| 67 | + - name: Set up Python |
| 68 | + uses: actions/setup-python@v5 |
| 69 | + with: |
| 70 | + python-version: "3.12" |
| 71 | + - uses: actions/cache@v4 |
| 72 | + with: |
| 73 | + path: ${{ env.pythonLocation }} |
| 74 | + key: ${{ env.pythonLocation }}-${{ hashFiles('requirements.txt') }}-${{ hashFiles('test-requirements.txt') }} |
| 75 | + - name: Install dependencies |
| 76 | + run: | |
| 77 | + python -m pip install --upgrade pip |
| 78 | + pip install -r requirements.txt -r test-requirements.txt --upgrade --upgrade-strategy eager |
| 79 | + - name: Run pytest on ${{ matrix.python-version }} |
| 80 | + run: pytest --cov=./ --cov-report=xml |
| 81 | + - name: Upload coverage reports to Codecov |
| 82 | + uses: codecov/codecov-action@v4.0.1 |
| 83 | + with: |
| 84 | + token: ${{ secrets.CODECOV_TOKEN }} |
| 85 | + fail_ci_if_error: true |
0 commit comments