mirror of
https://github.com/Dr-Blank/Vaani.git
synced 2026-02-02 15:39:34 +00:00
Add Flutter setup composite action for streamlined environment configuration
This commit is contained in:
parent
d55ddc5b78
commit
49a24b675e
2 changed files with 64 additions and 7 deletions
57
.github/actions/flutter-setup/action.yaml
vendored
Normal file
57
.github/actions/flutter-setup/action.yaml
vendored
Normal file
|
|
@ -0,0 +1,57 @@
|
||||||
|
# .github/actions/flutter-setup/action.yml
|
||||||
|
name: "Flutter Setup Composite Action"
|
||||||
|
description: "Checks out code, sets up Java/Flutter, caches, and runs pub get"
|
||||||
|
|
||||||
|
# Define inputs for customization (optional, but good practice)
|
||||||
|
inputs:
|
||||||
|
flutter-channel:
|
||||||
|
description: "Flutter channel to use (stable, beta, dev, master)"
|
||||||
|
required: false
|
||||||
|
default: "stable"
|
||||||
|
java-version:
|
||||||
|
description: "Java version to set up"
|
||||||
|
required: false
|
||||||
|
default: "17"
|
||||||
|
|
||||||
|
runs:
|
||||||
|
using: "composite" # Specify this is a composite action
|
||||||
|
steps:
|
||||||
|
# Note: Checkout needs to happen *within the job using the composite action* usually.
|
||||||
|
# However, for self-contained setup, we can include it here.
|
||||||
|
# If you need checkout options controlled by the main workflow, move checkout
|
||||||
|
# to be the first step in the main workflow's job *before* calling this action.
|
||||||
|
- name: Checkout repository (within composite)
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
submodules: recursive
|
||||||
|
|
||||||
|
- name: Set up Java
|
||||||
|
uses: actions/setup-java@v4
|
||||||
|
with:
|
||||||
|
distribution: "temurin"
|
||||||
|
java-version: ${{ inputs.java-version }}
|
||||||
|
|
||||||
|
- name: Set up Flutter SDK
|
||||||
|
uses: subosito/flutter-action@v2
|
||||||
|
with:
|
||||||
|
channel: ${{ inputs.flutter-channel }}
|
||||||
|
flutter-version-file: pubspec.yaml
|
||||||
|
cache: true # Cache Flutter SDK itself
|
||||||
|
|
||||||
|
- name: Cache Flutter dependencies
|
||||||
|
id: cache-pub
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: ${{ env.FLUTTER_HOME }}/.pub-cache
|
||||||
|
key: ${{ runner.os }}-flutter-pub-${{ hashFiles('**/pubspec.lock') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-flutter-pub-
|
||||||
|
# Use shell: bash for potential cross-platform compatibility in complex commands
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
- name: Get Flutter dependencies
|
||||||
|
run: flutter pub get
|
||||||
|
# Use shell: bash for potential cross-platform compatibility in complex commands
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
# Add other common setup steps if needed
|
||||||
14
.github/workflows/flutter_test.yaml
vendored
14
.github/workflows/flutter_test.yaml
vendored
|
|
@ -14,14 +14,14 @@ on:
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
name: Test
|
name: Test
|
||||||
|
runs-on: ubuntu-latest
|
||||||
uses: ./.github/workflows/flutter-setup.yaml
|
|
||||||
secrets: inherit
|
|
||||||
with:
|
|
||||||
flutter-channel: stable
|
|
||||||
java-version: 17
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
- name: Setup Flutter Environment
|
||||||
|
uses: ./.github/actions/flutter-setup # Path to the composite action directory
|
||||||
|
# Pass inputs if needed (optional, using defaults here)
|
||||||
|
# with:
|
||||||
|
# flutter-channel: 'stable'
|
||||||
|
# java-version: '17'
|
||||||
# Debug: Echo current directory contents
|
# Debug: Echo current directory contents
|
||||||
- name: List root directory contents
|
- name: List root directory contents
|
||||||
run: |
|
run: |
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue