Flutter 持续集成 (CI) 无法在 github 上运行,因为该项目位于文件夹中
Flutter continuous integration (CI) not working on github because the project is inside a folder
我正在尝试在我的 github 存储库上实施持续集成。
如果项目与 root 处于同一级别,则它可以工作。但我想将项目放在一个文件夹中以使其井井有条。在我的本地设置中,我会执行“cd my_folder”,但我试图将其添加到 .yml 脚本中,但仍然失败。
显示错误:
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.
基本上它失败了,因为它试图在 pubspec.yaml 不存在的存储库的根目录而不是文件夹内部执行 pub get。
这是代码:
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
我找到了解决方案,只需要添加一个工作目录
最终代码
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
这个错误告诉你你的开发分支中没有pubspec.yaml,尝试将你的pubspec.yaml推到开发分支中。
我正在尝试在我的 github 存储库上实施持续集成。 如果项目与 root 处于同一级别,则它可以工作。但我想将项目放在一个文件夹中以使其井井有条。在我的本地设置中,我会执行“cd my_folder”,但我试图将其添加到 .yml 脚本中,但仍然失败。
显示错误:
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.
基本上它失败了,因为它试图在 pubspec.yaml 不存在的存储库的根目录而不是文件夹内部执行 pub get。
这是代码:
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
我找到了解决方案,只需要添加一个工作目录
最终代码
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
这个错误告诉你你的开发分支中没有pubspec.yaml,尝试将你的pubspec.yaml推到开发分支中。