Skip to content

Commit 4d74279

Browse files
authored
Merge pull request #316 from osociety/improved-workflow
windows if then else fix
2 parents 596905f + ff30987 commit 4d74279

File tree

1 file changed

+38
-3
lines changed

1 file changed

+38
-3
lines changed

.github/workflows/flutter_test_main.yml

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,21 @@ jobs:
101101
sudo apt-get update
102102
sudo apt-get install -y ${{ matrix.packages }}
103103
104+
- name: Install lcov (Linux)
105+
if: matrix.os == 'ubuntu'
106+
run: |
107+
sudo apt-get install -y lcov
108+
109+
- name: Install lcov (macOS)
110+
if: matrix.os == 'macos'
111+
run: |
112+
brew install lcov
113+
114+
- name: Install lcov (Windows)
115+
if: matrix.os == 'windows'
116+
run: |
117+
choco install lcov
118+
104119
- name: Download dependencies
105120
run: flutter pub get
106121

@@ -111,7 +126,12 @@ jobs:
111126
run: flutter test --coverage
112127

113128
- name: Preserve unit test coverage
114-
run: mv coverage/lcov.info coverage/unit_${{ matrix.os }}.lcov.info
129+
run: |
130+
if [ -f coverage/lcov.info ]; then
131+
mv coverage/lcov.info coverage/unit_${{ matrix.os }}.lcov.info
132+
else
133+
echo "Unit coverage not produced; aborting." && exit 1
134+
fi
115135
116136
- name: Run integration tests - Linux
117137
if: matrix.os == 'ubuntu'
@@ -131,15 +151,30 @@ jobs:
131151
run: flutter test integration_test/app_test.dart --coverage -d windows
132152

133153
- name: Preserve integration test coverage
134-
run: mv coverage/lcov.info coverage/integration_${{ matrix.os }}.lcov.info
154+
run: |
155+
if [ -f coverage/lcov.info ]; then
156+
mv coverage/lcov.info coverage/integration_${{ matrix.os }}.lcov.info
157+
else
158+
echo "No integration coverage produced; skipping integration coverage step."
159+
fi
135160
136161
- name: Combine coverage files
137162
run: |
138163
# Combine unit and integration coverage
139164
cat coverage/unit_${{ matrix.os }}.lcov.info coverage/integration_${{ matrix.os }}.lcov.info > coverage/lcov.info
140165
141166
- name: Remove generated files from coverage
142-
run: lcov --remove coverage/lcov.info '**/*.g.dart' 'lib/models/drift/*' -o coverage/lcov.info
167+
run: |
168+
# Check if lcov is available; if not, skip filtering
169+
if command -v lcov &> /dev/null; then
170+
lcov --remove coverage/lcov.info \
171+
'**/*.g.dart' \
172+
'lib/models/drift/*' \
173+
-o coverage/lcov.info
174+
echo "Coverage filtered successfully."
175+
else
176+
echo "lcov not found; skipping coverage filtering. Coverage report will include generated files."
177+
fi
143178
144179
- name: Upload combined coverage to CodeCov
145180
if: always()

0 commit comments

Comments
 (0)