From cf8e8bf4a7ae4279cb5c45b8418f0e1b70ff554b Mon Sep 17 00:00:00 2001 From: Brett Rowan <121075405+b-rowan@users.noreply.github.com> Date: Fri, 23 Aug 2024 09:52:41 -0600 Subject: [PATCH 1/3] Skip pytest in pre-commit.ci --- .pre-commit-config.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 512ac623..98c4d5a1 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,3 +1,6 @@ +ci: + skip: + - pytest repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.6.0 From 179834d3fa0617ca15bc9acc123b07e1b3dabba9 Mon Sep 17 00:00:00 2001 From: Brett Rowan <121075405+b-rowan@users.noreply.github.com> Date: Fri, 23 Aug 2024 09:58:53 -0600 Subject: [PATCH 2/3] Add `pyest` github action. --- .github/workflows/pr-run-tests.yml | 34 ++++++++++++++++++++++++++++++ pyproject.toml | 1 + 2 files changed, 35 insertions(+) create mode 100644 .github/workflows/pr-run-tests.yml diff --git a/.github/workflows/pr-run-tests.yml b/.github/workflows/pr-run-tests.yml new file mode 100644 index 00000000..38e7f7c9 --- /dev/null +++ b/.github/workflows/pr-run-tests.yml @@ -0,0 +1,34 @@ +name: Test PRs + +on: + pull_request: +jobs: + run-tests: + runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: write + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: "3.12" + cache: pip + - name: Install poetry + uses: abatilo/actions-poetry@v2 + - name: Install dependencies + run: poetry install --with tests + - name: Run tests + env: + REPORT_OUTPUT: md_report.md + shell: bash + run: | + echo "REPORT_FILE=${REPORT_OUTPUT}" >> "$GITHUB_ENV" + poetry run pytest -v --md-report --md-report-flavor gfm --md-report-exclude-outcomes passed skipped xpassed --md-report-output "$REPORT_OUTPUT" + - name: Render the report to the PR when tests fail + uses: marocchino/sticky-pull-request-comment@v2 + if: failure() + with: + header: test-report + recreate: true + path: ${{ env.REPORT_FILE }} diff --git a/pyproject.toml b/pyproject.toml index f5bdf848..e502f913 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -44,6 +44,7 @@ mkdocs-material = "^9.5.29" [tool.poetry.group.tests.dependencies] pytest = "^8.3.1" pytest-asyncio = "^0.23.8" +pytest-md-report = "^0.6.2" [tool.isort] profile = "black" From d8e6a30cd1cf28980cffa78a8be2f5494388e585 Mon Sep 17 00:00:00 2001 From: Brett Rowan <121075405+b-rowan@users.noreply.github.com> Date: Fri, 23 Aug 2024 09:19:12 -0600 Subject: [PATCH 3/3] Fix some linting issues. Ignore H021 (inline styles), swap to `url_for` where applicable from static links, and update image tags with width, height, and alt attributes. --- .djlintrc | 2 +- goosebit/ui/templates/nav.html.jinja | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.djlintrc b/.djlintrc index 1d192d46..dfb67b6d 100644 --- a/.djlintrc +++ b/.djlintrc @@ -1,3 +1,3 @@ { - "ignore": "H030,H031" + "ignore": "H030,H031,H021" } diff --git a/goosebit/ui/templates/nav.html.jinja b/goosebit/ui/templates/nav.html.jinja index 54d476bf..11224a0b 100644 --- a/goosebit/ui/templates/nav.html.jinja +++ b/goosebit/ui/templates/nav.html.jinja @@ -46,11 +46,12 @@