GithubHelp home page GithubHelp logo

subosito / flutter-action Goto Github PK

View Code? Open in Web Editor NEW
2.1K 14.0 186.0 1.12 MB

Flutter environment for use in GitHub Actions. It works on Linux, Windows, and macOS.

License: MIT License

Shell 100.00%
github-actions actions flutter dart

flutter-action's Introduction

flutter-action

Flutter environment for use in GitHub Actions. It works on Linux, Windows, and macOS.

The following sections show how to configure this action.

Specifying Flutter version

Use specific version and channel

steps:
  - name: Clone repository
    uses: actions/checkout@v4
  - name: Set up Flutter
    uses: subosito/flutter-action@v2
    with:
      channel: stable
      flutter-version: 3.19.0
  - run: flutter --version

Use version from pubspec.yaml

This is inspired by actions/setup-go.

steps:
  - name: Clone repository
    uses: actions/checkout@v4
  - name: Set up Flutter
    uses: subosito/flutter-action@v2
    with:
      channel: stable
      flutter-version-file: pubspec.yaml # path to pubspec.yaml
  - run: flutter --version

Important

For flutter-version-file to work, you need to have the exact Flutter version defined in your pubspec.yaml:

Good

environment:
  sdk: ">=3.3.0 <4.0.0"
  flutter: 3.19.0

Bad

environment:
  sdk: ">=3.3.0 <4.0.0"
  flutter: ">= 3.19.0 <4.0.0"

Warning

Using flutter-version-file requires yq, which is not pre-installed in windows images. Install it yourself.

Use latest release for particular channel

steps:
  - name: Clone repository
    uses: actions/checkout@v4
  - name: Set up Flutter
    uses: subosito/flutter-action@v2
    with:
      channel: stable # or: beta, master (or main)
  - run: flutter --version

Use latest release for particular version and/or channel

steps:
  - name: Clone repository
    uses: actions/checkout@v4
  - name: Set up Flutter
    uses: subosito/flutter-action@v2
    with:
      channel: dev
      flutter-version: 1.22.x
  - run: flutter --version

Use particular version on any channel

steps:
  - name: Clone repository
    uses: actions/checkout@v4
  - name: Set up Flutter
    uses: subosito/flutter-action@v2
    with:
      channel: any
      flutter-version: 3.x
  - run: flutter --version

Use particular git reference on master channel

steps:
  - name: Clone repository
    uses: actions/checkout@v4
  - name: Set up Flutter
    uses: subosito/flutter-action@v2
    with:
      channel: master
      flutter-version: 5b12b74 # tag, commit or branch
  - run: flutter --version

Build Target

Build Android APK and app bundle:

steps:
  - name: Clone repository
    uses: actions/checkout@v4
  - name: Set up Flutter
    uses: subosito/flutter-action@v2
    with:
      flutter-version: 3.19.0
  - run: flutter pub get
  - run: flutter test
  - run: flutter build apk
  - run: flutter build appbundle

Build for iOS

Note

Building for iOS requires a macOS runner.

jobs:
  main:
    runs-on: macos-latest
    steps:
      - name: Clone repository
        uses: actions/checkout@v4
      - name: Set up Flutter
        uses: subosito/flutter-action@v2
        with:
          channel: stable
      - run: flutter pub get
      - run: flutter test
      - run: flutter build ios --release --no-codesign

Build for the web

steps:
  - name: Clone repository
    uses: actions/checkout@v4
  - name: Set up Flutter
    uses: subosito/flutter-action@v2
    with:
      channel: stable
  - run: flutter pub get
  - run: flutter test
  - run: flutter build web

Build for Windows

jobs:
  main:
    runs-on: windows-latest
    steps:
      - name: Clone repository
        uses: actions/checkout@v4
      - name: Set up Flutter
        uses: subosito/flutter-action@v2
        with:
          channel: stable
      - run: flutter build windows

Build for Linux desktop

jobs:
  main:
    runs-on: ubuntu-latest
    steps:
      - name: Clone repository
        uses: actions/checkout@v4
      - name: Set up Flutter
        uses: subosito/flutter-action@v2
        with:
          channel: stable
      - run: |
          sudo apt-get update -y
          sudo apt-get install -y ninja-build libgtk-3-dev
      - run: flutter build linux

Build for macOS desktop

Note

Building for macOS requires a macOS runner.

jobs:
  main:
    runs-on: macos-latest
    steps:
      - name: Clone repository
        uses: actions/checkout@v4
      - name: Set up Flutter
        uses: subosito/flutter-action@v2
        with:
          channel: stable
      - run: flutter build macos

Caching

Integration with actions/cache:

steps:
  - name: Clone repository
    uses: actions/checkout@v4
  - name: Set up Flutter
    uses: subosito/flutter-action@v2
    with:
      channel: stable
      cache: true
      # optional parameters follow
      cache-key: "flutter-:os:-:channel:-:version:-:arch:-:hash:" # optional, change this to force refresh cache
      cache-path: "${{ runner.tool_cache }}/flutter/:channel:-:version:-:arch:" # optional, change this to specify the cache path
      pub-cache-key: "flutter-pub:os:-:channel:-:version:-:arch:-:hash:" # optional, change this to force refresh cache of dart pub get dependencies
      pub-cache-path: "${{ runner.tool_cache }}/flutter/:channel:-:version:-:arch:" # optional, change this to specify the cache path
  - run: flutter --version

