-
Notifications
You must be signed in to change notification settings - Fork 2
201 lines (167 loc) · 5.95 KB
/
pr_dev.yaml
File metadata and controls
201 lines (167 loc) · 5.95 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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
name: Dev - ↩️ pull request
on:
pull_request:
branches:
- dev
jobs:
validate_pr:
permissions:
pull-requests: write
uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/semantic_pull_request.yml@v1
test_version:
needs: validate_pr
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
token: ${{secrets.ELEVATED_TOKEN}}
- name: 📇 Configure git
run: |
git fetch --prune --unshallow
git config --global user.name "GitHub Actions"
git config --global user.email "gh-actions@emdgroup.com"
shell: bash
# Retrieve the new version
- name: 🔂 Run standard-version
uses: actions/github-script@v7
with:
script: |
const {execSync} = require('child_process');
execSync('npx standard-version --dry-run --prerelease', {stdio: 'inherit'});
build_example:
name: Build Example
needs: test_version
runs-on: macos-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Dart
uses: dart-lang/setup-dart@v1
- name: Prepare Flutter
uses: emdgroup/mtrust-urp/.github/shared_actions/prepare-flutter@dev
with:
directory: example/example
- name: Run static analysis
run: |
cd example/example
flutter analyze --no-fatal-warnings
shell: bash
- name: Check licenses
uses: emdgroup/mtrust-urp/.github/shared_actions/check-dart-licenses@dev
with:
directory: example/example
build_advanced_example:
name: Build Advanced Example
needs: test_version
runs-on: macos-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Dart
uses: dart-lang/setup-dart@v1
- name: Prepare Flutter
uses: emdgroup/mtrust-urp/.github/shared_actions/prepare-flutter@dev
with:
directory: example/example_advanced
- name: Run static analysis
run: |
cd example/example_advanced
flutter analyze --no-fatal-warnings
shell: bash
- name: Check licenses
uses: emdgroup/mtrust-urp/.github/shared_actions/check-dart-licenses@dev
with:
directory: example/example_advanced
build_library:
name: Build Library
needs: test_version
runs-on: macos-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Dart
uses: dart-lang/setup-dart@v1
- name: Prepare Flutter
uses: emdgroup/mtrust-urp/.github/shared_actions/prepare-flutter@dev
with:
directory: .
- name: Validate Flutter
uses: emdgroup/mtrust-urp/.github/shared_actions/validate-flutter@dev
with:
directory: .
is_package: true
- name: Check licenses
uses: emdgroup/mtrust-urp/.github/shared_actions/check-dart-licenses@dev
with:
directory: .
matrix-generation:
name: Generate Compatibility Matrix
needs: validate_pr
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.generate-matrix.outputs.matrix }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Fetch firmware versions
uses: ./.github/actions/fetch-firmware-versions
id: fetch-firmware-versions
with:
token: ${{secrets.ELEVATED_TOKEN}}
- name: Fetch SDK versions
uses: ./.github/actions/fetch-sdk-versions
id: fetch-sdk-versions
- name: Generate compatibility matrix
id: generate-matrix
run: |
# Parse the JSON arrays and create a matrix
firmware_versions=$(echo '${{ steps.fetch-firmware-versions.outputs.versions }}' | jq -r '.[]')
sdk_versions=$(echo '${{ steps.fetch-sdk-versions.outputs.versions }}' | jq -r '.[]')
echo "Latest 3 major.minor firmware versions:"
echo "$firmware_versions"
echo ""
echo "Current SDK version:"
echo "$sdk_versions"
echo ""
# Create matrix combinations using current SDK version with latest 3 firmware versions
matrix_combinations="[]"
count=0
while IFS= read -r firmware; do
# For each firmware version, use the current SDK version
combination=$(jq -n --arg fw "$firmware" --arg sdk "$sdk_versions" '{firmware: $fw, sdk: $sdk}')
# Add to matrix array
matrix_combinations=$(echo "$matrix_combinations" | jq --argjson combo "$combination" '. += [$combo]')
count=$((count + 1))
done <<< "$firmware_versions"
# Validate JSON before output
if echo "$matrix_combinations" | jq empty 2>/dev/null; then
# Use jq to compact the JSON for GitHub Actions output
compact_matrix=$(echo "$matrix_combinations" | jq -c .)
echo "matrix=$compact_matrix" >> $GITHUB_OUTPUT
echo "Generated matrix with $count combinations (latest 3 firmware × current SDK version)"
echo "Matrix preview:"
echo "$matrix_combinations" | jq '.[0:3]' # Show first 3 combinations
else
echo "Error: Invalid JSON generated"
echo "Generated content:"
echo "$matrix_combinations"
exit 1
fi
compatibility-tests:
name: Compatibility Tests
needs: matrix-generation
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include: ${{ fromJson(needs.matrix-generation.outputs.matrix) }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Test compatibility
uses: ./.github/actions/test-compatibility
with:
token: ${{secrets.ELEVATED_TOKEN}}
firmware_version: ${{ matrix.firmware }}
sdk_version: ${{ matrix.sdk }}