Daily test #2196
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: Daily test | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: "0 0 * * *" | |
| pull_request: | |
| paths: | |
| - "requirements-tests.txt" | |
| - ".github/workflows/daily.yml" | |
| # Please keep the permissions minimal, as stubtest runs arbitrary code from pypi. | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
| cancel-in-progress: true | |
| env: | |
| # A few env vars to speedup brew install | |
| HOMEBREW_NO_ANALYTICS: 1 | |
| HOMEBREW_NO_AUTOUPDATE: 1 | |
| HOMEBREW_NO_INSTALL_CLEANUP: 1 # Environments are isolated, no need to cleanup old versions | |
| NONINTERACTIVE: 1 # Required for brew install on CI | |
| PIP_DISABLE_PIP_VERSION_CHECK: 1 | |
| FORCE_COLOR: 1 | |
| TERM: xterm-256color # needed for FORCE_COLOR to work on mypy on Ubuntu, see https://github.com/python/mypy/issues/13817 | |
| jobs: | |
| stubtest-stdlib: | |
| name: "stubtest: stdlib" | |
| if: ${{ github.repository == 'python/typeshed' || github.event_name != 'schedule' }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: ["ubuntu-latest", "windows-latest", "macos-latest"] | |
| python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"] | |
| fail-fast: false | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Set up Python ${{ matrix.python-version }} on ${{ matrix.os }} | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: pip | |
| cache-dependency-path: requirements-tests.txt | |
| allow-prereleases: true | |
| check-latest: true | |
| - name: Install dependencies | |
| run: pip install -r requirements-tests.txt | |
| - name: Run stubtest | |
| run: python tests/stubtest_stdlib.py | |
| stubtest-third-party: | |
| name: "stubtest: third party" | |
| if: ${{ github.repository == 'python/typeshed' || github.event_name != 'schedule' }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: ["ubuntu-latest", "windows-latest", "macos-latest"] | |
| shard-index: [0, 1, 2, 3] | |
| fail-fast: false | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.13" | |
| cache: pip | |
| cache-dependency-path: | | |
| requirements-tests.txt | |
| stubs/**/METADATA.toml | |
| - name: Install dependencies | |
| run: pip install -r requirements-tests.txt | |
| - name: Install required system packages | |
| shell: bash | |
| run: | | |
| PACKAGES=$(python tests/get_stubtest_system_requirements.py) | |
| if [ "${{ runner.os }}" = "Linux" ]; then | |
| if [ -n "$PACKAGES" ]; then | |
| printf "Installing APT packages:\n $(echo $PACKAGES | sed 's/ /\n /g')\n" | |
| sudo apt-get update -q && sudo apt-get install -qy $PACKAGES | |
| fi | |
| else | |
| if [ "${{ runner.os }}" = "macOS" ] && [ -n "$PACKAGES" ]; then | |
| printf "Installing Homebrew packages:\n $(echo $PACKAGES | sed 's/ /\n /g')\n" | |
| brew install -q $PACKAGES | |
| fi | |
| if [ "${{ runner.os }}" = "Windows" ] && [ -n "$PACKAGES" ]; then | |
| printf "Installing Chocolatey packages:\n $(echo $PACKAGES | sed 's/ /\n /g')\n" | |
| choco install -y $PACKAGES | |
| fi | |
| fi | |
| - name: Run stubtest | |
| shell: bash | |
| run: | | |
| if [ "${{ runner.os }}" = "Linux" ]; then | |
| PYTHON_EXECUTABLE="xvfb-run python" | |
| else | |
| PYTHON_EXECUTABLE="python" | |
| fi | |
| $PYTHON_EXECUTABLE tests/stubtest_third_party.py --ci-platforms-only --num-shards 4 --shard-index ${{ matrix.shard-index }} | |
| stub-uploader: | |
| name: stub_uploader tests | |
| if: ${{ github.repository == 'python/typeshed' || github.event_name != 'schedule' }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout typeshed | |
| uses: actions/checkout@v5 | |
| with: | |
| path: typeshed | |
| - name: Checkout stub_uploader | |
| uses: actions/checkout@v5 | |
| with: | |
| repository: typeshed-internal/stub_uploader | |
| path: stub_uploader | |
| - uses: actions/setup-python@v6 | |
| with: | |
| # Keep in sync with stub_uploader's check_scripts.yml workflow. | |
| python-version: "3.13" | |
| - uses: astral-sh/setup-uv@v6 | |
| with: | |
| version-file: "typeshed/requirements-tests.txt" | |
| - name: Run tests | |
| run: | | |
| cd stub_uploader | |
| uv pip install -r requirements.txt --system | |
| python -m pytest tests | |
| # https://github.community/t/run-github-actions-job-only-if-previous-job-has-failed/174786/2 | |
| create-issue-on-failure: | |
| name: Create issue on failure | |
| runs-on: ubuntu-latest | |
| needs: [stubtest-stdlib, stubtest-third-party, stub-uploader] | |
| if: ${{ github.repository == 'python/typeshed' && always() && github.event_name == 'schedule' && (needs.stubtest-stdlib.result == 'failure' || needs.stubtest-third-party.result == 'failure' || needs.stub-uploader.result == 'failure') }} | |
| permissions: | |
| issues: write | |
| steps: | |
| - uses: actions/github-script@v8 | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| script: | | |
| await github.rest.issues.create({ | |
| owner: "python", | |
| repo: "typeshed", | |
| title: `Daily tests failed on ${new Date().toDateString()}`, | |
| body: "Run listed here: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}", | |
| labels: ["help wanted"], | |
| }) |