Skip to content

Commit 1490198

Browse files
author
marwan37
committed
simplify workflow, remove @here pings, and only alert once even if all fail
1 parent f0cbc26 commit 1490198

File tree

1 file changed

+45
-60
lines changed

1 file changed

+45
-60
lines changed

.github/workflows/test-pipelines.yml

Lines changed: 45 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,6 @@ jobs:
1414
test-pipelines:
1515
runs-on: ubuntu-latest
1616

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-
3217
steps:
3318
- name: Checkout repository
3419
uses: actions/checkout@v4
@@ -41,50 +26,55 @@ jobs:
4126
- name: Install dependencies
4227
run: |
4328
python -m pip install --upgrade pip
44-
# Install latest ZenML version
4529
pip install zenml[server] --upgrade
46-
# Install project dependencies
4730
pip install -r requirements.txt
4831
49-
- name: Initialize ZenML
32+
- name: Initialize ZenML & Discord alerter
5033
run: |
5134
zenml init
5235
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-
continue-on-error: true
73-
run: |
74-
echo "Running ${{ matrix.pipeline.name }} pipeline..."
75-
cd ${{ matrix.pipeline.path }}
76-
PYTHONPATH=$GITHUB_WORKSPACE:$PYTHONPATH python ${{ matrix.pipeline.file }}
77-
78-
- name: Check pipeline result
79-
if: steps.run_pipeline.outcome == 'failure'
36+
if [ -n "${{ secrets.DISCORD_TOKEN_SRE }}" ] && [ -n "${{ secrets.DISCORD_SRE_CHANNEL_ID }}" ]; then
37+
zenml secret create discord_secret --discord_token="${{ secrets.DISCORD_TOKEN_SRE }}" || true
38+
zenml alerter register discord_alerter \
39+
--flavor=discord \
40+
--discord_token="${{ secrets.DISCORD_TOKEN_SRE }}" \
41+
--default_discord_channel_id="${{ secrets.DISCORD_SRE_CHANNEL_ID }}" || true
42+
zenml stack update default -al discord_alerter || true
43+
fi
44+
45+
- name: Run all tutorial pipelines
46+
id: run_all
8047
run: |
81-
echo "Pipeline ${{ matrix.pipeline.name }} failed!"
82-
exit 1
48+
failed=()
49+
for p in \
50+
"pipelines/helloWorld/hello_pipeline.py" \
51+
"pipelines/caching/cache_pipeline.py" \
52+
"pipelines/fanOut/fan_pipeline.py" \
53+
"pipelines/metadata/meta_pipeline.py" \
54+
"pipelines/parameters/param_pipeline.py" \
55+
"pipelines/retries/robust_pipeline.py" \
56+
"pipelines/stepIO/io_pipeline.py" \
57+
"pipelines/tagging/tagged_pipeline.py" \
58+
"pipelines/visualizations/viz_pipeline.py" \
59+
"pipelines/yamlConfig/yaml_pipeline.py"; do
60+
61+
echo "Running $p…"
62+
if ! PYTHONPATH=$GITHUB_WORKSPACE:$PYTHONPATH python "$p"; then
63+
echo "❌ $p failed"
64+
failed+=("$p")
65+
fi
66+
done
67+
68+
if [ "${#failed[@]}" -gt 0 ]; then
69+
echo "Failed pipelines:"
70+
printf " - %s\n" "${failed[@]}"
71+
exit 1
72+
fi
8373
8474
notify-discord:
8575
needs: test-pipelines
86-
runs-on: ubuntu-latest
8776
if: ${{ failure() }}
77+
runs-on: ubuntu-latest
8878

8979
steps:
9080
- name: Send Discord notification on failure
@@ -93,17 +83,12 @@ jobs:
9383
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK_SRE }}
9484
with:
9585
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 }}
86+
**Pipeline Test Failure Alert**
10687
107-
Please investigate and fix the failing pipelines.
88+
Repository: ${{ github.repository }}
89+
Branch: ${{ github.ref_name }}
90+
Workflow: ${{ github.workflow }}
91+
Run ID: ${{ github.run_id }}
10892
109-
@here #sre-alerts
93+
One or more tutorial pipelines failed with the latest ZenML version.
94+
Details: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}

0 commit comments

Comments
 (0)