Skip to content

Commit b0be88c

Browse files
AlexWaygoodJelleZijlstrasrittau
committed
Add a cron job for testing third-party users of typing_extensions (#206)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com> Co-authored-by: Sebastian Rittau <srittau@rittau.biz>
1 parent 32887d3 commit b0be88c

File tree

2 files changed

+379
-0
lines changed

2 files changed

+379
-0
lines changed

.github/workflows/ci.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
name: Test and lint
22

33
on:
4+
schedule:
5+
- cron: "0 2 * * *" # 2am UTC
46
push:
57
branches:
68
- main
@@ -21,6 +23,14 @@ jobs:
2123
tests:
2224
name: Run tests
2325

26+
if: >-
27+
# if 'schedule' was the trigger,
28+
# don't run it on contributors' forks
29+
${{
30+
github.repository == 'python/typing_extensions'
31+
|| github.event_name != 'schedule'
32+
}}
33+
2434
strategy:
2535
fail-fast: false
2636
matrix:
@@ -52,6 +62,9 @@ jobs:
5262
linting:
5363
name: Lint
5464

65+
# no reason to run this as a cron job
66+
if: github.event_name != 'schedule'
67+
5568
runs-on: ubuntu-latest
5669

5770
steps:
@@ -75,3 +88,32 @@ jobs:
7588

7689
- name: Lint tests
7790
run: flake8 --config=.flake8-tests src/test_typing_extensions.py --color always
91+
92+
create-issue-on-failure:
93+
name: Create an issue if daily tests failed
94+
runs-on: ubuntu-latest
95+
96+
needs: [tests]
97+
98+
if: >-
99+
${{
100+
github.repository == 'python/typing_extensions'
101+
&& always()
102+
&& github.event_name == 'schedule'
103+
&& needs.tests.result == 'failure'
104+
}}
105+
106+
permissions:
107+
issues: write
108+
109+
steps:
110+
- uses: actions/github-script@v6
111+
with:
112+
github-token: ${{ secrets.GITHUB_TOKEN }}
113+
script: |
114+
await github.rest.issues.create({
115+
owner: "python",
116+
repo: "typing_extensions",
117+
title: `Daily tests failed on ${new Date().toDateString()}`,
118+
body: "Runs listed here: https://github.com/python/typing_extensions/actions/workflows/ci.yml",
119+
})

0 commit comments

Comments
 (0)