mirror of
https://github.com/Dr-Blank/Vaani.git
synced 2026-02-24 02:09:35 +00:00
Replace setup-env action with reusable flutter-setup workflow; streamline CI configuration and enhance dependency management
This commit is contained in:
parent
0d2db7778a
commit
d55ddc5b78
3 changed files with 74 additions and 44 deletions
25
.github/actions/setup-env.yaml
vendored
25
.github/actions/setup-env.yaml
vendored
|
|
@ -1,25 +0,0 @@
|
||||||
name: 🛠️ Setup Env
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_call:
|
|
||||||
inputs:
|
|
||||||
flutter_version:
|
|
||||||
required: false
|
|
||||||
type: string
|
|
||||||
default: "stable"
|
|
||||||
description: "Flutter version to use. Default is 'stable'."
|
|
||||||
jobs:
|
|
||||||
setup:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
submodules: recursive
|
|
||||||
- name: Set up Flutter
|
|
||||||
uses: subosito/flutter-action@v2
|
|
||||||
with:
|
|
||||||
channel: "${{ inputs.flutter_version }}"
|
|
||||||
flutter-version-file: pubspec.yaml
|
|
||||||
- name: Install dependencies
|
|
||||||
run: flutter pub get
|
|
||||||
49
.github/workflows/flutter-setup.yaml
vendored
Normal file
49
.github/workflows/flutter-setup.yaml
vendored
Normal file
|
|
@ -0,0 +1,49 @@
|
||||||
|
name: 🛠️ Reusable Flutter Setup
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
flutter-channel:
|
||||||
|
description: "Flutter channel to use (stable, beta, dev, master)"
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
default: "stable"
|
||||||
|
java-version:
|
||||||
|
description: "Java version to set up"
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
default: "17"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
setup:
|
||||||
|
name: Setup Flutter Environment
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
submodules: recursive
|
||||||
|
- name: Set up Java
|
||||||
|
uses: actions/setup-java@v4
|
||||||
|
with:
|
||||||
|
distribution: "temurin"
|
||||||
|
# Use the input value, fallback to default if not provided
|
||||||
|
java-version: ${{ inputs.java-version }}
|
||||||
|
- name: Set up Flutter
|
||||||
|
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 # Give the step an ID to potentially reference its outputs later if needed
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: ${{ env.FLUTTER_HOME }}/.pub-cache
|
||||||
|
# Use a consistent key structure based on the lock file
|
||||||
|
key: ${{ runner.os }}-flutter-pub-${{ hashFiles('**/pubspec.lock') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-flutter-pub-
|
||||||
|
|
||||||
|
- name: Get Flutter dependencies
|
||||||
|
run: flutter pub get
|
||||||
44
.github/workflows/flutter_test.yaml
vendored
44
.github/workflows/flutter_test.yaml
vendored
|
|
@ -5,17 +5,23 @@ on:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
pull_request:
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
# Allows you to run this workflow manually from the Actions tab
|
# Allows you to run this workflow manually from the Actions tab
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
runs-on: ubuntu-latest
|
name: Test
|
||||||
steps:
|
|
||||||
- name: setup env
|
|
||||||
uses: ./.github/actions/setup-env.yaml
|
|
||||||
|
|
||||||
|
uses: ./.github/workflows/flutter-setup.yaml
|
||||||
|
secrets: inherit
|
||||||
|
with:
|
||||||
|
flutter-channel: stable
|
||||||
|
java-version: 17
|
||||||
|
|
||||||
|
steps:
|
||||||
# Debug: Echo current directory contents
|
# Debug: Echo current directory contents
|
||||||
- name: List root directory contents
|
- name: List root directory contents
|
||||||
run: |
|
run: |
|
||||||
|
|
@ -37,14 +43,21 @@ jobs:
|
||||||
echo "\nSubmodule details:"
|
echo "\nSubmodule details:"
|
||||||
git submodule foreach 'echo $path: && pwd && ls -la'
|
git submodule foreach 'echo $path: && pwd && ls -la'
|
||||||
|
|
||||||
- name: Run flutter tests
|
- name: Run static analysis
|
||||||
|
run: flutter analyze
|
||||||
|
|
||||||
|
- name: Run tests
|
||||||
run: flutter test
|
run: flutter test
|
||||||
|
|
||||||
build_android:
|
build_android:
|
||||||
|
name: Build Android APKs
|
||||||
needs: test
|
needs: test
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: ./.github/actions/setup-env.yaml
|
- uses: ./.github/workflows/flutter-setup.yaml
|
||||||
|
with:
|
||||||
|
flutter-channel: stable
|
||||||
|
java-version: 17
|
||||||
|
|
||||||
- name: Decode android/upload.jks
|
- name: Decode android/upload.jks
|
||||||
run: echo "${{ secrets.UPLOAD_KEYSTORE_JKS }}" | base64 --decode > android/upload.jks
|
run: echo "${{ secrets.UPLOAD_KEYSTORE_JKS }}" | base64 --decode > android/upload.jks
|
||||||
|
|
@ -52,18 +65,16 @@ jobs:
|
||||||
- name: Decode android/key.properties
|
- name: Decode android/key.properties
|
||||||
run: echo "${{ secrets.KEY_PROPERTIES }}" | base64 --decode > android/key.properties
|
run: echo "${{ secrets.KEY_PROPERTIES }}" | base64 --decode > android/key.properties
|
||||||
|
|
||||||
- name: Set Up Java
|
|
||||||
uses: actions/setup-java@v3.12.0
|
|
||||||
with:
|
|
||||||
distribution: "oracle"
|
|
||||||
java-version: "17"
|
|
||||||
|
|
||||||
- name: Build Universal APK
|
- name: Build Universal APK
|
||||||
run: flutter build apk --release
|
run: flutter build apk --release
|
||||||
|
|
||||||
- name: Rename Universal APK
|
- name: Rename Universal APK
|
||||||
run: mv build/app/outputs/flutter-apk/{app-release,app-universal-release}.apk
|
run: mv build/app/outputs/flutter-apk/{app-release,app-universal-release}.apk
|
||||||
|
- name: Upload Android APK Artifact
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: release-apk
|
||||||
|
path: build/app/outputs/flutter-apk/*.apk
|
||||||
build_linux:
|
build_linux:
|
||||||
needs: test
|
needs: test
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
@ -75,14 +86,9 @@ jobs:
|
||||||
- name: Build Linux AppImage
|
- name: Build Linux AppImage
|
||||||
run: fastforge package --platform linux --targets deb
|
run: fastforge package --platform linux --targets deb
|
||||||
|
|
||||||
upload_artifacts:
|
- name: Upload deb Artifacts
|
||||||
needs: [build_android, build_linux]
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Upload Artifacts
|
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: build-artifacts
|
name: build-artifacts
|
||||||
path: |
|
path: |
|
||||||
build/app/outputs/flutter-apk/*.apk
|
|
||||||
dist/*/*.deb
|
dist/*/*.deb
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue