Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dodo.py and CI #110

Merged
merged 1 commit into from
Aug 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 35 additions & 5 deletions .github/workflows/flutter_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@ on:
- cron: '0 0 * * 1'

jobs:
build:
desktop:
strategy:
matrix:
os: [ubuntu-latest]

runs-on: ${{ matrix.os }}
name: desktop-${{ matrix.os }}

steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -33,11 +35,39 @@ jobs:
channel: stable
cache: true

- name: Install doit
uses: awalsh128/cache-apt-pkgs-action@v1.4.2
with:
packages: python3-doit

- name: Run analyzer
run: flutter analyze
run: doit analyze

- name: Run tests
run: flutter test
run: doit test

android:
strategy:
matrix:
os: [ubuntu-latest]

runs-on: ${{ matrix.os }}
name: android-${{ matrix.os }}

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

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

- name: Install doit
uses: awalsh128/cache-apt-pkgs-action@v1.4.2
with:
packages: python3-doit

- name: Build Android APK
run: flutter build apk
- name: Build apk
run: doit build_apk
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,4 @@ app.*.map.json
/app

# doit related
.doit.db.bak
.doit.db.dat
.doit.db.dir
.doit.db*
64 changes: 57 additions & 7 deletions dodo.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,73 @@
from doit.tools import title_with_actions
from doit.tools import title_with_actions, LongRunning
import atexit
import os
import shutil
import signal

atexit.register(
lambda: shutil.rmtree('__pycache__', ignore_errors=True))
if os.name == 'posix':
signal.signal(signal.SIGINT, lambda s, f: os._exit(0))

DOIT_CONFIG = {
'default_tasks': ['analyze', 'test'],
'verbosity': 2,
}

# doit analyze
def task_analyze():
"""run analyzer"""
return {
'actions': ['flutter analyze --fatal-infos --fatal-warnings'],
'title': title_with_actions,
}

# doit test
def task_test():
"""run tests"""
return {
'actions': ['flutter test -j1 -r github'],
'title': title_with_actions,
}

# doit exec
def task_exec():
"""run on device"""
return {
'actions': [LongRunning('flutter run --release')],
'title': title_with_actions,
}

# doit build_apk
def task_build_apk():
"""build android apk"""
return {
'actions': ['flutter build apk --release'],
'title': title_with_actions,
}

# doit wipe
def task_wipe():
"""clean build artifacts"""
return {
'actions': ['flutter clean'],
'title': title_with_actions,
}

# doit gen
def task_gen():
"""run flutter build_runner code generation"""
return {
'actions': ['dart run build_runner build --delete-conflicting-outputs'],
'title': title_with_actions,
'verbosity': 2,
}

# doit gen_watch
def task_gen_watch():
"""run flutter build_runner code watch generation"""
return {
'actions': ['dart run build_runner watch --delete-conflicting-outputs'],
'actions': [LongRunning('dart run build_runner watch --delete-conflicting-outputs')],
'title': title_with_actions,
'verbosity': 2,
}

# doit icons
Expand All @@ -24,7 +76,6 @@ def task_icons():
return {
'actions': ['dart run flutter_launcher_icons'],
'title': title_with_actions,
'verbosity': 2,
}

# doit splash
Expand All @@ -33,5 +84,4 @@ def task_splash():
return {
'actions': ['dart run flutter_native_splash:create '],
'title': title_with_actions,
'verbosity': 2,
}
}