Skip to content

Commit 3a5f8f2

Browse files
authored
Feature/split by lib (#12)
* 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
1 parent 960ea62 commit 3a5f8f2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+952
-369
lines changed

.github/workflows/checkout.yml

Lines changed: 97 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,26 @@ on:
44
workflow_dispatch:
55
push:
66
branches:
7+
- "main"
78
- "master"
8-
- "develop"
9-
- "feature/**"
10-
- "bugfix/**"
11-
- "hotfix/**"
12-
- "support/**"
9+
#- "dev"
10+
#- "develop"
11+
#- "feature/**"
12+
#- "bugfix/**"
13+
#- "hotfix/**"
14+
#- "support/**"
1315
paths:
1416
- "lib/**.dart"
1517
- "test/**.dart"
1618
- "example/**.dart"
19+
- .github/workflows/*.yml
1720
- "pubspec.yaml"
21+
- "example/pubspec.yaml"
1822
pull_request:
1923
branches:
24+
- "main"
2025
- "master"
26+
- "dev"
2127
- "develop"
2228
- "feature/**"
2329
- "bugfix/**"
@@ -27,7 +33,9 @@ on:
2733
- "lib/**.dart"
2834
- "test/**.dart"
2935
- "example/**.dart"
36+
- .github/workflows/*.yml
3037
- "pubspec.yaml"
38+
- "example/pubspec.yaml"
3139

3240
jobs:
3341
checkout:
@@ -38,44 +46,107 @@ jobs:
3846
working-directory: ./
3947
container:
4048
image: plugfox/flutter:stable
41-
timeout-minutes: 10
49+
env:
50+
pub-cache-name: pub
51+
threshold: 50
52+
timeout-minutes: 15
4253
steps:
4354
- name: 🚂 Get latest code
44-
uses: actions/checkout@v3
55+
id: checkout
56+
uses: actions/checkout@v4
57+
with:
58+
sparse-checkout: |
59+
.github
60+
pubspec.yaml
61+
lib
62+
test
63+
analysis_options.yaml
64+
CHANGELOG.md
4565
46-
- name: 🚃 Cache pub modules
47-
uses: actions/cache@v2
48-
env:
49-
cache-name: cache-octopus-package
66+
- name: 📤 Restore Pub modules
67+
id: cache-pub-restore
68+
uses: actions/cache/restore@v4
5069
with:
5170
path: |
52-
$PWD/.pub_cache/
53-
key: ${{ runner.os }}-pub-${{ env.cache-name }}-${{ hashFiles('**/pubspec.yaml') }}
71+
$HOME/.pub-cache
72+
key: ${{ runner.os }}-${{ env.pub-cache-name }}-${{ hashFiles('**/pubspec.yaml') }}
5473

55-
- name: 🗄️ Export pub cache directory
56-
run: export PUB_CACHE=$PWD/.pub_cache/
74+
- name: 🗄️ Export Pub cache directory
75+
id: export-pub-cache
76+
timeout-minutes: 1
77+
run: |
78+
export PUB_CACHE=$PWD/.pub_cache/
79+
export PATH="$PATH":"$HOME/.pub-cache/bin"
80+
echo "${HOME}/.pub-cache/bin" >> $GITHUB_PATH
5781
5882
- name: 👷 Install Dependencies
83+
id: install-dependencies
5984
timeout-minutes: 1
6085
run: |
61-
flutter pub get
86+
apt-get update && apt-get install -y lcov
87+
flutter pub get --no-example
88+
89+
- name: 📥 Save Pub modules
90+
id: cache-pub-save
91+
uses: actions/cache/save@v4
92+
with:
93+
path: |
94+
$HOME/.pub-cache
95+
key: ${{ runner.os }}-${{ env.pub-cache-name }}-${{ hashFiles('**/pubspec.yaml') }}
6296

63-
#- name: 🔎 Check format
64-
# timeout-minutes: 1
65-
# run: dart format --set-exit-if-changed -l 80 -o none lib/
97+
- name: 🔎 Check format
98+
id: check-format
99+
timeout-minutes: 1
100+
run: dart format --set-exit-if-changed -l 80 -o none lib/
66101

67102
- name: 📈 Check analyzer
103+
id: check-analyzer
68104
timeout-minutes: 1
69-
run: flutter analyze --fatal-infos --fatal-warnings lib/
105+
run: dart analyze --fatal-infos --fatal-warnings lib/
106+
107+
- name: 👀 Verify versions
108+
id: verify-versions
109+
timeout-minutes: 1
110+
run: |
111+
test -f pubspec.yaml && test -f CHANGELOG.md
112+
version_pubspec=$(grep '^version:' pubspec.yaml | awk '{print $2}' | sed 's/[^[:print:]]//g')
113+
test -n "$version_pubspec"
114+
echo "Version from pubspec.yaml: '$version_pubspec'"
115+
grep -q "# $version_pubspec" CHANGELOG.md || (echo "Version not found in CHANGELOG.md" >&2; exit 1)
70116
71-
#- name: 🧪 Run tests
117+
- name: 🧪 Run tests
118+
id: run-tests
119+
timeout-minutes: 2
120+
run: |
121+
flutter test test/octopus_test.dart
122+
# dart pub global run coverage:test_with_coverage -fb -o coverage -- \
123+
# --platform vm --compiler=kernel --coverage=coverage \
124+
# --reporter=github --file-reporter=json:coverage/tests.json \
125+
# --timeout=10m --concurrency=12 --color \
126+
# test/test.dart
127+
128+
#- name: 🔍 Check coverage
129+
# id: check-coverage
72130
# timeout-minutes: 2
73131
# run: |
74-
# dart run coverage:test_with_coverage -fb -o coverage -- \
75-
# --concurrency=6 --platform vm --coverage=./coverage --reporter=expanded test/ws_test.dart
132+
# mv coverage/lcov.info coverage/lcov.base.info
133+
# lcov --remove coverage/lcov.base.info '*.g.dart' -o coverage/lcov.info
134+
# lcov --list coverage/lcov.info
135+
# THRESHOLD=${{ env.threshold }}
136+
# COVERAGE=$(lcov --summary coverage/lcov.info | grep -i 'lines\|Total:' | tail -n 1 | awk '{print $2}' | sed 's/%//')
137+
# echo "Coverage is $COVERAGE%"
138+
# echo $COVERAGE | awk '{if ($1 < 50) exit 1}'
76139

77-
#- name: 📥 Upload coverage to Codecov
78-
# timeout-minutes: 1
79-
# uses: codecov/codecov-action@v3
140+
- name: 🧹 Cleanup artifacts
141+
id: cleanup-artifacts
142+
if: always()
143+
timeout-minutes: 2
144+
run: |
145+
rm -rf ~/build
146+
147+
#- name: ✨ Upload coverage to Codecov
148+
# id: upload-coverage
149+
# timeout-minutes: 2
150+
# uses: codecov/codecov-action@v4
80151
# with:
81152
# token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos

.github/workflows/example-deploy-production.yml

Lines changed: 39 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -13,34 +13,54 @@ jobs:
1313
options: --user root
1414
timeout-minutes: 30
1515
env:
16+
pub-cache-name: pub
1617
working-directory: ./example
1718
steps:
1819
- name: 🚂 Get latest code
19-
uses: actions/checkout@v3
20-
21-
- name: 🗄️ Export pub cache directory
22-
run: |
23-
git config --global --add safe.directory /opt/flutter
24-
export PUB_CACHE=$PWD/.pub_cache/
20+
id: checkout
21+
uses: actions/checkout@v4
22+
with:
23+
sparse-checkout: |
24+
.github
25+
pubspec.yaml
26+
lib
27+
test
28+
analysis_options.yaml
29+
CHANGELOG.md
30+
example
2531
26-
- name: 🚃 Cache pub modules
27-
id: cache-pub-modules
28-
uses: actions/cache@v3
29-
env:
30-
cache-name: cache-pub-modules
32+
- name: 📤 Restore Pub modules
33+
id: cache-pub-restore
34+
uses: actions/cache/restore@v4
3135
with:
32-
key: ${{ runner.os }}-pub-${{ env.cache-name }}-${{ hashFiles('**/pubspec.lock') }}
3336
path: |
34-
$PWD/.pub_cache/
35-
$PWD/.dart_tool/
36-
$PWD/.flutter-plugins
37-
$PWD/.flutter-plugins-dependencies
38-
$PWD/.packages
37+
$HOME/.pub-cache
38+
key: ${{ runner.os }}-${{ env.pub-cache-name }}-${{ hashFiles('**/pubspec.yaml') }}
3939

40-
- name: 👷 Get dependencies
40+
- name: 🗄️ Export Pub cache directory
41+
id: export-pub-cache
42+
timeout-minutes: 1
4143
run: |
44+
export PUB_CACHE=$PWD/.pub_cache/
45+
export PATH="$PATH":"$HOME/.pub-cache/bin"
46+
echo "${HOME}/.pub-cache/bin" >> $GITHUB_PATH
47+
48+
- name: 👷 Install Dependencies
49+
id: install-dependencies
50+
timeout-minutes: 1
51+
run: |
52+
apt-get update && apt-get install -y lcov
4253
flutter pub get
43-
timeout-minutes: 5
54+
dart pub global activate intl_utils
55+
dart pub global run intl_utils:generate
56+
57+
- name: 📥 Save Pub modules
58+
id: cache-pub-save
59+
uses: actions/cache/save@v4
60+
with:
61+
path: |
62+
$HOME/.pub-cache
63+
key: ${{ runner.os }}-${{ env.pub-cache-name }}-${{ hashFiles('**/pubspec.yaml') }}
4464

4565
- name: 🖼️ Move images from assets to web
4666
working-directory: ${{ env.working-directory }}
@@ -51,8 +71,6 @@ jobs:
5171
- name: 🏗️ Codegen
5272
working-directory: ${{ env.working-directory }}
5373
run: |
54-
dart pub global activate intl_utils
55-
dart pub global run intl_utils:generate
5674
flutter gen-l10n --arb-dir lib/src/common/localization --output-dir lib/src/common/localization/generated --template-arb-file intl_en.arb
5775
dart run build_runner build --delete-conflicting-outputs --release
5876
timeout-minutes: 5

.github/workflows/example-deploy-staging.yml

Lines changed: 42 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@ on:
99
paths:
1010
- "lib/**.dart"
1111
- "test/**.dart"
12+
- "example/**.dart"
13+
- .github/workflows/*.yml
1214
- "pubspec.yaml"
13-
- "pubspec.lock"
15+
- "example/pubspec.yaml"
1416
workflow_dispatch:
1517

1618
jobs:
@@ -23,34 +25,54 @@ jobs:
2325
options: --user root
2426
timeout-minutes: 30
2527
env:
28+
pub-cache-name: pub
2629
working-directory: ./example
2730
steps:
2831
- name: 🚂 Get latest code
29-
uses: actions/checkout@v3
30-
31-
- name: 🗄️ Export pub cache directory
32-
run: |
33-
git config --global --add safe.directory /opt/flutter
34-
export PUB_CACHE=$PWD/.pub_cache/
32+
id: checkout
33+
uses: actions/checkout@v4
34+
with:
35+
sparse-checkout: |
36+
.github
37+
pubspec.yaml
38+
lib
39+
test
40+
analysis_options.yaml
41+
CHANGELOG.md
42+
example
3543
36-
- name: 🚃 Cache pub modules
37-
id: cache-pub-modules
38-
uses: actions/cache@v3
39-
env:
40-
cache-name: cache-pub-modules
44+
- name: 📤 Restore Pub modules
45+
id: cache-pub-restore
46+
uses: actions/cache/restore@v4
4147
with:
42-
key: ${{ runner.os }}-pub-${{ env.cache-name }}-${{ hashFiles('**/pubspec.lock') }}
4348
path: |
44-
$PWD/.pub_cache/
45-
$PWD/.dart_tool/
46-
$PWD/.flutter-plugins
47-
$PWD/.flutter-plugins-dependencies
48-
$PWD/.packages
49+
$HOME/.pub-cache
50+
key: ${{ runner.os }}-${{ env.pub-cache-name }}-${{ hashFiles('**/pubspec.yaml') }}
4951

50-
- name: 👷 Get dependencies
52+
- name: 🗄️ Export Pub cache directory
53+
id: export-pub-cache
54+
timeout-minutes: 1
5155
run: |
56+
export PUB_CACHE=$PWD/.pub_cache/
57+
export PATH="$PATH":"$HOME/.pub-cache/bin"
58+
echo "${HOME}/.pub-cache/bin" >> $GITHUB_PATH
59+
60+
- name: 👷 Install Dependencies
61+
id: install-dependencies
62+
timeout-minutes: 1
63+
run: |
64+
apt-get update && apt-get install -y lcov
5265
flutter pub get
53-
timeout-minutes: 5
66+
dart pub global activate intl_utils
67+
dart pub global run intl_utils:generate
68+
69+
- name: 📥 Save Pub modules
70+
id: cache-pub-save
71+
uses: actions/cache/save@v4
72+
with:
73+
path: |
74+
$HOME/.pub-cache
75+
key: ${{ runner.os }}-${{ env.pub-cache-name }}-${{ hashFiles('**/pubspec.yaml') }}
5476

5577
- name: 🖼️ Move images from assets to web
5678
working-directory: ${{ env.working-directory }}
@@ -61,8 +83,6 @@ jobs:
6183
- name: 🏗️ Codegen
6284
working-directory: ${{ env.working-directory }}
6385
run: |
64-
dart pub global activate intl_utils
65-
dart pub global run intl_utils:generate
6686
flutter gen-l10n --arb-dir lib/src/common/localization --output-dir lib/src/common/localization/generated --template-arb-file intl_en.arb
6787
dart run build_runner build --delete-conflicting-outputs --release
6888
timeout-minutes: 5

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.0.9
2+
3+
- Update to 3.24.0 flutter version
4+
15
## 0.0.8
26

37
- Lower `collection` version constraint to `^1.17.2`

analysis_options.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ linter:
7070
avoid_js_rounded_ints: true
7171
avoid_print: true
7272
avoid_renaming_method_parameters: true
73-
avoid_returning_null_for_future: true
7473
avoid_returning_null_for_void: true
7574
avoid_single_cascade_in_expression_statements: true
7675
avoid_slow_async_io: true
@@ -134,7 +133,6 @@ linter:
134133

135134
# Pedantic 1.9.0
136135
always_declare_return_types: true
137-
always_require_non_null_named_parameters: true
138136
annotate_overrides: true
139137
avoid_empty_else: true
140138
avoid_init_to_null: true
@@ -198,7 +196,6 @@ linter:
198196
prefer_mixin: true
199197
use_setters_to_change_properties: true
200198
avoid_setters_without_getters: true
201-
avoid_returning_null: true
202199
avoid_returning_this: true
203200
type_annotate_public_apis: true
204201
avoid_types_on_closure_parameters: true

0 commit comments

Comments
 (0)