66 - main
77 pull_request :
88 workflow_dispatch :
9+ schedule :
10+ - cron : " 0 12 * * *"
911
1012permissions :
1113 contents : read
1416 FORCE_COLOR : 1 # Request colored output from CLI tools supporting it
1517 CLICOLOR_FORCE : 1 # recognized by uv
1618 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
19+ DEFAULT_PYTHON_VERSION : " 3.13" # Default Python version for uvx
1720
1821concurrency :
1922 group : ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
2023 cancel-in-progress : true
2124
2225jobs :
23- check :
24- name : Check
26+ stdlib :
27+ name : Check typeshed stdlib
2528 runs-on : ${{ matrix.platform }}
2629 strategy :
2730 fail-fast : false
3942 - name : Check a basic run doesn't fail
4043 run : uvx --python=${{ matrix.python-version }} --force-reinstall --from=./docstring-adder add-docstrings --stdlib-path ./typeshed/stdlib
4144 - name : Check typeshed's mypy_test.py passes
42- run : uv run --directory=typeshed --no-project --python=3.13 --with-requirements=requirements-tests.txt python tests/mypy_test.py stdlib -p "${{ matrix.python-version }}"
45+ run : uv run --directory=typeshed --no-project --python="${DEFAULT_PYTHON_VERSION}" --with-requirements=requirements-tests.txt python tests/mypy_test.py stdlib -p "${{ matrix.python-version }}"
4346 - name : Check running it again doesn't produce any changes
4447 # Some weird thing with distutils means that it does actually add docstrings
4548 # when run the second time that it didn't add when run the first time.
@@ -51,10 +54,62 @@ jobs:
5154 cd typeshed
5255 git config --global user.email "you@example.com"
5356 git config --global user.name "Your Name"
57+ test -n "$(git status --porcelain)"
5458 git commit -am "."
5559 uvx --python=${{ matrix.python-version }} --force-reinstall --from=../docstring-adder add-docstrings --stdlib-path ./stdlib
5660 test -z "$(git status --porcelain)"
5761
62+ typeshed-third-party :
63+ name : Check typeshed third-party stubs
64+ runs-on : ubuntu-latest
65+ steps :
66+ - uses : actions/checkout@v4
67+ with :
68+ path : docstring-adder
69+ persist-credentials : false
70+ - name : Checkout typeshed
71+ run : git clone --depth=1 https://github.com/python/typeshed.git || git clone --depth=1 https://github.com/python/typeshed.git
72+ - uses : astral-sh/setup-uv@v6
73+ - name : Check a basic run doesn't fail
74+ run : uvx --python="${DEFAULT_PYTHON_VERSION}" python ./docstring-adder/.github/scripts/typeshed_third_party.py --typeshed-dir ./typeshed --docstring-adder-dir ./docstring-adder
75+ - name : Check typeshed's mypy_test.py passes
76+ run : uv run --directory=typeshed --no-project --python="${DEFAULT_PYTHON_VERSION}" --with-requirements=requirements-tests.txt python tests/mypy_test.py stubs
77+ - name : Check running it again doesn't produce any changes
78+ shell : bash
79+ run : |
80+ git config --global user.email "you@example.com"
81+ git config --global user.name "Your Name"
82+ cd typeshed
83+ test -n "$(git status --porcelain)"
84+ git commit -am "."
85+ uvx --python="${DEFAULT_PYTHON_VERSION}" python ../docstring-adder/.github/scripts/typeshed_third_party.py --typeshed-dir . --docstring-adder-dir ../docstring-adder
86+ test -z "$(git status --porcelain)"
87+
88+ # A fairly arbitrary check, but it's good to enforce that it works on a non-typeshed stubs package.
89+ pandas-stubs :
90+ name : Check running on pandas-stubs
91+ runs-on : ubuntu-latest
92+ steps :
93+ - uses : actions/checkout@v4
94+ with :
95+ path : docstring-adder
96+ persist-credentials : false
97+ - name : Checkout typeshed
98+ run : git clone --depth=1 https://github.com/pandas-dev/pandas-stubs.git || git clone --depth=1 https://github.com/pandas-dev/pandas-stubs.git
99+ - uses : astral-sh/setup-uv@v6
100+ - name : Check a basic run doesn't fail
101+ run : uvx --python="${DEFAULT_PYTHON_VERSION}" --force-reinstall --with=pandas --from=./docstring-adder add-docstrings --packages ./pandas-stubs
102+ - name : Check running it again doesn't produce any changes
103+ shell : bash
104+ run : |
105+ git config --global user.email "you@example.com"
106+ git config --global user.name "Your Name"
107+ cd pandas-stubs
108+ test -n "$(git status --porcelain)"
109+ git commit -am "."
110+ uvx --python="${DEFAULT_PYTHON_VERSION}" --force-reinstall --with=pandas --from=../docstring-adder add-docstrings --packages .
111+ test -z "$(git status --porcelain)"
112+
58113 mypy :
59114 name : Run mypy
60115 runs-on : ubuntu-latest
@@ -73,3 +128,28 @@ jobs:
73128 persist-credentials : false
74129 - uses : actions/setup-python@v5
75130 - uses : pre-commit/action@v3.0.1
131+
132+ create-issue-on-failure :
133+ name : Create an issue if the daily test run failed
134+ runs-on : ubuntu-latest
135+ needs :
136+ - stdlib
137+ - typeshed-third-party
138+ - mypy
139+ - pre-commit
140+ - pandas-stubs
141+ if : ${{ github.repository == 'astral-sh/docstring-adder' && always() && github.event_name == 'schedule' && ((needs.stdlib.result == 'failure') || (needs.typeshed-third-party.result == 'failure') || (needs.mypy.result == 'failure') || (needs.pre-commit.result == 'failure') || (needs.pandas-stubs.result == 'failure')) }}
142+ permissions :
143+ issues : write
144+ steps :
145+ - uses : actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
146+ with :
147+ github-token : ${{ secrets.GITHUB_TOKEN }}
148+ script : |
149+ await github.rest.issues.create({
150+ owner: "astral-sh",
151+ repo: "docstring-adder",
152+ title: `Daily test run failed on ${new Date().toDateString()}`,
153+ body: "Run listed here: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}",
154+ labels: ["bug"],
155+ })
0 commit comments