subosito / flutter-action

Flutter environment for use in GitHub Actions. It works on Linux, Windows, and macOS.
MIT License
2.16k stars 191 forks source link

Windows fails: `bash: command not found` #302

Closed tomgilder closed 2 months ago

tomgilder commented 2 months ago

Hello, my workflow is failing on Windows with bash: command not found, here's the error log:

Run subosito/flutter-action@v2
  with:
    channel: stable
    architecture: X64
    cache: false
    pub-cache-path: default
    dry-run: false

Run chmod +x "$GITHUB_ACTION_PATH/setup.sh"
  chmod +x "$GITHUB_ACTION_PATH/setup.sh"
  Error: bash: command not found

This was reported by someone else in #159.

I'm using a matrix to build on multiple architectures:

name: Build

on:
  workflow_call:
    inputs:
      run-tests:
        required: true
        type: boolean
      dry-run:
        required: true
        type: boolean
      pre-release:
        required: true
        type: boolean
      version:
        required: true
        type: string

jobs:
  package_vscode:
    runs-on: ${{ matrix.labels }}

    strategy:
      matrix:
        include:
          - architecture: darwin-arm64
            labels: [self-hosted, macOS, ARM64]
          - architecture: darwin-x64
            labels: [self-hosted, macOS, x64]
          - architecture: win32-x64
            labels: [self-hosted, Windows, x64]

    timeout-minutes: 20
    steps:
      - uses: actions/checkout@v4

      - uses: subosito/flutter-action@v2
        with:
          channel: "stable"

Thanks for the great workflow 👍

tomgilder commented 2 months ago

Okay, for anyone else facing this on a self-hosted runner, I fixed it like this:

  1. Added bash to PATH by adding C:\Program Files\Git\bin to my local user's path
  2. Re-installed the GitHub runner to use my user account using --windowslogonaccount and --windowslogonpassword

These issues helped: https://github.com/actions/runner/issues/497 https://github.com/actions/runner/issues/2540

I also needed to install jq from Chocolatey: https://community.chocolatey.org/packages/jq