Eva*_*tti 5 flutter github-actions
我正在尝试使用 GitHub Actions 来构建我的 Flutter 应用程序,但我不知道要选择哪个容器映像。
是否有可用于 Flutter 的可信容器映像?
我需要进行哪些调整才能在构建步骤中使用 Flutter SDK?
Run flutter pub get
/__w/_temp/46389e95-36bc-464e-ab34-41715eb4dccb.sh: 1: /__w/_temp/46389e95-36bc-464e-ab34-41715eb4dccb.sh: flutter: not found
##[error]Process completed with exit code 127.
Run Code Online (Sandbox Code Playgroud)
我修改了dart.yml由 GitHub Actions 生成的文件,如下所示:
name: Dart CI
on: [push]
jobs:
build:
runs-on: ubuntu-latest
container:
image: google/dart:latest
steps:
- uses: actions/checkout@v1
- name: Install dependencies
run: flutter pub get
- name: Run tests
run: flutter test
Run Code Online (Sandbox Code Playgroud)
你不需要使用特定于 flutter 的容器,有一个Flutter Action可以在默认的 Windows、Linux 和 macOS 容器上运行。
这意味着构建您的 Flutter 应用程序就像使用操作(您还需要 Java 操作)然后运行 flutter build 命令一样简单。以下示例运行 aot 构建:
on: push
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
# The flutter action needs java so include it
- uses: actions/setup-java@v1
with:
java-version: '12.x'
# Include the flutter action
- uses: subosito/flutter-action@v1
with:
channel: 'stable'
# Get flutter packages
- run: flutter pub get
# Build :D
- run: flutter build aot
Run Code Online (Sandbox Code Playgroud)
如果您想了解更多信息,我写了一篇关于使用动作构建和测试颤振的博客文章。
| 归档时间: |
|
| 查看次数: |
2035 次 |
| 最近记录: |