Flutter continuous integration (CI) not working on github because the project is inside a folder
323
I found the solution, just needed to add a working-directory
Final code
name: CI
on:
push:
branches:
- development
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-java@v1
with:
java-version: '12.x'
- uses: subosito/flutter-action@v1
with:
channel: 'beta'
- name: Get flutter dependencies
run: flutter pub get
working-directory: my_folder
- name: Statically analyze the Dart code for any errors.
run: flutter analyze .
working-directory: my_folder
- name: Run widget tests for our flutter project.
run: flutter test
working-directory: my_folder
Author by
eduinvestor
Updated on January 01, 2023Comments
-
eduinvestor over 1 year
I'm trying to implement continuous integration on my github repository. If the project is at the same level as root, it works. But I want to have the project inside a folder to keep it organized. On my local setup, I would do "cd my_folder", but I tried to add that to the .yml script and still fails.
Error shown:
Error: No pubspec.yaml file found. This command should be run from the root of your Flutter project. Error: Process completed with exit code 1.
Basically it fails because it's trying to do pub get at the root of the repository where pubspec.yaml doesn't exist, instead of inside of the folder.
This is the code:
on: push: branches: - development jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 - uses: actions/setup-java@v1 with: java-version: '12.x' - uses: subosito/flutter-action@v1 with: channel: 'beta' # Enter into the flutter project. - run: cd my_folder # Here I tried to put this command, but is useless # Get flutter dependencies. - run: flutter pub get # <--- Here is the error # Statically analyze the Dart code for any errors. - run: flutter analyze . # Run widget tests for our flutter project. - run: flutter test