Skip to content

Commit 3814792

Browse files
committed
Add daily CI workflow with Slack notifications
- Add daily-ci.yml workflow that runs existing CI suite daily at 8AM Pacific - Reuses existing ci.yml workflow to avoid duplication - Sends Slack notifications on failure using same pattern as pybatfish - Includes manual trigger capability via workflow_dispatch - Add documentation in workflows/README.md explaining setup and usage
1 parent 562bd2d commit 3814792

2 files changed

Lines changed: 111 additions & 0 deletions

File tree

.github/workflows/README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# GitHub Actions Workflows
2+
3+
## ci.yml
4+
5+
The main continuous integration workflow that runs on pull requests and pushes to main/develop branches. It includes:
6+
7+
- Code linting with pre-commit hooks
8+
- Unit tests with coverage reporting
9+
- Lab discovery and parallel integration testing
10+
- Batfish JAR building and caching
11+
12+
## daily-ci.yml
13+
14+
A scheduled workflow that runs the full CI suite daily at 8AM Pacific time. Features:
15+
16+
- Reuses the existing `ci.yml` workflow
17+
- Runs automatically via cron schedule: `0 15 * * *` (8AM Pacific)
18+
- Can be triggered manually via `workflow_dispatch`
19+
- Sends Slack notifications to a configured channel on failure
20+
21+
### Setup Required
22+
23+
To enable Slack notifications, add the following secret to your repository:
24+
25+
- `LAB_VALIDATION_SLACK_WEBHOOK_URL`: Your Slack incoming webhook URL
26+
27+
### Notification Details
28+
29+
The Slack notification includes:
30+
31+
- Workflow name and status
32+
- Trigger type (scheduled vs manual)
33+
- Repository and commit information
34+
- Direct link to the failed workflow run

.github/workflows/daily-ci.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: Daily CI
2+
3+
on:
4+
schedule:
5+
- cron: "0 15 * * *" # 8AM Pacific; daily
6+
workflow_dispatch: # Allow manual triggering
7+
8+
jobs:
9+
# Run the existing CI workflow
10+
ci:
11+
uses: ./.github/workflows/ci.yml
12+
13+
# Send Slack notification on failure
14+
notify-slack-on-failure:
15+
needs: ci
16+
if: failure()
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Send Slack notification on failure
20+
uses: slackapi/slack-github-action@v2.1.0
21+
with:
22+
webhook: ${{ secrets.LAB_VALIDATION_SLACK_WEBHOOK_URL }}
23+
webhook-type: incoming-webhook
24+
payload: |
25+
{
26+
"text": "*Lab validation daily CI workflow failed*",
27+
"blocks": [
28+
{
29+
"type": "section",
30+
"text": {
31+
"type": "mrkdwn",
32+
"text": "*Lab validation daily CI workflow failed*"
33+
}
34+
},
35+
{
36+
"type": "section",
37+
"fields": [
38+
{
39+
"type": "mrkdwn",
40+
"text": "*Workflow:*\n${{ github.workflow }}"
41+
},
42+
{
43+
"type": "mrkdwn",
44+
"text": "*Status:*\nFailed"
45+
},
46+
{
47+
"type": "mrkdwn",
48+
"text": "*Trigger:*\n${{ github.event_name == 'schedule' && 'Daily scheduled run' || 'Manual trigger' }}"
49+
},
50+
{
51+
"type": "mrkdwn",
52+
"text": "*Repository:*\n${{ github.repository }}"
53+
}
54+
]
55+
},
56+
{
57+
"type": "section",
58+
"text": {
59+
"type": "mrkdwn",
60+
"text": "*Commit:* ${{ github.sha }}\n*Branch:* ${{ github.ref_name }}"
61+
}
62+
},
63+
{
64+
"type": "actions",
65+
"elements": [
66+
{
67+
"type": "button",
68+
"text": {
69+
"type": "plain_text",
70+
"text": "View Workflow Run in GitHub Actions"
71+
},
72+
"url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
73+
}
74+
]
75+
}
76+
]
77+
}

0 commit comments

Comments
 (0)