Run property based tests with Hypothesis #67
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Run property based tests with Hypothesis | |
on: | |
schedule: | |
- cron: 0 20 * * * | |
workflow_dispatch: | |
env: | |
DAFT_ANALYTICS_ENABLED: '0' | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ['3.7'] | |
daft_runner: [py] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: moonrepo/setup-rust@v1 | |
with: | |
cache: false | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
key: ${{ runner.os }}-build | |
cache-all-crates: 'true' | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Setup Virtual Env | |
run: | | |
python -m venv venv | |
echo "$GITHUB_WORKSPACE/venv/bin" >> $GITHUB_PATH | |
- name: Install dependencies | |
run: | | |
pip install --upgrade pip | |
pip install -r requirements-dev.txt | |
- name: Build Rust Library | |
run: | | |
source activate | |
maturin develop --release | |
- name: Run Hypothesis property based tests | |
run: pytest 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: failure() | |
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:" | |
} | |
} | |
] | |
} | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK |