Skip to content

Commit

Permalink
Add a cron job for testing third-party users of typing_extensions (#206)
Browse files Browse the repository at this point in the history
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Sebastian Rittau <srittau@rittau.biz>
  • Loading branch information
3 people committed Jun 1, 2023
1 parent 32887d3 commit b0be88c
Show file tree
Hide file tree
Showing 2 changed files with 379 additions and 0 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
name: Test and lint

on:
schedule:
- cron: "0 2 * * *" # 2am UTC
push:
branches:
- main
Expand All @@ -21,6 +23,14 @@ jobs:
tests:
name: Run tests

if: >-
# if 'schedule' was the trigger,
# don't run it on contributors' forks
${{
github.repository == 'python/typing_extensions'
|| github.event_name != 'schedule'
}}
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -52,6 +62,9 @@ jobs:
linting:
name: Lint

# no reason to run this as a cron job
if: github.event_name != 'schedule'

runs-on: ubuntu-latest

steps:
Expand All @@ -75,3 +88,32 @@ jobs:

- name: Lint tests
run: flake8 --config=.flake8-tests src/test_typing_extensions.py --color always

create-issue-on-failure:
name: Create an issue if daily tests failed
runs-on: ubuntu-latest

needs: [tests]

if: >-
${{
github.repository == 'python/typing_extensions'
&& always()
&& github.event_name == 'schedule'
&& needs.tests.result == 'failure'
}}
permissions:
issues: write

steps:
- uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
await github.rest.issues.create({
owner: "python",
repo: "typing_extensions",
title: `Daily tests failed on ${new Date().toDateString()}`,
body: "Runs listed here: https://github.com/python/typing_extensions/actions/workflows/ci.yml",
})

0 comments on commit b0be88c

Please sign in to comment.