File: hypothesis.yaml

package info (click to toggle)
zarr 3.1.5-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,068 kB
  • sloc: python: 31,589; makefile: 10
file content (94 lines) | stat: -rw-r--r-- 3,110 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
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

env:
  FORCE_COLOR: 3

jobs:

  hypothesis:
    name: Slow Hypothesis Tests
    runs-on: "ubuntu-latest"
    defaults:
      run:
        shell: bash -l {0}

    strategy:
      matrix:
        python-version: ['3.12']
        numpy-version: ['2.2']
        dependency-set: ["optional"]

    steps:
    - uses: actions/checkout@v5
    - name: Set HYPOTHESIS_PROFILE based on trigger
      run: |
        if [[ "${{ github.event_name }}" == "schedule" || "${{ github.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@v6
      with:
        python-version: ${{ matrix.python-version }}
        cache: 'pip'
    - name: Install Hatch
      run: |
        python -m pip install --upgrade pip
        pip install hatch
    - name: Set Up Hatch Env
      run: |
        hatch env create test.py${{ matrix.python-version }}-${{ matrix.numpy-version }}-${{ matrix.dependency-set }}
        hatch env run -e test.py${{ matrix.python-version }}-${{ matrix.numpy-version }}-${{ matrix.dependency-set }} 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@v4
      with:
        path: .hypothesis/
        key: cache-hypothesis-${{ runner.os }}-${{ github.run_id }}
        restore-keys: |
          cache-hypothesis-

    - name: Run slow Hypothesis tests
      if: success()
      id: status
      run: |
        echo "Using Hypothesis profile: $HYPOTHESIS_PROFILE"
        hatch env run --env test.py${{ matrix.python-version }}-${{ matrix.numpy-version }}-${{ matrix.dependency-set }} 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@v4
      with:
        path: .hypothesis/
        key: cache-hypothesis-${{ runner.os }}-${{ github.run_id }}

    - name: Upload coverage
      uses: codecov/codecov-action@v5
      with:
        token: ${{ secrets.CODECOV_TOKEN }}
        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@v1
      with:
        log-path: output-${{ matrix.python-version }}-log.jsonl
        issue-title: "Nightly Hypothesis tests failed"
        issue-label: "topic-hypothesis"