When the following action is run, it fails on flutter analyze
. If I remove it, it fails later on flutter build
. Both commands work fine locally. I understand the message, but fail to grasp what might be wrong with the package path.
GitHub action error:
flutter analyze
shell: /bin/bash -e {0}
env:
JAVA_HOME_12.0.2_x64: /opt/hostedtoolcache/jdk/12.0.2/x64
JAVA_HOME: /opt/hostedtoolcache/jdk/12.0.2/x64
JAVA_HOME_12_0_2_X64: /opt/hostedtoolcache/jdk/12.0.2/x64
FLUTTER_HOME: /opt/hostedtoolcache/flutter/1.22.5-stable/x64
Analyzing myApp...
error • Target of URI doesn't exist: 'package:myApp/app.dart' • lib/main.dart:7:8 • uri_does_not_exist
error • The function 'App' isn't defined • lib/main.dart:38:16 • undefined_function
2 issues found. (ran in 18.4s)
Error: Process completed with exit code 1.
Action source:
name: Flutter Android Test and Build
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
build_android:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup Java
uses: actions/setup-java@v1
with:
java-version: "12.x"
- name: Setup Flutter
uses: subosito/flutter-action@v1
with:
flutter-version: "1.22.5"
- name: Install Flutter dependencies
run: flutter pub get
- name: Format files
run: flutter format --set-exit-if-changed .
- name: Analyze code
run: flutter analyze
- name: Run tests
run: flutter test
- name: Build Android
run: flutter build apk
Passing --no-fatal-infos
and --no-fatal-warnings
as a flag to flutter analyzer worked for me.
Here: flutter analyze --no-fatal-infos --no-fatal-warnings
This is because, unlike dart analyzer, flutter analyzer returns a fatal exit code of 1 regardless of the severity issue (info, warning, error).
Reference
The issue was in a upper case / lower case file name typo. OSX filesystem is by default case insensitive, while Ubuntu, on which the GitHub Action runs, is not.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With