Skip to content

Commit

Permalink
Setup codecov (#25)
Browse files Browse the repository at this point in the history
set up codecov
  • Loading branch information
AlexisChoupault authored Mar 3, 2025
1 parent 670a0e7 commit d9e21b2
Show file tree
Hide file tree
Showing 11 changed files with 188 additions and 203 deletions.
39 changes: 0 additions & 39 deletions .github/workflows/android.yml

This file was deleted.

137 changes: 137 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
name: CI

on:
push:
branches: [ main ]
paths-ignore:
- '**.md'
pull_request:
branches: [ main ]
paths-ignore:
- '**.md'

jobs:
flutter-tests:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- uses: subosito/flutter-action@v2
with:
flutter-version: '3.29.0'
channel: 'stable'

- name: Install dependencies
run: flutter pub get

- name: Analyze project source
run: flutter analyze --fatal-infos
working-directory: lib

- name: Run tests
run: flutter test --coverage

- name: Upload coverage report as artifact
uses: actions/upload-artifact@v4
with:
name: flutter-coverage
path: coverage/lcov.info

ios-tests:
runs-on: macos-latest

steps:
- uses: actions/checkout@v4

- uses: subosito/flutter-action@v2
with:
flutter-version: '3.29.0'
channel: 'stable'

- name: Install dependencies
run: |
brew install xcresultparser
flutter pub get
cd example/ios
pod install
cd ../..
- name: Run tests
run: |
xcodebuild test -workspace ./example/ios/Runner.xcworkspace \
-scheme EventideTests \
-destination 'platform=iOS Simulator,name=iPhone 16,OS=18.1' \
-resultBundlePath build/reports/EventideTests.xcresult
- name: Prepare coverage xml file
run: |
xcresultparser \
--output-format cobertura \
build/reports/EventideTests.xcresult > build/reports/ios-coverage.xml
- name: Upload coverage report as artifact
uses: actions/upload-artifact@v4
with:
name: ios-coverage
path: build/reports/ios-coverage.xml

android-tests:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- uses: actions/setup-java@v4
with:
distribution: 'corretto'
java-version: '17'
cache: 'gradle'

- uses: subosito/flutter-action@v2
with:
flutter-version: '3.29.0'
channel: 'stable'

- name: Install dependencies
run: flutter pub get

- name: Build and test
run: |
./example/android/gradlew testDebugUnitTest -p ./example/android/
- name: Upload coverage report as artifact
uses: actions/upload-artifact@v4
with:
name: android-coverage
path: ./android/build/reports/jacocoTestReport.xml

upload-coverage:
runs-on: ubuntu-latest
needs: [flutter-tests, ios-tests, android-tests]
steps:
- name: Download flutter coverage report
uses: actions/download-artifact@v4
with:
name: flutter-coverage
path: coverage

- name: Download ios coverage report
uses: actions/download-artifact@v4
with:
name: ios-coverage
path: build/reports

- name: Download android coverage report
uses: actions/download-artifact@v4
with:
name: android-coverage
path: ./android/build/reports/

- name: Upload combined coverage report to Codecov
uses: codecov/codecov-action@v5
env:
token: ${{ secrets.CODECOV_TOKEN }}
with:
fail_ci_if_error: true
files: ./coverage/lcov.info,./build/reports/ios-coverage.xml,./android/build/reports/jacocoTestReport.xml
35 changes: 0 additions & 35 deletions .github/workflows/flutter.yml

This file was deleted.

40 changes: 0 additions & 40 deletions .github/workflows/ios.yml

This file was deleted.

8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
## 📆 Eventide

[![pub package](https://img.shields.io/pub/v/eventide.svg)](https://pub.dev/packages/eventide) [![Flutter Tests](https://github.com/sncf-connect-tech/eventide/actions/workflows/flutter.yml/badge.svg)](https://github.com/sncf-connect-tech/eventide/actions/workflows/flutter.yml) [![Android Tests](https://github.com/sncf-connect-tech/eventide/actions/workflows/android.yml/badge.svg)](https://github.com/sncf-connect-tech/eventide/actions/workflows/android.yml) [![iOS Tests](https://github.com/sncf-connect-tech/eventide/actions/workflows/ios.yml/badge.svg)](https://github.com/sncf-connect-tech/eventide/actions/workflows/ios.yml)
[![pub package](https://img.shields.io/pub/v/value_state.svg)](https://pub.dev/packages/value_state) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

[![codecov](https://codecov.io/gh/sncf-connect-tech/eventide/graph/badge.svg?token=jxA8pZnWmR)](https://codecov.io/gh/sncf-connect-tech/eventide) [![Flutter Tests](https://github.com/sncf-connect-tech/eventide/actions/workflows/flutter.yml/badge.svg)](https://github.com/sncf-connect-tech/eventide/actions/workflows/flutter.yml) [![Android Tests](https://github.com/sncf-connect-tech/eventide/actions/workflows/android.yml/badge.svg)](https://github.com/sncf-connect-tech/eventide/actions/workflows/android.yml) [![iOS Tests](https://github.com/sncf-connect-tech/eventide/actions/workflows/ios.yml/badge.svg)](https://github.com/sncf-connect-tech/eventide/actions/workflows/ios.yml)

Eventide provides a easy-to-use flutter interface to access & modify native device calendars (iOS & Android).

Expand Down Expand Up @@ -76,3 +78,7 @@ You can find more in the example app.
### License

Copyright © 2025 SNCF Connect & Tech. This project is licensed under the MIT License - see the LICENSE file for details.

### Feedback

Please file any issues, bugs or feature requests as an issue on the [Github page](https://github.com/sncf-connect-tech/eventide/issues).
41 changes: 38 additions & 3 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:7.3.1'
classpath "com.android.tools.build:gradle:8.8.2"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
Expand All @@ -23,6 +23,7 @@ allprojects {

apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'jacoco'

android {
compileSdk 35
Expand Down Expand Up @@ -71,8 +72,42 @@ android {
ndkVersion '27.0.12077973'
}

tasks.register('jacocoTestReport', JacocoReport) {
dependsOn 'testDebugUnitTest'

reports {
xml.required = true
xml.outputLocation.set(file("$project.projectDir/build/reports/jacocoTestReport.xml"))
html.required = false
csv.required = false
}

def fileFilter = [
'**/R.class',
'**/R$*.class',
'**/BuildConfig.*',
'**/Manifest*.*',
'**/CalendarApi*',
'**/Calendar.class',
'**/Calendar$Companion.class',
'**/Event*.class',
'**/Account*.class',
] // ignore pigeon generated files
def mainSrc = "${project.projectDir}/src/main/kotlin/sncf/connect/tech/eventide/"

sourceDirectories.setFrom(files(mainSrc))
classDirectories.setFrom(files("${buildDir}/intermediates/runtime_library_classes_dir/debug/sncf/connect/tech/eventide/").asFileTree.matching {
exclude fileFilter
})
executionData.setFrom(files("${buildDir}/jacoco/testDebugUnitTest.exec"))
}

tasks.withType(Test).configureEach {
useJUnitPlatform()
finalizedBy jacocoTestReport
}

dependencies {
implementation("androidx.activity:activity-ktx:1.10.0")
implementation("androidx.activity:activity-ktx:1.10.1")
implementation("androidx.fragment:fragment-ktx:1.8.6")
}

5 changes: 5 additions & 0 deletions example/android/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ plugins {
id("kotlin-android")
// The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
id("dev.flutter.flutter-gradle-plugin")
id("jacoco")
}

jacoco {
toolVersion = "0.8.12"
}

android {
Expand Down
Loading

0 comments on commit d9e21b2

Please sign in to comment.