mirror of
https://github.com/apache/superset.git
synced 2026-07-28 17:42:40 +00:00
Compare commits
3 Commits
feat/publi
...
spike/prek
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4a8f4f0edc | ||
|
|
a47a32469d | ||
|
|
f30276c8b5 |
32
.github/workflows/pre-commit.yml
vendored
32
.github/workflows/pre-commit.yml
vendored
@@ -52,6 +52,16 @@ jobs:
|
||||
- name: Install helm-docs
|
||||
run: go install github.com/norwoodj/helm-docs/cmd/helm-docs@v1.14.2
|
||||
|
||||
# Spike: run the existing .pre-commit-config.yaml through prek (a Rust
|
||||
# reimplementation of pre-commit) instead of pre-commit itself, to see
|
||||
# whether it's viable to speed up this job. CI-only — contributors keep
|
||||
# installing/running `pre-commit` locally exactly as documented; nothing
|
||||
# here changes that.
|
||||
- name: Install prek
|
||||
run: |
|
||||
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/j178/prek/releases/download/v0.4.11/prek-installer.sh | sh
|
||||
echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
|
||||
with:
|
||||
@@ -69,13 +79,13 @@ jobs:
|
||||
cd docs
|
||||
yarn install --immutable
|
||||
|
||||
- name: Cache pre-commit environments
|
||||
- name: Cache prek environments
|
||||
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
||||
with:
|
||||
path: ~/.cache/pre-commit
|
||||
key: pre-commit-v2-${{ runner.os }}-py${{ matrix.python-version }}-${{ hashFiles('.pre-commit-config.yaml') }}
|
||||
path: ~/.cache/prek
|
||||
key: prek-v1-${{ runner.os }}-py${{ matrix.python-version }}-${{ hashFiles('.pre-commit-config.yaml') }}
|
||||
restore-keys: |
|
||||
pre-commit-v2-${{ runner.os }}-py${{ matrix.python-version }}-
|
||||
prek-v1-${{ runner.os }}-py${{ matrix.python-version }}-
|
||||
|
||||
- name: Determine changed files
|
||||
id: changed_files
|
||||
@@ -141,7 +151,7 @@ jobs:
|
||||
} >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
|
||||
- name: pre-commit
|
||||
- name: pre-commit (via prek)
|
||||
env:
|
||||
MODE: ${{ steps.changed_files.outputs.mode }}
|
||||
CHANGED_FILES: ${{ steps.changed_files.outputs.files }}
|
||||
@@ -151,22 +161,22 @@ jobs:
|
||||
|
||||
case "${MODE}" in
|
||||
all)
|
||||
echo "ℹ️ Running pre-commit on all files."
|
||||
pre-commit run --all-files
|
||||
echo "ℹ️ Running prek on all files."
|
||||
prek run --all-files
|
||||
;;
|
||||
files)
|
||||
echo "ℹ️ Running pre-commit on changed files:"
|
||||
echo "ℹ️ Running prek on changed files:"
|
||||
echo "${CHANGED_FILES}"
|
||||
# shellcheck disable=SC2086
|
||||
pre-commit run --files ${CHANGED_FILES}
|
||||
prek run --files ${CHANGED_FILES}
|
||||
;;
|
||||
none)
|
||||
echo "ℹ️ No source files changed; nothing for pre-commit to check."
|
||||
echo "ℹ️ No source files changed; nothing for prek to check."
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
echo "⚠️ Unrecognized changed-files mode '${MODE}'; checking all files."
|
||||
pre-commit run --all-files
|
||||
prek run --all-files
|
||||
;;
|
||||
esac
|
||||
PRE_COMMIT_EXIT_CODE=$?
|
||||
|
||||
@@ -1,65 +0,0 @@
|
||||
name: Python Unit Test Results
|
||||
|
||||
on:
|
||||
# zizmor: ignore[dangerous-triggers] - runs in base-branch context and only consumes artifacts uploaded by Python-Unit; never checks out PR code (see note below)
|
||||
workflow_run:
|
||||
workflows: ["Python-Unit"]
|
||||
types: [completed]
|
||||
|
||||
# This workflow publishes a check run annotating failing Python unit tests
|
||||
# inline on the PR diff, using JUnit XML uploaded by the Python-Unit workflow.
|
||||
# It uses the workflow_run trigger so that it always runs in the base-branch
|
||||
# context and can safely be granted write permissions, even for PRs from
|
||||
# forks or Dependabot.
|
||||
#
|
||||
# IMPORTANT: This workflow must NEVER check out code from the PR branch. All
|
||||
# data comes from artifacts uploaded by the Python-Unit workflow.
|
||||
permissions:
|
||||
contents: read
|
||||
checks: write
|
||||
issues: read
|
||||
actions: read
|
||||
|
||||
jobs:
|
||||
report:
|
||||
runs-on: ubuntu-26.04
|
||||
timeout-minutes: 10
|
||||
if: >
|
||||
github.event.workflow_run.conclusion == 'success' ||
|
||||
github.event.workflow_run.conclusion == 'failure'
|
||||
steps:
|
||||
# Fails soft (continue-on-error) because the source unit-tests job is
|
||||
# itself gated on change detection: a docs-only PR skips it entirely,
|
||||
# so there is nothing to download or report on.
|
||||
- name: Download JUnit results
|
||||
id: download
|
||||
continue-on-error: true
|
||||
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
|
||||
with:
|
||||
pattern: "junit-results-*"
|
||||
path: artifacts
|
||||
merge-multiple: true
|
||||
run-id: ${{ github.event.workflow_run.id }}
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Download event file
|
||||
id: download-event
|
||||
if: steps.download.outcome == 'success'
|
||||
continue-on-error: true
|
||||
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
|
||||
with:
|
||||
name: "Event File"
|
||||
path: event
|
||||
run-id: ${{ github.event.workflow_run.id }}
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Publish test results
|
||||
if: steps.download.outcome == 'success' && steps.download-event.outcome == 'success'
|
||||
uses: EnricoMi/publish-unit-test-result-action@d0a4676d0e0b938bc201470d88276b7c74c712b3 # v2.24.0
|
||||
with:
|
||||
commit: ${{ github.event.workflow_run.head_sha }}
|
||||
event_file: event/event.json
|
||||
event_name: ${{ github.event.workflow_run.event }}
|
||||
files: "artifacts/**/*.xml"
|
||||
check_name: "Python Unit Test Results"
|
||||
comment_mode: "off"
|
||||
33
.github/workflows/superset-python-unittest.yml
vendored
33
.github/workflows/superset-python-unittest.yml
vendored
@@ -74,14 +74,14 @@ jobs:
|
||||
SUPERSET_TESTENV: true
|
||||
SUPERSET_SECRET_KEY: not-a-secret
|
||||
run: |
|
||||
pytest --durations-min=0.5 --cov-report= --cov=superset ./tests/common ./tests/unit_tests --cache-clear --maxfail=50 --junit-xml=test-results/junit-unit.xml
|
||||
pytest --durations-min=0.5 --cov-report= --cov=superset ./tests/common ./tests/unit_tests --cache-clear --maxfail=50
|
||||
- name: Python 100% coverage unit tests
|
||||
env:
|
||||
SUPERSET_TESTENV: true
|
||||
SUPERSET_SECRET_KEY: not-a-secret
|
||||
run: |
|
||||
pytest --durations-min=0.5 --cov=superset/sql/ ./tests/unit_tests/sql/ --cache-clear --cov-fail-under=100 --junit-xml=test-results/junit-sql-coverage.xml
|
||||
pytest --durations-min=0.5 --cov=superset/semantic_layers/ ./tests/unit_tests/semantic_layers/ --cache-clear --cov-fail-under=100 --junit-xml=test-results/junit-semantic-layers-coverage.xml
|
||||
pytest --durations-min=0.5 --cov=superset/sql/ ./tests/unit_tests/sql/ --cache-clear --cov-fail-under=100
|
||||
pytest --durations-min=0.5 --cov=superset/semantic_layers/ ./tests/unit_tests/semantic_layers/ --cache-clear --cov-fail-under=100
|
||||
- name: Upload code coverage
|
||||
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
|
||||
with:
|
||||
@@ -89,33 +89,6 @@ jobs:
|
||||
verbose: true
|
||||
use_oidc: true
|
||||
slug: apache/superset
|
||||
# Uploaded even when a pytest step above fails, since that is exactly
|
||||
# when the JUnit results are needed downstream, to annotate the PR with
|
||||
# the failing tests. Consumed by the "Python Unit Test Results" workflow
|
||||
# via workflow_run (see that workflow for why it can't just be a step
|
||||
# here: it needs to run with write permissions, which this PR-triggered
|
||||
# job can't safely have on a fork PR).
|
||||
- name: Upload JUnit test results
|
||||
if: always()
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
|
||||
with:
|
||||
name: junit-results-${{ matrix.python-version }}
|
||||
path: test-results/
|
||||
retention-days: 7
|
||||
|
||||
# Uploads the raw pull_request event payload so the "Python Unit Test
|
||||
# Results" workflow (running via workflow_run, in base-branch context) can
|
||||
# look up which PR/commit to annotate without checking out untrusted code.
|
||||
event-file:
|
||||
runs-on: ubuntu-26.04
|
||||
timeout-minutes: 5
|
||||
steps:
|
||||
- name: Upload event file
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
|
||||
with:
|
||||
name: Event File
|
||||
path: ${{ github.event_path }}
|
||||
retention-days: 7
|
||||
|
||||
# Stable required-status-check anchor. `unit-tests` is a matrix job gated on
|
||||
# change detection, so on non-Python PRs it is skipped and never produces its
|
||||
|
||||
Reference in New Issue
Block a user