Note: cache-key, pub-cache-key, and cache-path have support for several dynamic values:

  • :os:
  • :channel:
  • :version:
  • :arch:
  • :hash:
  • :sha256:

Use outputs from flutter-action:

steps:
  - name: Clone repository
  - uses: actions/checkout@v4
  - name: Set up Flutter
    uses: subosito/flutter-action@v2
    id: flutter-action
    with:
      channel: stable
  - name: Print outputs
    shell: bash
    run: |
      echo CACHE-PATH=${{ steps.flutter-action.outputs.CACHE-PATH }}
      echo CACHE-KEY=${{ steps.flutter-action.outputs.CACHE-KEY }}
      echo CHANNEL=${{ steps.flutter-action.outputs.CHANNEL }}
      echo VERSION=${{ steps.flutter-action.outputs.VERSION }}
      echo ARCHITECTURE=${{ steps.flutter-action.outputs.ARCHITECTURE }}
      echo PUB-CACHE-PATH=${{ steps.flutter-action.outputs.PUB-CACHE-PATH }}
      echo PUB-CACHE-KEY=${{ steps.flutter-action.outputs.PUB-CACHE-KEY }}

If you don't need to install Flutter and just want the outputs, you can use the dry-run option:

steps:
  - name: Clone repository
  - uses: actions/checkout@v4
  - name: Set up Flutter
    uses: subosito/flutter-action@v2
    id: flutter-action
    with:
      channel: stable
      dry-run: true
  - run: |
      echo CACHE-PATH=${{ steps.flutter-action.outputs.CACHE-PATH }}
      echo CACHE-KEY=${{ steps.flutter-action.outputs.CACHE-KEY }}
      echo CHANNEL=${{ steps.flutter-action.outputs.CHANNEL }}
      echo VERSION=${{ steps.flutter-action.outputs.VERSION }}
      echo ARCHITECTURE=${{ steps.flutter-action.outputs.ARCHITECTURE }}
      echo PUB-CACHE-PATH=${{ steps.flutter-action.outputs.PUB-CACHE-PATH }}
      echo PUB-CACHE-KEY=${{ steps.flutter-action.outputs.PUB-CACHE-KEY }}
    shell: bash

Maintainers

flutter-action's People

Contributors

alessioluciani avatar bartekpacia avatar cclauss avatar darhaywa avatar davidmigloz avatar dependabot[bot] avatar devoncarew avatar goooler avatar gustl22 avatar jorgenpt avatar jpnurmi avatar kkimj avatar koji-1009 avatar kuhnroyal avatar kzrnm avatar majudhu avatar miiite avatar nabilnalakath avatar niccokunzmann avatar richardshiue avatar sidrao2006 avatar siongsng avatar subosito avatar tianhaoz95 avatar williambulin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

flutter-action's Issues

The process '/bin/tar' failed with exit code 2

image

and my action:

name: Flutter action

