Reputation: 15144
I'm trying out GitHub Actions to build my Flutter app but I don't know which container image to choose from.
Is there a trusted container image that I can use for Flutter?
What are the adjustments I need to make so that the Flutter SDK is available during my build step?
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.
I adapted the dart.yml
file generated by GitHub Actions to look like this:
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
Upvotes: 14
Views: 6311
Reputation: 8687
You don't need to use a flutter specific container, there is a Flutter Action available that runs on the default Windows, Linux and macOS containers.
This means that building your flutter app is as simple as using the action and then running the flutter build command. The following example runs an Android apk build:
on: push
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- name: Clone repository
uses: actions/checkout@v4
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
channel: stable
# Get flutter packages
- run: flutter pub get
# Build :D
- run: flutter build apk
I wrote a blog post about building and testing flutter using actions if you'd like to learn more.
Upvotes: 16
Reputation: 12335
I leave here a link to the production project with the app in the stores.
Maybe it saves time for somebody, I would be glad to have it when I implement it.
Upvotes: 0
Reputation: 1088
I let my one running without Docker.
You could try to install flutter and run flutter pub get. I used in my example subosito/flutter-action@v1
name: CI
on:
pull_request:
branches:
- development
- master
jobs:
test:
name: Flutter Tests
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:
flutter-version: '1.7.8+hotfix.4'
- run: flutter doctor
- run: flutter pub get
- run: flutter test
Upvotes: 3
Reputation: 15144
@Rezwan provided the link to the image I was looking for.
I'm still not able to run it due to the following issues:
https://github.com/cirruslabs/docker-images-flutter/issues/27
GitHub Actions workflow error: Cannot create file, path = '/github/home/.flutter'
Upvotes: 0