Skip to content

Commit

Permalink
ci: improve the workflows (#2443)
Browse files Browse the repository at this point in the history
* ci: rework CI to build on all platforms, use flutter analyze commenter, omit emojis, separate main.yml into checks.yml and tests.yml

* fix: replace universal_html with web for flutter_quill_extensions, minor changes to CI step names

* chore(example): remove universal_html and universal_io transitive dependencies

* ci: upload Android APK to GitHub releases
  • Loading branch information
EchoEllet authored Jan 18, 2025
1 parent 606497d commit 46b3662
Show file tree
Hide file tree
Showing 21 changed files with 451 additions and 237 deletions.
105 changes: 83 additions & 22 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,46 +1,107 @@
# TODO: Update the workflow to build on Android, iOS, desktop (macOS and Windows) instead of just Linux and Web

name: 🏗️ Build the example
name: Build the example

on:
pull_request:
branches: [master, dev]

jobs:
build_linux:
name: 🐧 Build Linux and Web Apps
# Build the Linux, Android and web apps on Linux
linux-web-android:
name: Linux, Android and Web Apps
runs-on: ubuntu-latest

steps:
- name: 📦 Checkout repository
uses: actions/checkout@v4
- uses: actions/checkout@v4

- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
channel: stable
cache: true

- name: Verify Flutter installation
run: flutter --version

- name: Install flutter_quill dependencies
run: flutter pub get

- name: Install example dependencies
run: flutter pub get -C example

- name: Build the Web app
run: flutter build web --release --dart-define=CI=true
working-directory: ./example

- name: Build the Web app with WebAssembly
run: flutter build web --release --wasm --dart-define=CI=true
working-directory: ./example

- name: Install Linux dependencies
run: |
sudo apt-get update -y
sudo apt-get install -y curl git unzip xz-utils zip libglu1-mesa
sudo apt-get install -y clang cmake ninja-build pkg-config libgtk-3-dev liblzma-dev libstdc++-12-dev
- name: Build the Linux app
run: flutter build linux --release --dart-define=CI=true
working-directory: ./example

- name: Build the Android app
run: flutter build appbundle --release --dart-define=CI=true
working-directory: ./example

macos:
name: iOS and macOS apps
runs-on: macos-latest

steps:
- uses: actions/checkout@v4

- name: 🛠️ Set up Flutter
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
channel: 'stable'
channel: stable
cache: true

- name: 🔍 Verify Flutter installation
- name: Verify Flutter installation
run: flutter --version

- name: 📥 Install Flutter dependencies
- name: Install flutter_quill dependencies
run: flutter pub get

- name: 🌐 Build Flutter Web Application
run: flutter build web --release --verbose --dart-define=CI=true
- name: Install example dependencies
run: flutter pub get -C example

- name: Build the iOS app
run: flutter build ios --no-codesign --release --dart-define=CI=true
working-directory: ./example

- name: Build the macOS app
run: flutter build macos --release --dart-define=CI=true
working-directory: ./example

# TODO: Update the CI to not upgrade all the packages to save some time
- name: 🔄 Update and Upgrade APT Packages
run: sudo apt update -y && sudo apt upgrade -y
windows:
name: Windows app
runs-on: windows-latest

- name: 🛠️ Install Flutter Linux Prerequisites
run: sudo apt install -y curl git unzip xz-utils zip libglu1-mesa
steps:
- uses: actions/checkout@v4

- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
channel: stable
cache: true

- name: Verify Flutter installation
run: flutter --version

- name: Install flutter_quill dependencies
run: flutter pub get

- name: 🧩 Install Flutter Linux Desktop Dependencies
run: sudo apt install -y clang cmake git ninja-build pkg-config libgtk-3-dev liblzma-dev libstdc++-12-dev
- name: Install example dependencies
run: flutter pub get -C example

- name: 🐧 Build Flutter Linux Desktop Application
run: flutter build linux --release --verbose --dart-define=CI=true
- name: Build the Windows app
run: flutter build windows --release --dart-define=CI=true
working-directory: ./example
6 changes: 3 additions & 3 deletions .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: 📝 Changelog File Check
name: Changelog File Check

# This workflow only validates if the CHANGELOG.md file was updated and doesn't validate the format.

Expand All @@ -10,10 +10,10 @@ on:

jobs:
changelog:
name: 🔍 Verify Changelog Modification
name: Verify Changelog Modification
runs-on: ubuntu-latest
steps:
- name: Check if CHANGELOG.md was modified
- name: Check if CHANGELOG.md was modified
uses: tarides/changelog-check-action@v2
with:
changelog: CHANGELOG.md
57 changes: 57 additions & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Code Quality Checks

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

jobs:
tests:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
channel: stable
cache: true

- name: Verify Flutter installation
run: flutter --version

- name: Install Flutter dependencies
run: flutter pub get

- name: Install flutter_quill_extensions dependencies
run: flutter pub get -C flutter_quill_extensions

- name: Install flutter_quill_test dependencies
run: flutter pub get -C flutter_quill_test

- name: Perform Flutter Analysis
run: flutter analyze

- name: Check Dart code formatting
run: dart format --set-exit-if-changed .

- name: Preview Dart proposed changes
run: dart fix --dry-run

- name: Check if the flutter_quill package is ready for publishing
run: flutter pub publish --dry-run

- name: Check if the flutter_quill_extensions is ready for publishing
run: flutter pub publish --dry-run -C flutter_quill_extensions

- name: Check the translations
run: dart ./scripts/translations_check.dart

- name: Install cider
run: dart pub global activate cider

# TODO: Need a more strict way to validate the format that uses https://keepachangelog.com/en/1.1.0/
- name: Validate CHANGELOG.md format
run: $HOME/.pub-cache/bin/cider list CHANGELOG.md
71 changes: 0 additions & 71 deletions .github/workflows/main.yml

This file was deleted.

40 changes: 40 additions & 0 deletions .github/workflows/pr-checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: PR Checks

on:
pull_request:
branches: [master, dev]

jobs:
tests:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
channel: stable
cache: true

- name: Verify Flutter installation
run: flutter --version

- name: Install Flutter dependencies
run: flutter pub get

- name: Install flutter_quill_extensions dependencies
run: flutter pub get -C flutter_quill_extensions

- name: Install flutter_quill_test dependencies
run: flutter pub get -C flutter_quill_test

- name: Perform Flutter Analysis
run: flutter analyze --write=flutter_analyze.log

- if: ${{ !cancelled() }}
name: Run Flutter Analyze Commenter
uses: yorifuji/flutter-analyze-commenter@v1
with:
analyze-log: flutter_analyze.log
verbose: false
Loading

0 comments on commit 46b3662

Please sign in to comment.