-
Notifications
You must be signed in to change notification settings - Fork 3
105 lines (92 loc) · 4.03 KB
/
run_knime_workflow_test.yml
File metadata and controls
105 lines (92 loc) · 4.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
name: 'Run KNIME Workflow Test'
on:
workflow_dispatch:
inputs:
run_build:
description: 'Run build job'
required: false
default: 'true'
pull_request:
types: [opened, synchronize, reopened]
push:
branches: [ master ]
jobs:
build:
name: Bundle extension and build image
runs-on: ubuntu-latest
if: ${{ github.event_name != 'workflow_dispatch' || github.event.inputs.run_build == 'true' }}
env:
LOCAL_UPDATE_SITE_DIR: local-update-site
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Pixi
uses: prefix-dev/setup-pixi@v0
- name: Install environment
run: pixi install
- name: Build local update site
run: pixi run build
- name: Upload update site artifact
uses: actions/upload-artifact@v4
with:
name: extensionartifacts-for-update-site-${{ github.run_id }}
path: ${{ env.LOCAL_UPDATE_SITE_DIR }}
- name: Compute KNIME feature group from knime.yml
id: knime_meta
shell: bash
run: |
pixi run -e build python - <<'PY'
import os
import yaml
with open('knime.yml', 'r', encoding='utf-8') as f:
y = yaml.safe_load(f)
group_id = (y.get('group_id') or '').strip()
name = (y.get('name') or '').strip()
if not group_id or not name:
raise SystemExit(f"Failed to parse group_id/name from knime.yml (group_id={group_id}, name={name})")
feature_group_id = f"{group_id}.features.{name}.feature.group"
with open(os.environ['GITHUB_OUTPUT'], 'a', encoding='utf-8') as gh:
print(f"feature_group_id={feature_group_id}", file=gh)
print("Computed feature group:", feature_group_id)
PY
- name: Build KNIME image with local update site
run: |
docker build \
-f .github/workflows/Dockerfile \
--build-arg LOCAL_UPDATE_SITE_SRC="${{ env.LOCAL_UPDATE_SITE_DIR }}" \
--build-arg KNIME_FEATURES_ARG="${{ steps.knime_meta.outputs.feature_group_id }}" \
-t knime-executor-with-extension:ci .
- name: Analyze workflow execution results
id: workflow_analysis
run: |
echo "Extracting workflow execution results..."
ANALYSIS_OUTPUT=$(docker run --rm knime-executor-with-extension:ci /home/knime/analyze-workflow.sh)
echo "$ANALYSIS_OUTPUT"
# Extract key metrics for badge
EXECUTED_NODES=$(echo "$ANALYSIS_OUTPUT" | grep "Nodes executed:" | sed 's/.*: //')
ERROR_COUNT=$(echo "$ANALYSIS_OUTPUT" | grep "Errors:" | sed 's/.*: //')
# Determine badge status
if echo "$ANALYSIS_OUTPUT" | grep -q "SUCCESS"; then
if [ "$ERROR_COUNT" = "0" ]; then
BADGE_MESSAGE="workflow passed-${EXECUTED_NODES} nodes"
BADGE_COLOR="brightgreen"
else
BADGE_MESSAGE="workflow passed-${EXECUTED_NODES} nodes, ${ERROR_COUNT} errors"
BADGE_COLOR="yellow"
fi
else
BADGE_MESSAGE="workflow failed"
BADGE_COLOR="red"
fi
echo "badge_message=$BADGE_MESSAGE" >> $GITHUB_OUTPUT
echo "badge_color=$BADGE_COLOR" >> $GITHUB_OUTPUT
echo "executed_nodes=$EXECUTED_NODES" >> $GITHUB_OUTPUT
echo "error_count=$ERROR_COUNT" >> $GITHUB_OUTPUT
- name: Update workflow status badge
if: github.ref == 'refs/heads/master'
run: |
# Create badge URL that you can use in README
BADGE_URL="https://img.shields.io/badge/${{ steps.workflow_analysis.outputs.badge_message }}-${{ steps.workflow_analysis.outputs.badge_color }}"
echo "Badge URL: $BADGE_URL"
echo "You can use this in your README.md:"
echo ""