on:
  push:
    branches:
    - master
    - release/*

jobs:
  build:

    runs-on: ubuntu-latest

    container:
      image:  google/dart:latest

#     steps:
#       - uses: actions/checkout@v1
#       - 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 pub get
#       - run: flutter test
#       - run: flutter build apk
    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'
          channel: 'stable'
      - run: flutter packages get
      - run: flutter test
      - run: flutter build apk

Action taking long time to setup

Hello, thanks for the great work here, I've found this action extremely useful!
I was wondering how long it is expected to take to set up the flutter-action. For both 1.1 and 1.2, I've recently noticed the time to setup exceeding 15 minutes.

Note - I'm using this against Githubs OSX VMs, not a dedicated host.

Thanks in advance!

Screen Shot 2020-04-02 at 8 45 53 AM

Provide dartanalizer tool

First of all, thanks for this wonderfull plugin.

¿Could it be possible to export the dartanalizer tool to perform code style checks? I could help with a PR if you consider a good way to solve this issue :)

Push the apk to release

Hello,I want to know how to put the apk file generated by the github-action into the release of my github project.😊😊

install ninja to setup environment?

I used this github action a lot, but recently when I build linux packages, it always failed with CMake Error: CMake was unable to find a build program corresponding to "Ninja". CMAKE_MAKE_PROGRAM is not set., see flutter/flutter#59750 for more details.
It seems lack of ninja, could you install ninja by default in order for building linux packages.

Werror

Why does the "flutter build apk" gets started with the "-Werror" Flag? It crashes the whole build process...

Build iOS App

Is there a way to build an iOS app with this action?

how to start web build

when i use this to build flutter for web in stable, here is the error.
jobs:
build:
name: Test on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v1
- uses: actions/setup-java@v1
with:
java-version: '12.x'
- uses: subosito/flutter-action@v1
with:
channel: 'stable'
- run: flutter pub get
- run: flutter test
- run: flutter config --enable-web
- run: flutter build web

Run flutter config --enable-web1s
You may need to restart any open editors for them to read new settings.
Run flutter config --enable-web
Setting "enable-web" value to "true".
You may need to restart any open editors for them to read new settings.

Run flutter build web2s
##[error]Process completed with exit code 1.
Run flutter build web
flutter build web
shell: /bin/bash -e {0}
env:
JAVA_HOME: /opt/hostedtoolcache/jdk/12.0.2/x64
JAVA_HOME_12.0.2_x64: /opt/hostedtoolcache/jdk/12.0.2/x64
FLUTTER_HOME: /opt/hostedtoolcache/flutter/1.12.13-hotfix.8-stable/x64
Downloading Web SDK... 0.5s
"build web" is not currently supported.
##[error]Process completed with exit code 1.

The action init failed with http error

Hi, I was trying to use it for a flutter app I recently started, but the action init failed with the following message:

failed_screenshot

Here is the action workflow I added:

name: PR checks

on: [push]

jobs:
  test:
    name: Test on ${{ matrix.os }}
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ubuntu-latest, windows-latest, macos-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.8.4'
          channel: 'beta'
      - run: flutter pub get
      - run: flutter test

Do you know what might have happened and what might be a work around? I can probably post a fix if you can point me to where you think the problem is.

weird behavior when running in ubuntu-latest

the action works fine when I use Windows or Mac and give me error in build when I use ubuntu-latest or any other version

here is my setup

name: Build and release

on: push

jobs:
  my-job:
    name: Build App
    runs-on: windows-latest
    
    if: contains(github.event.head_commit.message, 'RLS')
    steps:
    - uses: avkviring/[email protected]
      env:
        telegram_to: ${{ secrets.TELEGRAM_TO }}  
        telegram_token: ${{ secrets.TELEGRAM_TOKEN }}
        event: ${{ toJson(github.event) }}
    - uses: actions/checkout@v1
    - uses: actions/setup-java@v1
      with:
        java-version: '12.x'
    - uses: subosito/flutter-action@v1
      with:
        flutter-version: '1.17.2'
    - run: dart --version  
    - run: flutter pub get
    - run: flutter build apk --release 
    - name: Push APK to Releases
      uses: ncipollo/release-action@v1
      
      with:
        artifacts: "build/app/outputs/apk/release/*.apk"
        token: ${{ secrets.TOKEN }}
        tag: v3

Right path for ~/.pub-cache

Hi

I need to write some json into this file: ~/.pub-cache/credentials.json for deploying a package to dart.dev

I've this step in my workflow:

- run: | 
    mkdir -p ~/.pub-cache 
    echo '${{ secrets.PUB_DEV_CREDENTIALS }}' > ~/.pub-cache/credentials.json

Deployment is still asking me for authorization, so I think ~/.pub-cache is not the right path but I don't know how to find the right one.

thanks

Allow usage of specific Flutter version without specifying channel

Hi!

I've stumbled across an issue recently, where the flutter-action would fail because of version/channel mismatch. This was triggered by Flutter's 1.17.1 going from beta to stable channel. My config was:

      - uses: subosito/flutter-action@v1
        with:
          flutter-version: "1.17.1"
          channel: beta

Now, since the 1.17.1 changed channel to stable, my config became invalid - there's no longer a '1.17.1' version with 'beta' channel in https://storage.googleapis.com/flutter_infra/releases/releases_linux.json.

Unfortunately, right now there's no way to avoid breakages in case an SDK version gets moved across channels - without specifying one, the 'stable' one is going to be used.

My proposal is to introduce a match-all channel value (let's say channel: any) that will ignore checking the channel match in the .json files.

xz: Cannot exec: No such file or directory

I've started getting this error when using Flutter Actions.

Output:

[CI/build] ⭐  Run subosito/[email protected]
[CI/build]   ☁  git clone 'https://github.com/subosito/flutter-action' # ref=v1.4.0
[CI/build]   🐳  docker cp src=act/[email protected] dst=/actions/
[CI/build]   💬  ::debug::latest version from channel stable is 1.22.2
[CI/build]   💬  ::debug::isExplicit: 1.22.2-stable
[CI/build]   💬  ::debug::explicit? true
[CI/build]   💬  ::debug::checking cache: /opt/hostedtoolcache/flutter/1.22.2-stable/x64
[CI/build]   💬  ::debug::not found
[CI/build]   💬  ::debug::Downloading Flutter from Google storage https://storage.googleapis.com/flutter_infra/releases/stable/linux/flutter_linux_1.22.2-stable.tar.xz
[CI/build]   💬  ::debug::Downloading https://storage.googleapis.com/flutter_infra/releases/stable/linux/flutter_linux_1.22.2-stable.tar.xz
[CI/build]   💬  ::debug::Destination /tmp/409f74e3-7821-45c1-a427-d7132a4b0b84
[CI/build]   💬  ::debug::download complete
[CI/build]   💬  ::debug::Checking tar --version
[CI/build]   💬  ::debug::tar (GNU tar) 1.30%0ACopyright (C) 2017 Free Software Foundation, Inc.%0ALicense GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.%0AThis is free software: you are free to change and redistribute it.%0AThere is NO WARRANTY, to the extent permitted by law.%0A%0AWritten by John Gilmore and Jay Fenlason.
| [command]/bin/tar x --warning=no-unknown-keyword -C /tmp/temp_748860406 -f /tmp/409f74e3-7821-45c1-a427-d7132a4b0b84
| tar (child): xz: Cannot exec: No such file or directory
| tar (child): Error is not recoverable: exiting now
| /bin/tar: Child returned status 2
| /bin/tar: Error is not recoverable: exiting now
[CI/build]   ❗  ::error::The process '/bin/tar' failed with exit code 2
[CI/build]   ❌  Failure - subosito/[email protected]
Error: exit with `FAILURE`: 1

main.yml:

# This is a basic workflow to help you get started with Actions

name: CI

# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
  push:
    branches:
      - '**'

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
  # This workflow contains a single job called "build"
  build:
    # The type of runner that the job will run on
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v1
      - name: Delete
        uses: ame-yu/action-delete-latest-release@v2
        with:
          github_token: ${{ secrets.PROJECT_TOKEN}}
      - uses: benjlevesque/[email protected]
        id: short-sha
        with:
          length: 10
      - run: echo $SHA
        env: 
          SHA: ${{ steps.short-sha.outputs.sha }}
      - uses: actions/[email protected]
        with:
          java-version: '12.x'
      - uses: subosito/[email protected]
        with:
          channel: 'stable' # or: 'dev' or 'beta'
      - run: flutter pub get
      - run: flutter build apk --split-per-abi
      - name: Create a Release APK
        uses: ncipollo/release-action@v1
        with:
          artifacts: "build/app/outputs/apk/release/*.apk"
          tag: ${{ env.SHA }}
          token: ${{ secrets.PROJECT_TOKEN }}

Thanks 👍

Auto increment build number & version

I have been using code magic, and they have a mechanism that allows you to reference a global build number for the build version/name. It would be nice if to explore a feature to auto increment builds.

Cannot run on self-hosted runner

I have been using this workflow for a while without problems.

Today I tried to switch to "self-hosted" runner and faced a problem with the flutter installation:

> Run flutter pub get
Running "flutter pub get" in mobile_app...                      
The current Flutter SDK version is 0.0.0-unknown.

Has anyone faced this issue?

Here is my full workflow:

# This is a basic workflow to help you get started with Actions

name: Flutter CI

# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
  push:
    paths: [ dev/mobile_app/**, .github/** ]
    branches: [ master, develop ]
  pull_request:
    paths: [ dev/mobile_app/**, .github/** ]
    branches: [ master, develop ]

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
  # Workflow lint
  flutter-test-lint:
    name: Flutter Test & Lint
    runs-on: self-hosted
    # Do not run this job on PR from develop to master.
    if: github.head_ref != 'develop' || github.base_ref != 'master'
    steps:
      - name: Checkout source code
        uses: actions/checkout@v2

      - name: Install Flutter
        uses: subosito/flutter-action@v1
        with:
          flutter-version: '1.12.13+hotfix.9'

      - name: Pub get
        working-directory: dev/mobile_app
        run: flutter pub get

      - name: Lint
        uses: kitek/[email protected]
        env:
          GITHUB_TOKEN: ${{ github.token }}
        with:
          check_name: 'Flutter Test & Lint'
          commit_sha: ${{ github.event.pull_request.head.sha }}
          working-directory: dev/mobile_app

      - name: Test
        working-directory: dev/mobile_app
        run: flutter test

  ##############################################################################
  #             FLUTTER BUILD DEVELOPMENT - ONLY IF NOT ON MASTER              #
  ##############################################################################
  flutter-dev-build:
    name: Flutter Build Development
    needs: flutter-test-lint
    runs-on: self-hosted
    # Run this job on push to develop, PR to develop or PR to master.
    if: github.ref == 'refs/heads/develop' || github.base_ref == 'develop' || github.base_ref == 'master'
    steps:
      - name: Checkout source code
        uses: actions/checkout@v2

      - name: Install Flutter
        uses: subosito/flutter-action@v1
        with:
          flutter-version: '1.12.13+hotfix.9'

      - name: Pub get
        working-directory: dev/mobile_app
        run: flutter pub get

      - name: Setup Development Android Keys
        working-directory: dev/mobile_app
        run: |
          echo "${{ secrets.ANDROID_DEBUG_KEYSTORE }}" | base64 --decode > android/app/key.jks
          echo "${{ secrets.ANDROID_KEYSTORE_PROPERTIES }}" | base64 --decode > android/key.properties
          echo "${{ secrets.ANDROID_FIREBASE_JSON_DEV }}" | base64 --decode > android/app/google-services.json

      - name: Fix build number
        env:
          NUM: ${{ github.run_number }}
        run: echo ::set-env name=BUILD_NUMBER::$(($NUM+500))

      - name: Build Patient DEV APK
        working-directory: dev/mobile_app
        run: flutter build apk --release --flavor patient_dev -t lib/main_patient.dart --build-number $BUILD_NUMBER

      - name: Upload build Patient DEV APK
        uses: actions/upload-artifact@v1
        with:
          name: patient_dev.apk
          path: dev/mobile_app/build/app/outputs/apk/patient_dev/release/app-patient_dev-release.apk

      - name: Build Sampler DEV APK
        working-directory: dev/mobile_app
        run: flutter build apk --release --flavor sampler_dev -t lib/main_sampler.dart --build-number $BUILD_NUMBER

      - name: Upload build Sampler DEV APK
        uses: actions/upload-artifact@v1
        with:
          name: sampler_dev.apk
          path: dev/mobile_app/build/app/outputs/apk/sampler_dev/release/app-sampler_dev-release.apk

  ##############################################################################
  #              FLUTTER BUILD PRODUCTION - ONLY ON MASTER                     #
  ##############################################################################
  flutter-prod-build:
    name: Flutter Build Production
    needs: flutter-test-lint
    runs-on: self-hosted
    # Run only in push to master.
    if: github.event_name == 'push' && github.ref == 'refs/heads/master'
    steps:
      - name: Checkout source code
        uses: actions/checkout@v2

      - name: Install Flutter
        uses: subosito/flutter-action@v1
        with:
          flutter-version: '1.12.13+hotfix.9'

      - name: Pub get
        working-directory: dev/mobile_app
        run: flutter pub get

      - name: Setup Production Android Keys
        working-directory: dev/mobile_app
        run: |
          echo "${{ secrets.ANDROID_RELEASE_KEYSTORE }}" | base64 --decode > android/app/key.jks
          echo "${{ secrets.ANDROID_KEYSTORE_PROPERTIES }}" | base64 --decode > android/key.properties
          echo "${{ secrets.ANDROID_FIREBASE_JSON_PROD }}" | base64 --decode > android/app/google-services.json

      - name: Fix build number
        env:
          NUM: ${{ github.run_number }}
        run: echo ::set-env name=BUILD_NUMBER::$(($NUM+500))

      - name: Build Patient PROD APK
        working-directory: dev/mobile_app
        run: flutter build apk --release --flavor patient_prod -t lib/main_patient.dart --build-number $BUILD_NUMBER

      - name: Upload build Patient PROD APK
        uses: actions/upload-artifact@v1
        with:
          name: patient_prod.apk
          path: dev/mobile_app/build/app/outputs/apk/patient_prod/release/app-patient_prod-release.apk

      - name: Build Sampler PROD APK
        working-directory: dev/mobile_app
        run: flutter build apk --release --flavor sampler_prod -t lib/main_sampler.dart --build-number $BUILD_NUMBER

      - name: Upload build Sampler PROD APK
        uses: actions/upload-artifact@v1
        with:
          name: sampler_prod.apk
          path: dev/mobile_app/build/app/outputs/apk/sampler_prod/release/app-sampler_prod-release.apk

      - name: Build Patient AppBundle
        working-directory: dev/mobile_app
        run: flutter build appbundle --release --flavor patient_prod -t lib/main_patient.dart --build-number $BUILD_NUMBER

      - name: Upload build Patient AppBundle
        uses: actions/upload-artifact@v1
        with:
          name: patient_prod.aab
          path: dev/mobile_app/build/app/outputs/bundle/patient_prodRelease/app-patient_prod-release.aab

      - name: Build Sampler AppBundle
        working-directory: dev/mobile_app
        run: flutter build appbundle --release --flavor sampler_prod -t lib/main_sampler.dart --build-number $BUILD_NUMBER

      - name: Upload build Sampler AppBundle
        uses: actions/upload-artifact@v1
        with:
          name: sampler_prod.aab
          path: dev/mobile_app/build/app/outputs/bundle/sampler_prodRelease/app-sampler_prod-release.aab

Got error when using it

My workflow

name: Flutter test

on: [push]

jobs:
  build:
    runs-on: ubuntu-latest

    container:
      image: google/dart:latest

    steps:
      - uses: actions/checkout@v2
      - uses: subosito/flutter-action@v1
        with:
          channel: "stable"
      - name: Install dependencies
        run: flutter pub get
      - name: Run tests
        run: pub run test

Result

 Run subosito/flutter-action@v13s
##[error]The process '/usr/bin/tar' failed with exit code 2
Run subosito/flutter-action@v1
/usr/bin/docker exec  e96d380970b9fa8c036bc079c8d0da8dd2dc356344626e92d74d60e120268fc3 sh -c "cat /etc/*release | grep ^ID"
Running JavaScript Action with default external tool: node12
/usr/bin/tar --version
tar (GNU tar) 1.30
Copyright (C) 2017 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by John Gilmore and Jay Fenlason.
/usr/bin/tar x --warning=no-unknown-keyword -C /__w/_temp/temp_1883226862 -f /__w/_temp/aab85ca5-43e9-4ca2-b9c7-24841ffa87ce
tar (child): xz: Cannot exec: No such file or directory
tar (child): Error is not recoverable: exiting now
/usr/bin/tar: Child returned status 2
/usr/bin/tar: Error is not recoverable: exiting now
##[error]The process '/usr/bin/tar' failed with exit code 2

What's wrong with it?

folder name

Could we rename this part 1.9.1-hotfix.2-stable of this folder /opt/hostedtoolcache/flutter/1.9.1-hotfix.2-stable to just stable in the case we use the action like that

    - uses: subosito/flutter-action@v1
      with:
        channel: 'stable'

What i would like is to be able to add the credentials.json to the .pub-cache folder to automatically upload my package to pub without modifying the cd pipeline.

Error using '/bin/tar' in my container

Hello,

I'm trying to set up my first Github Action, and im getting an error using your flutter-action:
I ll attach log to the issue.

Here is my actual dart.yml

on: [push]

jobs:
  build:
    runs-on: ubuntu-latest

    container:
      image:  google/dart:latest

    steps:
      - uses: actions/checkout@v1
      - name: Flutter action
        uses: subosito/[email protected]
      - name: Install dependencies
        run: flutter pub get
      - name: Run tests
        run: flutter test
      - name: Build APK
        run: flutter build apk

And i got an error about the /bin/tar of the container

/usr/bin/docker exec  5b59092a4ed8fd5c8f78f3a026cccaf960b4dc3145c3ea07a0a9b34a170e6eb3 sh -c "cat /etc/*release | grep ^ID"
Running JavaScript Action with default external tool: node12
/bin/tar x -C /__w/_temp/temp_401169546 -f /__w/_temp/b11cab69-922a-4229-b27e-57f05f10e955
tar (child): xz: Cannot exec: No such file or directory
tar (child): Error is not recoverable: exiting now
/bin/tar: Child returned status 2
/bin/tar: Error is not recoverable: exiting now
##[error]The process '/bin/tar' failed with exit code 2
##[error]Node run failed with exit code 1

So here is my log archive:
logs_4.zip

Failed to download Actions

Hi i did setup the .yml file ` #The name of your workflow.
name: Flutter Testing

#Trigger the workflow on push or pull request
on: [push,pull_request]

#A workflow run is made up of one or more jobs. Jobs run in parallel by default.
jobs:

test:
  #The type of machine to run the job on. [windows,macos, ubuntu , self-hosted]
  runs-on: ubuntu-latest
  #sequence of tasks called
  steps:
    # The branch or tag ref that triggered the workflow will be checked out.
    # https://github.com/actions/checkout
    - uses: actions/checkout@v1
    - uses: actions/setup-java@v1
      with:
        java-version: '12'
    # Setup a flutter environment.
    # https://github.com/marketplace/actions/flutter-action
    - uses: subosito/[email protected];
      with:
        channel: 'stable'
    - run: flutter pub get
    # run static analys code
    - run: flutter  analyze
    # run  flutter widgets tests  and unit tests
    - run: flutter test --coverage

`

The CI output: -

Current runner version: '2.165.2'
Prepare workflow directory
Prepare all required actions
Download action repository 'actions/checkout@v1'
Download action repository 'actions/setup-java@v1'
Download action repository 'subosito/[email protected];'
##[warning]Failed to download action 'https://api.github.com/repos/subosito/flutter-action/tarball/v1.2.0;'. Error Response status code does not indicate success: 404 (Not Found).
##[warning]Back off 27.431 seconds before retry.
##[warning]Failed to download action 'https://api.github.com/repos/subosito/flutter-action/tarball/v1.2.0;'. Error Response status code does not indicate success: 404 (Not Found).
##[warning]Back off 26.915 seconds before retry.
##[error]Response status code does not indicate success: 404 (Not Found)

Error while actions

image

I got errors like above. Could you give me some hints to debug it?
I just copied and pasted your example scripts.

workflows

name: Flutter Test and Build

on: [push]

jobs:
  test:
    name: Test on ${{ matrix.os }}
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ubuntu-latest, windows-latest, macos-latest]
    steps:
      - uses: actions/checkout@v1
      - uses: actions/setup-java@v1
        with:
          java-version: '12.x'
      - uses: subosito/flutter-action@v1
        with:
          channel: 'master'
      - run: flutter pub get
      - run: flutter test
      - run: flutter build apk

get a warning using flutter-action@v1

I use flutter-action in the following jobs.

  build-android:
    # The type of runner that the job will run on
    runs-on: ubuntu-latest
    needs: analyze_and_test

    steps:
      - uses: actions/checkout@v1
      - uses: actions/setup-java@v1
        with:
          java-version: "12.x"
      - uses: subosito/flutter-action@v1
        with:
          flutter-version: "1.20.x" # you can use 1.20
          channel: "stable"
      - run: flutter pub get
      - name: prepare google-services.json
        env:
          GOOGLE_SERVICES_BASE64: ${{ secrets.GOOGLE_SERVICES_BASE64 }}
        run: echo $GOOGLE_SERVICES_BASE64 | base64 --decode --ignore-garbage > ${GITHUB_WORKSPACE}/android/app/google-services.json
      - run: flutter build apk
      - name: Slack Notification
        uses: homoluctus/slatify@master
        if: always()
        with:
          type: ${{ job.status }}
          job_name: "*Android Build Check*"
          mention: "here"
          mention_if: "failure"
          commit: true
          token: ${{ secrets.GITHUB_TOKEN }}
          url: ${{ secrets.SLACK_WEBHOOK }}

I can see the following GitHubActions log.

Run subosito/flutter-action@v1
 with:
    flutter-version: 1.20.x
    channel: stable
  env:
    JAVA_HOME_12.0.2_x64: /opt/hostedtoolcache/jdk/12.0.2/x64
    JAVA_HOME: /opt/hostedtoolcache/jdk/12.0.2/x64
    JAVA_HOME_12_0_2_X64: /opt/hostedtoolcache/jdk/12.0.2/x64
/bin/tar x --warning=no-unknown-keyword -C /home/runner/work/_temp/temp_1653559679 -f /home/runner/work/_temp/79a08208-60bf-4c1c-821e-064105fd3c4d
Warning: The `set-env` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2020-10-01-github-actions-deprecating-set-env-and-add-path-commands/
Warning: The `add-path` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2020-10-01-github-actions-deprecating-set-env-and-add-path-commands/
Warning: The `add-path` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2020-10-01-github-actions-deprecating-set-env-and-add-path-commands/

set-env and add-path seem to be disabled.
There is no problem at the moment, but it may become unusable in the future.

Unexpected HTTP response: 404 when ommit channel and specify flutter-version

I've get this error when I specify flutter-version and ommit channel.

##[error]Unexpected HTTP response: 404

I get the error on v1 and v1.1.1.

If I understand the description correctly, channel isn't since October 2019 supported and you need to use flutter-version.

If I wrong, how can I use the master version of flutter ?

Link to pubspec.yaml instead of specifying version

Currently, when a new flutter version is released and one wants to update their project, one must always change the version in pubspec.yaml and the version in the github action.

This is not terribly, but a little annoyance because one has to keep it in mind when changing the version.

I came up with three ideas to solve this:

  1. In the yaml github action file link to the version in pubspec.yaml
  2. Add a script to the github action file that substitutes the version when the github action is executed
  3. Ask if the feature can be added.

The first version is not possible, as far as I understand it, because in yaml one can' t reference to a line in another file.

The second solution is probably not possible either, because one would have to replace the github action file while it is running. Did not test this.

I can't think of any other solution at the moment, so I'm asking if you consider this a problem and want to implement it.

beta channel build breaks with updated dependency

We use the Flutter beta channel both locally and in our GitHub actions. We just updated our project dependency on provider to 4.1.1. Our app successfully builds locally but fails on GitHub with

Run flutter build web --target=lib/main_web.dart
  flutter build web --target=lib/main_web.dart
  shell: /bin/bash -e {0}
  env:
    FLUTTER_HOME: /opt/hostedtoolcache/flutter/1.17.0-3.4.pre-beta/x64
Downloading Web SDK...                                              0.8s
Running "flutter pub get" in x_app...                     
The current Flutter SDK version is 1.17.0-3.4.pre.

Because provider 4.1.1 requires Flutter SDK version >=1.17.0 and no versions of provider match >4.1.1 <5.0.0, provider ^4.1.1 is forbidden.

So, because x_app depends on provider ^4.1.1, version solving failed.

Locally we show the beta channel to be

Flutter is already up to date on channel beta
Flutter 1.17.0 • channel beta • https://github.com/flutter/flutter.git
Framework • revision e6b34c2b5c (9 days ago) • 2020-05-02 11:39:18 -0700
Engine • revision 540786dd51
Tools • Dart 2.8.1

This seems related to the fix #39 .

flutter_driver problem matchers or annotations

flutter_driver output around errors and failed tests is a mess, anyone have any luck developing problem matchers or annotations integrations to get useful information about failures shown in the GitHub UI so devs don't have to dig through the logs?

How to cache flutter action env.

I see the java and flutter action will use 1min.
image

And I see that the GitHub actions seems to support the cache.
How can I cache the flutter environment?

Flutter project not in root of repo, fails.

If you have a Flutter project in a folder in your repo, this action will fail.

Maybe support a param to specify the folder to the Flutter project and just default to root?

Run flutter pub get
Error: No pubspec.yaml file found.
This command should be run from the root of your Flutter project.
Do not run this command from the root of your git clone of Flutter.
##[error]Process completed with exit code 1.

publish `example` does not work. (building flutter app in other directory than root)

general project structure, as you can see here flutter_timeline

my config looks like this

name: Flutter Web
on:
  push:
    branches:
      - master
jobs:
  build:
    name: Build Web
    env:
      my_secret: ${{secrets.commit_secret}}
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v1
      - uses: subosito/flutter-action@v1
        with:
          channel: 'dev'
      - run: cd example
      - run: flutter config --enable-web
      - run: flutter pub get
      - run: flutter build web --release
      - run: |
          cd build/web
          git init
          git config --global user.email [email protected]
          git config --global user.name softmarshmallow
          git status
          git remote add origin https://${{secrets.commit_secret}}@github.com/softmarshmallow/flutter-timeline.git
          git checkout -b gh-pages
          git add --all
          git commit -m "update"
          git push origin gh-pages -f

ERROR

Target file "lib/main.dart" not found.

 Run flutter build web --release8s
    FLUTTER_HOME: /opt/hostedtoolcache/flutter/1.22.0-1.0.pre-dev/x64
Run flutter build web --release
  flutter build web --release
  shell: /bin/bash -e {0}
  env:
    my_secret: ***
    FLUTTER_HOME: /opt/hostedtoolcache/flutter/1.22.0-1.0.pre-dev/x64
Downloading Web SDK...                                              1.1s
Target file "lib/main.dart" not found.
##[error]Process completed with exit code 1.

why wont it find directory? does it explicitly runs on root? not the pwd?

Channels are outdated

I think that the action should always provide the latest Flutter versions for the specified channels.

For example, the current Dart version in Flutter stable is 2.8.4, however, your action uses Dart 2.7.2.

Error with Android licences for Android R

Hello,

After upgrading flutter to the latest version (1.17.0) my build for Android on Github Actions don't works anymore.

I have this following error:

Could not determine the dependencies of task ':app_settings:compileReleaseKotlin'.
Failed to install the following SDK components: platforms;android-R Android SDK Platform R
The SDK directory is not writable (/usr/local/lib/android/sdk)

Here is a flutter doctor on the runner:

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, v1.17.1, on Linux, locale C.UTF-8)
[!] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses
[!] Android Studio (not installed)
[!] Connected device
! No devices available

Do you have any ideas ?

Thank you

Error running Gradle (key store issue)

Hi all. So I'm relatively new to Flutter, but I currently have this Action running inside a repo to check that the app can build properly. It was passing for a while, but ever since I added a key store to the app (to prep for an Android release), flutter-action has been failing to build in CI with the following error:

ProcessException: Process "/home/runner/work/..." exited abnormally:
Starting a Gradle Daemon (subsequent builds will be faster)
  Command: /home/runner/work/.../android/gradlew app:properties

My question is, what is the recommended way to deal with the key store file, since you're not supposed to check it in to source control? Thanks in advance!

Error when using channels

Hello!

Since the last Flutter update three days ago, the channel feature seems broken :(

Here is an excerpt:

      - uses: subosito/flutter-action@v1
        with:
          channel: 'beta' # flutter web is not stable yet
      - run: flutter --version

Before the Flutter update three days ago:

Run flutter --version
Flutter 1.17.0-3.4.pre • channel beta • https://github.com/flutter/flutter.git

Now:

Run flutter --version
Flutter 1.17.0 • channel stable • https://github.com/flutter/flutter.git

I assume the path to download Flutter archive changed?

Thanks for the GithubAction, it's really neat!

(example live URL: https://github.com/Neamar/turn_me_on/runs/656069282?check_suite_focus=true)

Error using dev channel

My code

name: Dart CI

on: [push]

jobs:
 build:

   runs-on: ubuntu-latest

   container:
     image:  google/dart:latest


   steps:
     - uses: actions/checkout@v1
     - uses: actions/setup-java@v1
       with:
         java-version: '12.x'
     - uses: subosito/flutter-action@v1
       with:
         channel: 'dev'
     - run: flutter pub get
     - run: flutter test
     - run: flutter build apk

Output:

 Run subosito/flutter-action@v15s
##[error]Node run failed with exit code 1
Run subosito/flutter-action@v1
/usr/bin/docker exec  b88ae8e182610cd8a1da6822d4fabc7b15544e1957c9630acdbe6fab4b6bf2ce sh -c "cat /etc/*release | grep ^ID"
Running JavaScript Action with default external tool: node12
/bin/tar x -C /__w/_temp/temp_457657794 -f /__w/_temp/6da63d29-5d2f-421d-83f6-a4942147e494
tar (child): xz: Cannot exec: No such file or directory
tar (child): Error is not recoverable: exiting now
/bin/tar: Child returned status 2
/bin/tar: Error is not recoverable: exiting now
##[error]The process '/bin/tar' failed with exit code 2
##[error]Node run failed with exit code 1

flutter drive?

Hi all,

I know you need the simulator, but thought I'd ask if I could run:

- run: flutter drive --target=test_driver/app.dart

Thanks.

Support New Release Version Format

The flutter release tag format has changed to exclude the v prefix so the following fails to find the release

with:
  flutter-version: "1.17.0-dev.3.0"
  channel: beta

It is looking for beta/macos/flutter_macos_v1.17.0-dev.3.1-beta.zip instead of beta/macos/flutter_macos_1.17.0-dev.3.1-beta.zip in https://storage.googleapis.com/flutter_infra/releases/releases_macos.json.

I think it would be more robust to just take the exact flutter-version specified instead of having the action manipulate it internally.

Cannot Run subosito/flutter-action@v1

CI doesn't run due to flutter-action error.
image

Error:

Run subosito/flutter-action@v1
  with:
    flutter-version: 1.22.0-12.0.pre
    channel: dev
  env:
    JAVA_HOME_12.0.2_x64: /__t/jdk/12.0.2/x64
    JAVA_HOME: /__t/jdk/12.0.2/x64
    JAVA_HOME_12_0_2_X64: /__t/jdk/12.0.2/x64
/usr/bin/docker exec  eac03e88df5b8c5709cc0f93a33a43d78b820486713911f8ea0c28053d9066be sh -c "cat /etc/*release | grep ^ID"
/usr/bin/tar x --warning=no-unknown-keyword -C /__w/_temp/temp_253760480 -f /__w/_temp/19d84305-8dca-453d-9633-2ee35b7d4a4d
tar (child): xz: Cannot exec: No such file or directory
tar (child): Error is not recoverable: exiting now
/usr/bin/tar: Child returned status 2
/usr/bin/tar: Error is not recoverable: exiting now
##[error]The process '/usr/bin/tar' failed with exit code 2

Code:

name: Flutter Release

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]


jobs:
  build:
    runs-on: ubuntu-latest
    container: 
      image: google/dart: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.22.0-12.0.pre'
        channel: 'dev'
    - run: flutter channel master 
    - run: flutter upgrade
    - run: flutter doctor -v
    - run: flutter config --enable-web
    - run: flutter pub get
    - run: flutter test
    - run: flutter build apk
    - run: flutter build web

NDK version error

* What went wrong:

Execution failed for task ':app:stripProfileDebugSymbols'.

> No version of NDK matched the requested version 21.0.6113669. Versions available locally: 21.3.6528147

For details see https://github.com/Hope-Studio/inNENU-flutter/runs/887156839?check_suite_focus=true

And

* What went wrong:

Execution failed for task ':app:lintVitalRelease'.
> Could not resolve all artifacts for configuration ':app:debugRuntimeClasspath'.
   > Failed to transform libs.jar to match attributes {artifactType=processed-jar, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}.
      > Execution failed for JetifyTransform: /home/runner/work/inNENU-flutter/inNENU-flutter/build/app/intermediates/flutter/debug/libs.jar.

         > Transform's input file does not exist: /home/runner/work/inNENU-flutter/inNENU-flutter/build/app/intermediates/flutter/debug/libs.jar. (See https://issuetracker.google.com/issues/158753935)

For details see https://github.com/Hope-Studio/inNENU-flutter/runs/886996626?check_suite_focus=true

Though I am new to flutter, but I believe the second one is this action's issue, because build/ folder should not be contained in version control.

For the first one, I will try to fix it, but I don't think running flutter build apk --debug or flutter build apk --profile is needed to generate build/app/intermediates/flutter/debug/libs.jar for a release build.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.