Flutter持续集成(CI)不能在github上工作,因为项目在一个文件夹内



我正在尝试在我的github存储库上实现持续集成。如果项目与根在同一级别,它就可以工作。但是我想把这个项目放在一个文件夹里,以保持它的组织性。在我的本地设置中,我会执行"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.

基本上它失败了,因为它试图在repository的根目录下执行pub get。Yaml不存在,而是在文件夹内。

这是代码:

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。在您的开发分支中,尝试推送您的pubspec。到开发分支。

相关内容

  • 没有找到相关文章

最新更新