-
Notifications
You must be signed in to change notification settings - Fork 0
126 lines (114 loc) · 4.06 KB
/
testing_default.yml
File metadata and controls
126 lines (114 loc) · 4.06 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
name: "Testmatrix: Default"
run-name: "Testmatrix: Default with ${{ inputs.version }}"
on:
workflow_dispatch:
inputs:
version:
description: 'Enter version for testing (e.g. 1.0.0 or 1.0.0-rc)'
required: true
type: string
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
# Faulty 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 }}
- 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: Write a structured summary 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