Skip to content

Commit

Permalink
Feature/split by lib (#12)
Browse files Browse the repository at this point in the history
* Split by packages

* chore: Update to latest flutter version

* chore: Update dependencies and fix analyzer issue

* chore: Update web dependency to version 1.0.0

* chore: Remove unused service worker code from index.html

* chore: Update flutter_lints dependency to version 4.0.0

* chore: Update SDK and dependencies versions

* Update flutter version to 3.24.0

* chore: Update flutter and SDK versions to 3.4.0 and 3.24.0 respectively

* chore: Update flutter_lints dependency to version 4.0.0

* chore: Update example/pubspec.yaml and .github/workflows/*.yml

* chore: Update flutter and SDK versions to 3.4.0 and 3.24.0 respectively

* chore: Update Pub modules and dependencies

* chore: Update Pub modules and dependencies
  • Loading branch information
PlugFox authored Aug 7, 2024
1 parent 960ea62 commit 3a5f8f2
Show file tree
Hide file tree
Showing 47 changed files with 952 additions and 369 deletions.
123 changes: 97 additions & 26 deletions .github/workflows/checkout.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,26 @@ on:
workflow_dispatch:
push:
branches:
- "main"
- "master"
- "develop"
- "feature/**"
- "bugfix/**"
- "hotfix/**"
- "support/**"
#- "dev"
#- "develop"
#- "feature/**"
#- "bugfix/**"
#- "hotfix/**"
#- "support/**"
paths:
- "lib/**.dart"
- "test/**.dart"
- "example/**.dart"
- .github/workflows/*.yml
- "pubspec.yaml"
- "example/pubspec.yaml"
pull_request:
branches:
- "main"
- "master"
- "dev"
- "develop"
- "feature/**"
- "bugfix/**"
Expand All @@ -27,7 +33,9 @@ on:
- "lib/**.dart"
- "test/**.dart"
- "example/**.dart"
- .github/workflows/*.yml
- "pubspec.yaml"
- "example/pubspec.yaml"

jobs:
checkout:
Expand All @@ -38,44 +46,107 @@ jobs:
working-directory: ./
container:
image: plugfox/flutter:stable
timeout-minutes: 10
env:
pub-cache-name: pub
threshold: 50
timeout-minutes: 15
steps:
- name: 🚂 Get latest code
uses: actions/checkout@v3
id: checkout
uses: actions/checkout@v4
with:
sparse-checkout: |
.github
pubspec.yaml
lib
test
analysis_options.yaml
CHANGELOG.md
- name: 🚃 Cache pub modules
uses: actions/cache@v2
env:
cache-name: cache-octopus-package
- name: 📤 Restore Pub modules
id: cache-pub-restore
uses: actions/cache/restore@v4
with:
path: |
$PWD/.pub_cache/
key: ${{ runner.os }}-pub-${{ env.cache-name }}-${{ hashFiles('**/pubspec.yaml') }}
$HOME/.pub-cache
key: ${{ runner.os }}-${{ env.pub-cache-name }}-${{ hashFiles('**/pubspec.yaml') }}

- name: 🗄️ Export pub cache directory
run: export PUB_CACHE=$PWD/.pub_cache/
- name: 🗄️ Export Pub cache directory
id: export-pub-cache
timeout-minutes: 1
run: |
export PUB_CACHE=$PWD/.pub_cache/
export PATH="$PATH":"$HOME/.pub-cache/bin"
echo "${HOME}/.pub-cache/bin" >> $GITHUB_PATH
- name: 👷 Install Dependencies
id: install-dependencies
timeout-minutes: 1
run: |
flutter pub get
apt-get update && apt-get install -y lcov
flutter pub get --no-example
- name: 📥 Save Pub modules
id: cache-pub-save
uses: actions/cache/save@v4
with:
path: |
$HOME/.pub-cache
key: ${{ runner.os }}-${{ env.pub-cache-name }}-${{ hashFiles('**/pubspec.yaml') }}

#- name: 🔎 Check format
# timeout-minutes: 1
# run: dart format --set-exit-if-changed -l 80 -o none lib/
- name: 🔎 Check format
id: check-format
timeout-minutes: 1
run: dart format --set-exit-if-changed -l 80 -o none lib/

- name: 📈 Check analyzer
id: check-analyzer
timeout-minutes: 1
run: flutter analyze --fatal-infos --fatal-warnings lib/
run: dart analyze --fatal-infos --fatal-warnings lib/

- name: 👀 Verify versions
id: verify-versions
timeout-minutes: 1
run: |
test -f pubspec.yaml && test -f CHANGELOG.md
version_pubspec=$(grep '^version:' pubspec.yaml | awk '{print $2}' | sed 's/[^[:print:]]//g')
test -n "$version_pubspec"
echo "Version from pubspec.yaml: '$version_pubspec'"
grep -q "# $version_pubspec" CHANGELOG.md || (echo "Version not found in CHANGELOG.md" >&2; exit 1)
#- name: 🧪 Run tests
- name: 🧪 Run tests
id: run-tests
timeout-minutes: 2
run: |
flutter test test/octopus_test.dart
# dart pub global run coverage:test_with_coverage -fb -o coverage -- \
# --platform vm --compiler=kernel --coverage=coverage \
# --reporter=github --file-reporter=json:coverage/tests.json \
# --timeout=10m --concurrency=12 --color \
# test/test.dart

#- name: 🔍 Check coverage
# id: check-coverage
# timeout-minutes: 2
# run: |
# dart run coverage:test_with_coverage -fb -o coverage -- \
# --concurrency=6 --platform vm --coverage=./coverage --reporter=expanded test/ws_test.dart
# mv coverage/lcov.info coverage/lcov.base.info
# lcov --remove coverage/lcov.base.info '*.g.dart' -o coverage/lcov.info
# lcov --list coverage/lcov.info
# THRESHOLD=${{ env.threshold }}
# COVERAGE=$(lcov --summary coverage/lcov.info | grep -i 'lines\|Total:' | tail -n 1 | awk '{print $2}' | sed 's/%//')
# echo "Coverage is $COVERAGE%"
# echo $COVERAGE | awk '{if ($1 < 50) exit 1}'

#- name: 📥 Upload coverage to Codecov
# timeout-minutes: 1
# uses: codecov/codecov-action@v3
- name: 🧹 Cleanup artifacts
id: cleanup-artifacts
if: always()
timeout-minutes: 2
run: |
rm -rf ~/build
#- name: ✨ Upload coverage to Codecov
# id: upload-coverage
# timeout-minutes: 2
# uses: codecov/codecov-action@v4
# with:
# token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
60 changes: 39 additions & 21 deletions .github/workflows/example-deploy-production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,34 +13,54 @@ jobs:
options: --user root
timeout-minutes: 30
env:
pub-cache-name: pub
working-directory: ./example
steps:
- name: 🚂 Get latest code
uses: actions/checkout@v3

- name: 🗄️ Export pub cache directory
run: |
git config --global --add safe.directory /opt/flutter
export PUB_CACHE=$PWD/.pub_cache/
id: checkout
uses: actions/checkout@v4
with:
sparse-checkout: |
.github
pubspec.yaml
lib
test
analysis_options.yaml
CHANGELOG.md
example
- name: 🚃 Cache pub modules
id: cache-pub-modules
uses: actions/cache@v3
env:
cache-name: cache-pub-modules
- name: 📤 Restore Pub modules
id: cache-pub-restore
uses: actions/cache/restore@v4
with:
key: ${{ runner.os }}-pub-${{ env.cache-name }}-${{ hashFiles('**/pubspec.lock') }}
path: |
$PWD/.pub_cache/
$PWD/.dart_tool/
$PWD/.flutter-plugins
$PWD/.flutter-plugins-dependencies
$PWD/.packages
$HOME/.pub-cache
key: ${{ runner.os }}-${{ env.pub-cache-name }}-${{ hashFiles('**/pubspec.yaml') }}

- name: 👷 Get dependencies
- name: 🗄️ Export Pub cache directory
id: export-pub-cache
timeout-minutes: 1
run: |
export PUB_CACHE=$PWD/.pub_cache/
export PATH="$PATH":"$HOME/.pub-cache/bin"
echo "${HOME}/.pub-cache/bin" >> $GITHUB_PATH
- name: 👷 Install Dependencies
id: install-dependencies
timeout-minutes: 1
run: |
apt-get update && apt-get install -y lcov
flutter pub get
timeout-minutes: 5
dart pub global activate intl_utils
dart pub global run intl_utils:generate
- name: 📥 Save Pub modules
id: cache-pub-save
uses: actions/cache/save@v4
with:
path: |
$HOME/.pub-cache
key: ${{ runner.os }}-${{ env.pub-cache-name }}-${{ hashFiles('**/pubspec.yaml') }}

- name: 🖼️ Move images from assets to web
working-directory: ${{ env.working-directory }}
Expand All @@ -51,8 +71,6 @@ jobs:
- name: 🏗️ Codegen
working-directory: ${{ env.working-directory }}
run: |
dart pub global activate intl_utils
dart pub global run intl_utils:generate
flutter gen-l10n --arb-dir lib/src/common/localization --output-dir lib/src/common/localization/generated --template-arb-file intl_en.arb
dart run build_runner build --delete-conflicting-outputs --release
timeout-minutes: 5
Expand Down
64 changes: 42 additions & 22 deletions .github/workflows/example-deploy-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ on:
paths:
- "lib/**.dart"
- "test/**.dart"
- "example/**.dart"
- .github/workflows/*.yml
- "pubspec.yaml"
- "pubspec.lock"
- "example/pubspec.yaml"
workflow_dispatch:

jobs:
Expand All @@ -23,34 +25,54 @@ jobs:
options: --user root
timeout-minutes: 30
env:
pub-cache-name: pub
working-directory: ./example
steps:
- name: 🚂 Get latest code
uses: actions/checkout@v3

- name: 🗄️ Export pub cache directory
run: |
git config --global --add safe.directory /opt/flutter
export PUB_CACHE=$PWD/.pub_cache/
id: checkout
uses: actions/checkout@v4
with:
sparse-checkout: |
.github
pubspec.yaml
lib
test
analysis_options.yaml
CHANGELOG.md
example
- name: 🚃 Cache pub modules
id: cache-pub-modules
uses: actions/cache@v3
env:
cache-name: cache-pub-modules
- name: 📤 Restore Pub modules
id: cache-pub-restore
uses: actions/cache/restore@v4
with:
key: ${{ runner.os }}-pub-${{ env.cache-name }}-${{ hashFiles('**/pubspec.lock') }}
path: |
$PWD/.pub_cache/
$PWD/.dart_tool/
$PWD/.flutter-plugins
$PWD/.flutter-plugins-dependencies
$PWD/.packages
$HOME/.pub-cache
key: ${{ runner.os }}-${{ env.pub-cache-name }}-${{ hashFiles('**/pubspec.yaml') }}

- name: 👷 Get dependencies
- name: 🗄️ Export Pub cache directory
id: export-pub-cache
timeout-minutes: 1
run: |
export PUB_CACHE=$PWD/.pub_cache/
export PATH="$PATH":"$HOME/.pub-cache/bin"
echo "${HOME}/.pub-cache/bin" >> $GITHUB_PATH
- name: 👷 Install Dependencies
id: install-dependencies
timeout-minutes: 1
run: |
apt-get update && apt-get install -y lcov
flutter pub get
timeout-minutes: 5
dart pub global activate intl_utils
dart pub global run intl_utils:generate
- name: 📥 Save Pub modules
id: cache-pub-save
uses: actions/cache/save@v4
with:
path: |
$HOME/.pub-cache
key: ${{ runner.os }}-${{ env.pub-cache-name }}-${{ hashFiles('**/pubspec.yaml') }}

- name: 🖼️ Move images from assets to web
working-directory: ${{ env.working-directory }}
Expand All @@ -61,8 +83,6 @@ jobs:
- name: 🏗️ Codegen
working-directory: ${{ env.working-directory }}
run: |
dart pub global activate intl_utils
dart pub global run intl_utils:generate
flutter gen-l10n --arb-dir lib/src/common/localization --output-dir lib/src/common/localization/generated --template-arb-file intl_en.arb
dart run build_runner build --delete-conflicting-outputs --release
timeout-minutes: 5
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.0.9

- Update to 3.24.0 flutter version

## 0.0.8

- Lower `collection` version constraint to `^1.17.2`
Expand Down
3 changes: 0 additions & 3 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ linter:
avoid_js_rounded_ints: true
avoid_print: true
avoid_renaming_method_parameters: true
avoid_returning_null_for_future: true
avoid_returning_null_for_void: true
avoid_single_cascade_in_expression_statements: true
avoid_slow_async_io: true
Expand Down Expand Up @@ -134,7 +133,6 @@ linter:

# Pedantic 1.9.0
always_declare_return_types: true
always_require_non_null_named_parameters: true
annotate_overrides: true
avoid_empty_else: true
avoid_init_to_null: true
Expand Down Expand Up @@ -198,7 +196,6 @@ linter:
prefer_mixin: true
use_setters_to_change_properties: true
avoid_setters_without_getters: true
avoid_returning_null: true
avoid_returning_this: true
type_annotate_public_apis: true
avoid_types_on_closure_parameters: true
Expand Down
Loading

0 comments on commit 3a5f8f2

Please sign in to comment.