Skip to content

Commit fe725a7

Browse files
Issue#30 fix jacoco android codecov (#111)
* fix codecov android * update actions/checkout@v6 * fix project path in build.gradle * glob dart lefthook lint * ok * update ci * Potential fix for code scanning alert no. 48: Workflow does not contain permissions Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --------- Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
1 parent 4d4d22e commit fe725a7

5 files changed

Lines changed: 57 additions & 13 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 51 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
name: CI
22

3+
permissions:
4+
contents: read
5+
36
on:
47
push:
58
branches: [main]
@@ -15,7 +18,7 @@ jobs:
1518
runs-on: ubuntu-latest
1619

1720
steps:
18-
- uses: actions/checkout@v4
21+
- uses: actions/checkout@v6
1922

2023
- uses: subosito/flutter-action@v2
2124
with:
@@ -37,7 +40,7 @@ jobs:
3740
run: flutter test ./test/* --coverage
3841

3942
- name: Upload coverage report as artifact
40-
uses: actions/upload-artifact@v4
43+
uses: actions/upload-artifact@v6
4144
with:
4245
name: flutter-coverage
4346
path: coverage/lcov.info
@@ -46,7 +49,7 @@ jobs:
4649
runs-on: ubuntu-latest
4750

4851
steps:
49-
- uses: actions/checkout@v4
52+
- uses: actions/checkout@v6
5053

5154
- uses: subosito/flutter-action@v2
5255
with:
@@ -66,7 +69,7 @@ jobs:
6669
runs-on: macos-latest
6770

6871
steps:
69-
- uses: actions/checkout@v4
72+
- uses: actions/checkout@v6
7073

7174
- uses: subosito/flutter-action@v2
7275
with:
@@ -106,7 +109,7 @@ jobs:
106109
build/reports/EventideTests.xcresult > build/reports/ios-coverage.xml
107110
108111
- name: Upload coverage report as artifact
109-
uses: actions/upload-artifact@v4
112+
uses: actions/upload-artifact@v6
110113
with:
111114
name: ios-coverage
112115
path: build/reports/ios-coverage.xml
@@ -115,9 +118,9 @@ jobs:
115118
runs-on: ubuntu-latest
116119

117120
steps:
118-
- uses: actions/checkout@v4
121+
- uses: actions/checkout@v6
119122

120-
- uses: actions/setup-java@v4
123+
- uses: actions/setup-java@v5
121124
with:
122125
distribution: ${{ env.JAVA_DISTRIBUTION }}
123126
java-version: ${{ env.JAVA_VERSION }}
@@ -135,10 +138,50 @@ jobs:
135138
./example/android/gradlew testDebugUnitTest -p ./example/android/
136139
137140
- name: Upload coverage report as artifact
138-
uses: actions/upload-artifact@v4
141+
uses: actions/upload-artifact@v6
139142
with:
140143
name: android-coverage
141144
path: android/build/reports/jacocoTestReport.xml
145+
146+
ios-build-spm:
147+
runs-on: macos-latest
148+
149+
steps:
150+
- uses: actions/checkout@v6
151+
152+
- uses: subosito/flutter-action@v2
153+
with:
154+
channel: 'stable'
155+
156+
- name: Install dependencies
157+
run: |
158+
flutter config --enable-swift-package-manager
159+
flutter pub get
160+
cd example
161+
flutter build ios --config-only --no-codesign
162+
163+
- name: Build iOS framework with SPM
164+
run: |
165+
cd example
166+
flutter build ios --simulator
167+
168+
android-build:
169+
runs-on: ubuntu-latest
170+
steps:
171+
- uses: actions/checkout@v6
172+
173+
- uses: subosito/flutter-action@v2
174+
with:
175+
channel: 'stable'
176+
177+
- name: Install dependencies
178+
run: |
179+
flutter pub get
180+
181+
- name: Build Android APK
182+
run: |
183+
cd example
184+
flutter build apk --debug
142185
143186
upload-coverage:
144187
runs-on: ubuntu-latest

android/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,10 @@ tasks.register('jacocoTestReport', JacocoReport) {
9292
def mainSrc = "${project.projectDir}/src/main/kotlin/sncf/connect/tech/eventide/"
9393

9494
sourceDirectories.setFrom(files(mainSrc))
95-
classDirectories.setFrom(files("${buildDir}/intermediates/runtime_library_classes_dir/debug/sncf/connect/tech/eventide/").asFileTree.matching {
95+
classDirectories.setFrom(files("${rootProject.buildDir}/${project.name}/tmp/kotlin-classes/debug/").asFileTree.matching {
9696
exclude fileFilter
9797
})
98-
executionData.setFrom(files("${buildDir}/jacoco/testDebugUnitTest.exec"))
98+
executionData.setFrom(files("${rootProject.buildDir}/${project.name}/jacoco/testDebugUnitTest.exec"))
9999
}
100100

101101
tasks.withType(Test) {

android/gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

codecov.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ coverage:
1818
target: 80%
1919
threshold: 5%
2020
android:
21-
enabled: no # Disabled while android is not behaving with codecov
21+
enabled: yes
2222
target: 80%
2323
threshold: 5%
2424
project:
@@ -31,7 +31,7 @@ coverage:
3131
target: 80%
3232
threshold: 5%
3333
android:
34-
enabled: no # Disabled while android is not behaving with codecov
34+
enabled: yes
3535
target: 80%
3636
threshold: 5%
3737

lefthook.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ pre-commit:
22
parallel: false
33
commands:
44
linter:
5+
glob: "*.dart"
56
run: dart analyze . --fatal-infos
67
sort-imports:
78
glob: "*.dart"

0 commit comments

Comments
 (0)