Merge pull request #35 from AshishSingh2001/fix/issue-34 #27
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build | |
# Controls when the action will run. Triggers the workflow on push or pull request | |
# events but only for the develop branch | |
on: | |
workflow_dispatch: | |
push: | |
tags: | |
- "v[0-9]+.[0-9]+.[0-9]+*" | |
branches: [develop, main] | |
pull_request: | |
branches: [develop] | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
format: | |
name: Format | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
env: | |
source-directory: . | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v4 | |
# Make sure the stable version of Flutter is available | |
- name: Set up Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
channel: "stable" | |
architecture: x64 | |
cache: true | |
# Download all Flutter packages | |
- name: Download dependencies | |
run: flutter pub get | |
working-directory: ${{env.source-directory}} | |
# Run Flutter Format to ensure formatting is valid | |
- name: Run Dart Format | |
run: dart format --set-exit-if-changed . | |
working-directory: ${{env.source-directory}} | |
analyze: | |
name: Analyze | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
env: | |
source-directory: . | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v4 | |
# Make sure the stable version of Flutter is available | |
- name: Set up Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
channel: "stable" | |
architecture: x64 | |
cache: true | |
# Download all Flutter packages | |
- name: Download dependencies | |
run: flutter pub get | |
working-directory: ${{env.source-directory}} | |
# Run Flutter Analyzer | |
- name: Run Flutter Analyzer | |
run: flutter analyze | |
working-directory: ${{env.source-directory}} | |
build_android: | |
name: Build Android App | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
env: | |
source-directory: . | |
example-directory: ./example | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v4 | |
# Ensure correct JAVA version is installed. | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: "zulu" | |
java-version: "17" | |
# Make sure the stable version of Flutter is available | |
- name: Set up Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
channel: "stable" | |
architecture: x64 | |
cache: true | |
# Download all Flutter packages | |
- name: Download dependencies | |
run: flutter pub get | |
working-directory: ${{env.source-directory}} | |
# Build Android version of the example App | |
- name: Run Android build | |
run: flutter build apk --release | |
working-directory: ${{env.example-directory}} | |
build_ios: | |
name: Build iOS App | |
# The type of runner that the job will run on | |
runs-on: macos-latest | |
env: | |
source-directory: . | |
example-directory: ./example | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v4 | |
# Make sure the stable version of Flutter is available | |
- name: Set up Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
channel: "stable" | |
architecture: x64 | |
cache: true | |
# Download all Flutter packages | |
- name: Download dependencies | |
run: flutter pub get | |
working-directory: ${{env.source-directory}} | |
# Build iOS version of the example App | |
- name: Run iOS build | |
run: flutter build ios --release --no-codesign | |
working-directory: ${{env.example-directory}} | |
build_macOS: | |
name: Build macOS App | |
# The type of runner that the job will run on | |
runs-on: macos-latest | |
env: | |
source-directory: . | |
example-directory: ./example | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v4 | |
# Make sure the stable version of Flutter is available | |
- name: Set up Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
channel: "stable" | |
architecture: x64 | |
cache: true | |
# Enable platform support | |
- name: Enable macOS | |
run: flutter config --enable-macos-desktop | |
working-directory: ${{env.source-directory}} | |
# Download all Flutter packages | |
- name: Download dependencies | |
run: flutter pub get | |
working-directory: ${{env.source-directory}} | |
# Build macOS version of the example App | |
- name: Run macOS build | |
run: flutter build macos --release | |
working-directory: ${{env.example-directory}} | |
build_windows: | |
name: Build Windows App | |
# The type of runner that the job will run on | |
runs-on: windows-latest | |
env: | |
source-directory: . | |
example-directory: ./example | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v4 | |
# Make sure the stable version of Flutter is available | |
- name: Set up Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
channel: "stable" | |
architecture: x64 | |
cache: true | |
# Enable platform support | |
- name: Enable Windows | |
run: flutter config --enable-windows-desktop | |
working-directory: ${{env.source-directory}} | |
# Download all Flutter packages | |
- name: Download dependencies | |
run: flutter pub get | |
working-directory: ${{env.source-directory}} | |
# Build iOS version of the example App | |
- name: Run Windows build | |
run: flutter build windows --release | |
working-directory: ${{env.example-directory}} | |
build_linux: | |
name: Build Linux App | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
env: | |
source-directory: . | |
example-directory: ./example | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
# Install libraries for Linux | |
- run: sudo apt-get update -y | |
- run: sudo apt-get install -y ninja-build libgtk-3-dev libblkid-dev | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v4 | |
# Make sure the stable version of Flutter is available | |
- name: Set up Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
channel: "stable" | |
architecture: x64 | |
cache: true | |
# Enable platform support | |
- name: Enable Linux | |
run: flutter config --enable-linux-desktop | |
working-directory: ${{env.source-directory}} | |
# Enable platform support | |
- name: Flutter Doctor | |
run: flutter doctor | |
working-directory: ${{env.source-directory}} | |
# Download all Flutter packages | |
- name: Download dependencies | |
run: flutter pub get | |
working-directory: ${{env.source-directory}} | |
# Build iOS version of the example App | |
- name: Run Linux build | |
run: flutter build linux --release | |
working-directory: ${{env.example-directory}} | |
build_web: | |
name: Build Web App | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
env: | |
source-directory: . | |
example-directory: ./example | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v4 | |
# Make sure the stable version of Flutter is available | |
- name: Set up Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
channel: "stable" | |
architecture: x64 | |
cache: true | |
# Download all Flutter packages | |
- name: Download dependencies | |
run: flutter pub get | |
working-directory: ${{env.source-directory}} | |
# Build Web version of the example App | |
- name: Run Web build | |
run: flutter build web --release | |
working-directory: ${{env.example-directory}} | |
tests: | |
name: Unit-tests | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
env: | |
source-directory: . | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v4 | |
# Make sure the stable version of Flutter is available | |
- name: Set up Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
channel: "stable" | |
architecture: x64 | |
cache: true | |
# Download all Flutter packages | |
- name: Download dependencies | |
run: flutter pub get | |
working-directory: ${{env.source-directory}} | |
# Run all unit-tests with code coverage | |
- name: Run unit tests | |
run: flutter test --coverage | |
working-directory: ${{env.source-directory}} | |
# # Upload code coverage information | |
# - uses: codecov/codecov-action@v4 | |
# with: | |
# file: ${{env.source-directory}}/coverage/lcov.info # optional | |
# name: OctoImage # optional | |
# fail_ci_if_error: true | |
publish: | |
if: ${{ github.ref_type == 'tag' }} | |
name: Publish | |
permissions: | |
id-token: write | |
needs: | |
[ | |
format, | |
analyze, | |
tests, | |
build_android, | |
build_ios, | |
build_macOS, | |
build_windows, | |
build_linux, | |
build_web, | |
] | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
env: | |
source-directory: . | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v4 | |
- name: Set up Dart | |
uses: dart-lang/setup-dart@v1 | |
# Make sure the stable version of Flutter is available | |
- name: Set up Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
channel: "stable" | |
architecture: x64 | |
cache: true | |
# Download all Flutter packages | |
- name: Download dependencies | |
run: flutter pub get | |
working-directory: ${{env.source-directory}} | |
# Publish the package | |
- name: Publish package | |
run: dart pub publish -v -f | |
working-directory: ${{env.source-directory}} |