Skip to content

Commit d30eaf9

Browse files
author
marwan37
committed
add test-pipelines.yml gh action workflow
1 parent 41f672c commit d30eaf9

File tree

1 file changed

+109
-0
lines changed

1 file changed

+109
-0
lines changed
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
name: Test Tutorial Pipelines
2+
3+
on:
4+
schedule:
5+
# Run daily at 9 AM UTC
6+
- cron: "0 9 * * *"
7+
push:
8+
branches: [main, develop]
9+
pull_request:
10+
branches: [main, develop]
11+
workflow_dispatch:
12+
13+
jobs:
14+
test-pipelines:
15+
runs-on: ubuntu-latest
16+
17+
strategy:
18+
matrix:
19+
pipeline:
20+
- { name: "Hello World", path: "pipelines/helloWorld", file: "hello_pipeline.py" }
21+
- { name: "Caching", path: "pipelines/caching", file: "cache_pipeline.py" }
22+
- { name: "Fan Out", path: "pipelines/fanOut", file: "fan_pipeline.py" }
23+
- { name: "Metadata", path: "pipelines/metadata", file: "meta_pipeline.py" }
24+
- { name: "Parameters", path: "pipelines/parameters", file: "param_pipeline.py" }
25+
- { name: "Retries", path: "pipelines/retries", file: "robust_pipeline.py" }
26+
- { name: "Step I/O", path: "pipelines/stepIO", file: "io_pipeline.py" }
27+
- { name: "Tagging", path: "pipelines/tagging", file: "tagged_pipeline.py" }
28+
- { name: "Visualizations", path: "pipelines/visualizations", file: "viz_pipeline.py" }
29+
- { name: "YAML Config", path: "pipelines/yamlConfig", file: "yaml_pipeline.py" }
30+
fail-fast: false
31+
32+
steps:
33+
- name: Checkout repository
34+
uses: actions/checkout@v4
35+
36+
- name: Set up Python
37+
uses: actions/setup-python@v4
38+
with:
39+
python-version: "3.9"
40+
41+
- name: Install dependencies
42+
run: |
43+
python -m pip install --upgrade pip
44+
# Install latest ZenML version
45+
pip install zenml[server] --upgrade
46+
# Install project dependencies
47+
pip install -r requirements.txt
48+
49+
- name: Initialize ZenML
50+
run: |
51+
zenml init
52+
zenml integration install discord -y
53+
54+
- name: Set up Discord alerter (if secrets available)
55+
env:
56+
DISCORD_TOKEN_SRE: ${{ secrets.DISCORD_TOKEN_SRE }}
57+
DISCORD_SRE_CHANNEL_ID: ${{ secrets.DISCORD_SRE_CHANNEL_ID }}
58+
if: ${{ env.DISCORD_TOKEN_SRE != '' && env.DISCORD_SRE_CHANNEL_ID != '' }}
59+
run: |
60+
# Create Discord secret
61+
zenml secret create discord_secret --discord_token="${DISCORD_TOKEN_SRE}" || true
62+
# Register Discord alerter
63+
zenml alerter register discord_alerter \
64+
--flavor=discord \
65+
--discord_token="${DISCORD_TOKEN_SRE}" \
66+
--default_discord_channel_id="${DISCORD_SRE_CHANNEL_ID}" || true
67+
# Add to default stack
68+
zenml stack update default -al discord_alerter || true
69+
70+
- name: Run ${{ matrix.pipeline.name }} Pipeline
71+
id: run_pipeline
72+
working-directory: ${{ matrix.pipeline.path }}
73+
continue-on-error: true
74+
run: |
75+
echo "Running ${{ matrix.pipeline.name }} pipeline..."
76+
python ${{ matrix.pipeline.file }}
77+
78+
- name: Check pipeline result
79+
if: steps.run_pipeline.outcome == 'failure'
80+
run: |
81+
echo "Pipeline ${{ matrix.pipeline.name }} failed!"
82+
exit 1
83+
84+
notify-discord:
85+
needs: test-pipelines
86+
runs-on: ubuntu-latest
87+
if: ${{ failure() }}
88+
89+
steps:
90+
- name: Send Discord notification on failure
91+
uses: Ilshidur/action-discord@master
92+
env:
93+
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK_SRE }}
94+
with:
95+
args: |
96+
🚨 **Pipeline Test Failure Alert** 🚨
97+
98+
**Repository:** ${{ github.repository }}
99+
**Branch:** ${{ github.ref_name }}
100+
**Workflow:** ${{ github.workflow }}
101+
**Run:** ${{ github.run_id }}
102+
103+
Some tutorial pipelines failed to run with the latest ZenML version.
104+
105+
**Details:** ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
106+
107+
Please investigate and fix the failing pipelines.
108+
109+
@here #sre-alerts

0 commit comments

Comments
 (0)