Skip to content

Run property based tests with Hypothesis #355

Run property based tests with Hypothesis

Run property based tests with Hypothesis #355

name: Run property based tests with Hypothesis
on:
schedule:
- cron: 0 20 * * *
workflow_dispatch:
permissions:
contents: read
env:
DAFT_ANALYTICS_ENABLED: "0"
jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 45
strategy:
fail-fast: false
matrix:
python-version: ["3.10"]
daft_runner: [ray, native]
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: ./.github/actions/restore-mtime
- uses: moonrepo/setup-rust@v1
with:
cache: false
- uses: Swatinem/rust-cache@v2
with:
shared-key: ${{ runner.os }}-integration-build
cache-all-crates: "true"
cache-workspace-crates: "true"
save-if: ${{ github.ref == 'refs/heads/main' }}
- name: Setup Python ${{ matrix.python-version }} and UV
uses: astral-sh/setup-uv@v7
with:
python-version: ${{ matrix.python-version }}
enable-cache: true
cache-dependency-glob: "**/pyproject.toml"
- name: Setup Virtual Env
run: |
uv venv --seed .venv
echo "$GITHUB_WORKSPACE/.venv/bin" >> $GITHUB_PATH
- name: Install dependencies
run: |
uv sync --no-install-project --all-extras --all-groups
- uses: actions/setup-node@v6
with:
node-version: "22"
cache: "npm"
cache-dependency-path: src/daft-dashboard/frontend/package-lock.json
- name: Build dashboard
working-directory: ./src/daft-dashboard/frontend
run: |
npm ci
npm run build
- name: Build Rust Library
run: |
source activate
maturin develop --uv --release
- name: Run Hypothesis property based tests
run: source activate; pytest -n auto tests/property_based_testing -m 'hypothesis' --hypothesis-seed=0
env:
DAFT_RUNNER: ${{ matrix.daft_runner }}
HYPOTHESIS_MAX_EXAMPLES: 10000
- name: Send Slack notification on failure
uses: slackapi/[email protected]
if: ${{ env.SLACK_WEBHOOK_URL && failure() && (github.ref == 'refs/heads/main') }}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
with:
payload: |
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": ":rotating_light: [NIGHTLY] Property-Based Tests <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|workflow> *FAILED* :rotating_light:"
}
}
]
}
webhook: ${{ env.SLACK_WEBHOOK_URL }}
webhook-type: incoming-webhook