-
Notifications
You must be signed in to change notification settings - Fork 0
151 lines (138 loc) · 4.87 KB
/
testing_options.yml
File metadata and controls
151 lines (138 loc) · 4.87 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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
name: "Testmatrix with Options"
run-name: "Testmatrix with current-version: ${{ inputs.version }} preversion: ${{ inputs.preversion }} preversion-start: ${{ inputs.preversion-start }} use-build: ${{ inputs.use-build }}"
on:
workflow_dispatch:
inputs:
version:
description: 'Enter version for testing (e.g. 1.0.0 or 1.0.0-rc)'
required: true
type: string
default: "1.0.0"
preversion:
description: 'Preversion?'
required: true
type: boolean
default: true
preversion-start-zero:
description: 'Preversion start with 0'
required: true
type: boolean
default: false
use-build:
description: 'Use Build?'
required: true
type: boolean
default: false
prefix:
description: 'Prefix?'
required: true
type: boolean
default: false
jobs:
matrix-test:
name: Test ${{ matrix.type }} → Version
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
type:
- none
- major
- minor
- patch
- feature
- bug
- hotfix
- stable
- alpha
- beta
- pre
- rc
- patch-alpha
- patch-beta
- patch-pre
- patch-rc
- minor-alpha
- minor-beta
- minor-pre
- minor-rc
- major-alpha
- major-beta
- major-pre
- major-rc
# Fehlerhafte Inputs
- ""
- invalid
- patch-invalid
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Run version bump with ${{ matrix.type }}
id: bump
continue-on-error: true
uses: psycho0verload/increment-version@main
with:
current-version: ${{ inputs.version }}
version-type: ${{ matrix.type }}
preversion: ${{ inputs.preversion }}
preversion-start-zero: ${{ inputs.preversion-start-zero }}
use-build: ${{ inputs.use-build }}
- name: Save result to file
run: |
mkdir -p result
if [ -z "${{ steps.bump.outputs.next-version }}" ]; then
echo "❌ Error during processing:"
echo "Input version: ${{ inputs.version }}" > result/result-${{ matrix.type }}.txt
echo "Type: ${{ matrix.type }}" >> result/result-${{ matrix.type }}.txt
echo "Result: ERROR (no output of next-version)" >> result/result-${{ matrix.type }}.txt
else
echo "✅ Successfully processed:" > result/result-${{ matrix.type }}.txt
echo "Input version: ${{ inputs.version }}" >> result/result-${{ matrix.type }}.txt
echo "Type: ${{ matrix.type }}" >> result/result-${{ matrix.type }}.txt
echo "Result: ${{ steps.bump.outputs.next-version }}" >> result/result-${{ matrix.type }}.txt
fi
- name: Upload result artifact
uses: actions/upload-artifact@v4
with:
name: matrix-result-${{ matrix.type }}
path: result/result-${{ matrix.type }}.txt
summary:
name: Summary of all version tests
runs-on: ubuntu-latest
needs: matrix-test
if: always()
steps:
- name: Download all result artifacts
uses: actions/download-artifact@v4
with:
path: results
- name: Formatted summary in logs
run: |
echo "### 🧪 Summary of all version tests:"
echo ""
find results -name 'result-*.txt' | while read file; do
input=$(grep '^Input version:' "$file" | cut -d: -f2- | xargs)
type=$(grep '^Type:' "$file" | cut -d: -f2- | xargs)
result=$(grep '^Result:' "$file" | cut -d: -f2- | xargs)
if [[ "$result" == ERROR* ]]; then
echo "❌ $input → $type → $result"
else
echo "✅ $input → $type → $result"
fi
done
- name: Schreibe strukturierte Zusammenfassung in GitHub Summary
run: |
echo "### 🧪 Summary of all version tests" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "| Status | Input | Type | Result |" >> $GITHUB_STEP_SUMMARY
echo "|--------|--------|------|--------|" >> $GITHUB_STEP_SUMMARY
find results -name 'result-*.txt' | while read file; do
input=$(grep '^Input version:' "$file" | cut -d: -f2- | xargs)
type=$(grep '^Type:' "$file" | cut -d: -f2- | xargs)
result=$(grep '^Result:' "$file" | cut -d: -f2- | xargs)
if [[ "$result" == ERROR* ]]; then
echo "| ❌ | \`$input\` | \`$type\` | $result |" >> $GITHUB_STEP_SUMMARY
else
echo "| ✅ | \`$input\` | \`$type\` | \`$result\` |" >> $GITHUB_STEP_SUMMARY
fi
done