From bfe35de594aa4a5bab93bffe8f3c44c5d4d2c4fd Mon Sep 17 00:00:00 2001 From: Dan Snow Date: Wed, 24 Jul 2024 18:45:32 +0000 Subject: [PATCH] Add ruff linting --- .github/workflows/lint.yaml | 26 ++++++++++++++++++++++++++ .github/workflows/pages.yaml | 8 +++++--- .github/workflows/test-coverage.yaml | 4 +++- 3 files changed, 34 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/lint.yaml diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml new file mode 100644 index 0000000..28f7c7e --- /dev/null +++ b/.github/workflows/lint.yaml @@ -0,0 +1,26 @@ +on: + pull_request: + branches: [main, master] + push: + branches: [main, master] + +name: lint + +jobs: + lint-ruff: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup python + uses: actions/setup-python@v5 + with: + python-version: "3.x" + cache: "pip" + + - name: Install dependencies + run: pip install . Ruff + + - name: Lint with ruff + run: ruff check --output-format=github . diff --git a/.github/workflows/pages.yaml b/.github/workflows/pages.yaml index 71720ad..358bf2e 100644 --- a/.github/workflows/pages.yaml +++ b/.github/workflows/pages.yaml @@ -20,18 +20,20 @@ jobs: - name: Setup python uses: actions/setup-python@v5 with: - python-version: "3.11" + python-version: "3.x" cache: "pip" + - name: Install dependencies + run: pip install .[docs] + - name: Generate HTML run: | - pip install .[docs] sphinx-build -d _build/doctrees docs/source _build/html - name: Upload artifact uses: actions/upload-pages-artifact@v3 with: - path: '_build/html' + path: "_build/html" deploy: if: contains(fromJSON('["main", "master"]'), github.ref_name) && github.event_name != 'pull_request' diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml index d8920d1..e6c0681 100644 --- a/.github/workflows/test-coverage.yaml +++ b/.github/workflows/test-coverage.yaml @@ -24,9 +24,11 @@ jobs: python-version: ${{ matrix.python-version }} cache: "pip" + - name: Install dependencies + run: pip install .[test] + - name: Run pytest run: | - pip install .[test] pytest --doctest-modules \ --junitxml=junit/test-results-${{ matrix.python-version }}.xml