1818 name : Upgrade stubs with stubsabot
1919 if : github.repository == 'python/typeshed'
2020 runs-on : ubuntu-latest
21+ outputs :
22+ STUBS : ${{ steps.runstubsabot.outputs.STUBS }}
2123 steps :
2224 - uses : actions/checkout@v5
2325 with :
@@ -37,14 +39,81 @@ jobs:
3739 - name : Install dependencies
3840 run : uv pip install -r requirements-tests.txt --system
3941 - name : Run stubsabot
40- run : GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} python scripts/stubsabot.py --action-level everything
42+ id : runstubsabot
43+ run : |
44+ GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} python scripts/stubsabot.py --action-level everything
45+ echo "Stubs that should be tested by stubtest: $STUBS"
46+ echo "STUBS=$STUBS" >> $GITHUB_OUTPUT
47+
48+ stubtest-third-party :
49+ name : " stubtest: third party"
50+ if : github.repository == 'python/typeshed'
51+ runs-on : ${{ matrix.os }}
52+ needs : [stubsabot]
53+ strategy :
54+ matrix :
55+ os : ["ubuntu-latest", "windows-latest", "macos-latest"]
56+ fail-fast : false
57+ env :
58+ STUBS : ${{ needs.stubsabot.outputs.STUBS }}
59+ steps :
60+ - uses : actions/checkout@v5
61+ with :
62+ fetch-depth : 0
63+ - uses : actions/setup-python@v6
64+ with :
65+ python-version : " 3.13"
66+ cache : pip
67+ cache-dependency-path : |
68+ requirements-tests.txt
69+ stubs/**/METADATA.toml
70+ - name : Install dependencies
71+ run : pip install -r requirements-tests.txt
72+ - name : Install required system packages
73+ shell : bash
74+ run : |
75+ if [ -n "$STUBS" ]; then
76+ PACKAGES=$(python tests/get_stubtest_system_requirements.py $STUBS)
77+ if [ "${{ runner.os }}" = "Linux" ]; then
78+ if [ -n "$PACKAGES" ]; then
79+ printf "Installing APT packages:\n $(echo $PACKAGES | sed 's/ /\n /g')\n"
80+ sudo apt-get update -q && sudo apt-get install -qy $PACKAGES
81+ fi
82+ else
83+ if [ "${{ runner.os }}" = "macOS" ] && [ -n "$PACKAGES" ]; then
84+ printf "Installing Homebrew packages:\n $(echo $PACKAGES | sed 's/ /\n /g')\n"
85+ brew install -q $PACKAGES
86+ fi
87+
88+ if [ "${{ runner.os }}" = "Windows" ] && [ -n "$PACKAGES" ]; then
89+ printf "Installing Chocolatey packages:\n $(echo $PACKAGES | sed 's/ /\n /g')\n"
90+ choco install -y $PACKAGES
91+ fi
92+ fi
93+ fi
94+ - name : Run stubtest
95+ shell : bash
96+ run : |
97+ if [ -n "$STUBS" ]; then
98+ echo "Testing $STUBS..."
99+
100+ if [ "${{ runner.os }}" = "Linux" ]; then
101+ PYTHON_EXECUTABLE="xvfb-run python"
102+ else
103+ PYTHON_EXECUTABLE="python"
104+ fi
105+
106+ $PYTHON_EXECUTABLE tests/stubtest_third_party.py --ci-platforms-only $STUBS
107+ else
108+ echo "Nothing to test"
109+ fi
41110
42111 # https://github.community/t/run-github-actions-job-only-if-previous-job-has-failed/174786/2
43112 create-issue-on-failure :
44113 name : Create issue on failure
45114 runs-on : ubuntu-latest
46- needs : [stubsabot]
47- if : ${{ github.repository == 'python/typeshed' && always() && (needs.stubsabot.result == 'failure') }}
115+ needs : [stubsabot, stubtest-third-party ]
116+ if : ${{ github.repository == 'python/typeshed' && always() && (needs.stubsabot.result == 'failure' || needs.stubtest-third-party.result == 'failure' ) }}
48117 steps :
49118 - uses : actions/github-script@v8
50119 with :
0 commit comments