Skip to content

Commit 2383871

Browse files
authored
Run tests on schedule (#27)
Signed-off-by: Federico Busetti <[email protected]>
1 parent 29b1cff commit 2383871

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

.github/workflows/python-tests.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,16 @@ on:
88
branches: [ "main" ]
99
pull_request:
1010
branches: [ "main" ]
11+
# Run tests on Friday to check if tests pass with updated dependencies
12+
schedule:
13+
- cron: '0 0 * * 5'
1114
# Allows you to run this workflow manually from the Actions tab
1215
workflow_dispatch:
1316

1417
jobs:
1518
test:
1619
strategy:
20+
fail-fast: false
1721
matrix:
1822
version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
1923
os: [ubuntu-latest]
@@ -31,5 +35,49 @@ jobs:
3135
poetry config virtualenvs.create false
3236
poetry install --no-root --with dev
3337
- name: Test with pytest
38+
id: citest
3439
run: |
3540
make ci-test
41+
42+
failure-notification:
43+
runs-on: ubuntu-latest
44+
needs: test
45+
if: failure() && github.event.schedule == '0 0 * * 5'
46+
permissions:
47+
issues: write
48+
steps:
49+
- uses: actions/checkout@v4
50+
- name: Create label if not exists
51+
run: |
52+
gh label create scheduled-failure --force --color B60205
53+
env:
54+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
55+
56+
- name: Opens an issue if not already existing and open
57+
run: |
58+
previous_issue_number=$(gh issue list \
59+
--label "$LABELS" \
60+
--json number \
61+
--jq '.[0].number')
62+
if [[ -n $previous_issue_number ]]; then
63+
gh issue edit "$previous_issue_number" --body "$BODY"
64+
else
65+
new_issue_url=$(gh issue create \
66+
--title "$TITLE" \
67+
--label "$LABELS" \
68+
--body "$BODY")
69+
if [[ $PINNED == true ]]; then
70+
gh issue pin "$new_issue_url"
71+
fi
72+
fi
73+
env:
74+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
75+
GH_REPO: ${{ github.repository }}
76+
TITLE: Scheduled automated test failure
77+
LABELS: scheduled-failure
78+
BODY: |
79+
### Test suite failed during scheduled run
80+
81+
[Link to failing run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
82+
83+
PINNED: false

0 commit comments

Comments
 (0)