ci(flutter): setup CI for Flutter lint and test #18
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Flutter | |
permissions: | |
contents: read | |
pull-requests: read | |
on: | |
pull_request: | |
paths: | |
- 'flutter/**' | |
- 'android/measure/api/**' | |
push: | |
branches: | |
- 'main' | |
paths: | |
- 'flutter/**' | |
- 'android/measure/api/**' | |
- 'ios/Sources/MeasureSDK/Swift/Measure.swift' | |
tags: | |
- 'flutter-*' | |
env: | |
JAVA_VERSION: 17 | |
JAVA_DISTRIBUTION: 'temurin' | |
GITHUB_ACTOR: ${{ github.actor }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
jobs: | |
flutter-checks: | |
name: Flutter checks | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: flutter/measure_flutter | |
timeout-minutes: 15 | |
steps: | |
- name: Clone repository | |
uses: actions/checkout@v4 | |
- name: Set up Flutter | |
uses: subosito/flutter-action@f2c4f6686ca8e8d6e6d0f28410eeef506ed66aff | |
with: | |
channel: stable | |
flutter-version: 3.29.0 | |
- name: Pub get | |
run: flutter pub get | |
- name: Verify formatting | |
run: dart format --output=none --set-exit-if-changed . | |
- name: Analyze project source | |
run: flutter analyze | |
- name: Flutter tests | |
run: flutter test | |
- name: Print working directory | |
run: | | |
echo "Current working directory:" | |
pwd | |
echo "Directory contents:" | |
ls -la | |
- name: Android checks | |
uses: actions/setup-java@v3 | |
with: | |
distribution: ${{ env.JAVA_DISTRIBUTION }} | |
java-version: ${{ env.JAVA_VERSION }} | |
cache: 'gradle' | |
working-directory: flutter/measure_flutter/example/android | |
- name: Print working directory | |
working-directory: flutter/measure_flutter/example/android | |
run: | | |
echo "Current working directory:" | |
pwd | |
echo "Directory contents:" | |
ls -la | |
- name: Check Gradle wrapper | |
uses: gradle/actions/wrapper-validation@v3 | |
- name: Run all checks | |
working-directory: flutter/measure_flutter/example/android | |
run: ./gradlew :measure_flutter:check |