diff --git a/.github/workflows/lint-test-typings.yml b/.github/workflows/lint-test-typings.yml new file mode 100644 index 0000000..d912c71 --- /dev/null +++ b/.github/workflows/lint-test-typings.yml @@ -0,0 +1,83 @@ +name: Lint & Test + +on: + push: + branches: + - 'typings' + pull_request: + merge_group: + types: [checks_requested] + +permissions: + read-all + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} + cancel-in-progress: true + +defaults: + run: + shell: bash + +jobs: + lint: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Run pre-commit + id: pre-commit + uses: pre-commit/action@v3.0.0 + + pyright: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.8", "3.9", "3.10", "3.11"] + experimental: [false] + fail-fast: false + continue-on-error: ${{ matrix.experimental }} + + steps: + - uses: actions/checkout@v3 + + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v3 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install flake8 pytest + python -m pip install . + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + - name: Lint with flake8 + run: | + flake8 ./easy_pil --count --select=E9,F63,F7,F82 --show-source --statistics + flake8 ./easy_pil --count --exit-zero --max-complexity=10 --max-line-length=79 --statistics + - name: Test with pytest + run: | + pytest + + + - name: Run pyright (Linux) + uses: jakebailey/pyright-action@v1.4.1 + id: pyright-linux + with: + version: ${{ env.PYRIGHT_VERSION }} + python-version: ${{ steps.setup-env.outputs.python-version }} + python-platform: "Linux" + no-comments: ${{ matrix.python-version != '3.8' }} # only add comments for one version + warnings: true + + - name: Run pyright (Windows) + uses: jakebailey/pyright-action@v1.4.1 + if: always() && (steps.pyright-linux.outcome == 'success' || steps.pyright-linux.outcome == 'failure') + with: + version: ${{ env.PYRIGHT_VERSION }} + python-version: ${{ steps.setup-env.outputs.python-version }} + python-platform: "Windows" + no-comments: true # only add comments for one platform (see above) + warnings: true