test: add property tests for block and mask indexing (#4054) #7969
This file contains hidden or 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: Slow Hypothesis CI | |
| on: | |
| push: | |
| branches: [main, 3.1.x] | |
| pull_request: | |
| branches: [main, 3.1.x] | |
| types: [opened, reopened, synchronize, labeled] | |
| schedule: | |
| - cron: "0 0 * * *" # Daily “At 00:00” UTC | |
| workflow_dispatch: # allows you to trigger manually | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| FORCE_COLOR: 3 | |
| # Use the uv from astral-sh/setup-uv instead of hatch's bundled (pyapp) uv. | |
| HATCH_ENV_TYPE_VIRTUAL_UV_PATH: uv | |
| jobs: | |
| hypothesis: | |
| name: Slow Hypothesis Tests | |
| environment: | |
| name: codecov-upload | |
| deployment: false | |
| runs-on: "ubuntu-latest" | |
| defaults: | |
| run: | |
| shell: bash -l {0} | |
| strategy: | |
| matrix: | |
| python-version: ['3.12'] | |
| dependency-set: ["optional"] | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| persist-credentials: false | |
| - name: Set HYPOTHESIS_PROFILE based on trigger | |
| env: | |
| EVENT_NAME: ${{ github.event_name }} | |
| run: | | |
| if [[ "$EVENT_NAME" == "schedule" || "$EVENT_NAME" == "workflow_dispatch" ]]; then | |
| echo "HYPOTHESIS_PROFILE=nightly" >> $GITHUB_ENV | |
| else | |
| echo "HYPOTHESIS_PROFILE=ci" >> $GITHUB_ENV | |
| fi | |
| - name: Set up Python | |
| uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: 'pip' | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0 | |
| - name: Install Hatch | |
| uses: pypa/hatch@257e27e51a6a5616ed08a39a408a21c35c9931bc | |
| with: | |
| version: '1.16.5' | |
| - name: Set Up Hatch Env | |
| env: | |
| HATCH_ENV: test.py${{ matrix.python-version }}-${{ matrix.dependency-set }} | |
| run: | | |
| hatch env create "$HATCH_ENV" | |
| hatch env run -e "$HATCH_ENV" list-env | |
| # https://github.com/actions/cache/blob/main/tips-and-workarounds.md#update-a-cache | |
| - name: Restore cached hypothesis directory | |
| id: restore-hypothesis-cache | |
| uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 | |
| with: | |
| path: .hypothesis/ | |
| key: cache-hypothesis-${{ runner.os }}-${{ github.run_id }} | |
| restore-keys: | | |
| cache-hypothesis- | |
| - name: Run slow Hypothesis tests | |
| if: success() | |
| id: status | |
| env: | |
| HATCH_ENV: test.py${{ matrix.python-version }}-${{ matrix.dependency-set }} | |
| run: | | |
| echo "Using Hypothesis profile: $HYPOTHESIS_PROFILE" | |
| hatch env run --env "$HATCH_ENV" run-hypothesis | |
| # explicitly save the cache so it gets updated, also do this even if it fails. | |
| - name: Save cached hypothesis directory | |
| id: save-hypothesis-cache | |
| if: always() && steps.status.outcome != 'skipped' | |
| uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 | |
| with: | |
| path: .hypothesis/ | |
| key: cache-hypothesis-${{ runner.os }}-${{ github.run_id }} | |
| - name: Upload coverage | |
| uses: codecov/codecov-action@e79a6962e0d4c0c17b229090214935d2e33f8354 # v6.0.1 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| flags: tests | |
| verbose: true # optional (default = false) | |
| - name: Generate and publish the report | |
| if: | | |
| failure() | |
| && steps.status.outcome == 'failure' | |
| && github.event_name == 'schedule' | |
| && github.repository_owner == 'zarr-developers' | |
| uses: scientific-python/issue-from-pytest-log-action@8e905db353437cda1d6a773de245343fbfc940dd # v1.5.0 | |
| with: | |
| log-path: output-${{ matrix.python-version }}-log.jsonl | |
| issue-title: "Nightly Hypothesis tests failed" | |
| issue-label: "topic-hypothesis" |