Skip to content

Commit

Permalink
Simplify the build.
Browse files Browse the repository at this point in the history
  • Loading branch information
dam5s committed Sep 19, 2023
1 parent 15facb6 commit c3bc1c0
Show file tree
Hide file tree
Showing 29 changed files with 38 additions and 913 deletions.
11 changes: 4 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,10 @@ jobs:
build:
runs-on: ubuntu-latest
steps:

- name: 'Checkout code'
uses: actions/checkout@v3

- name: 'Tests'
uses: subosito/flutter-action@v2
- uses: actions/checkout@v3
- uses: subosito/flutter-action@v2
with:
flutter-version: '3.x'
channel: 'stable'
- run: make
- run: make install
- run: make check
44 changes: 4 additions & 40 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,43 +1,7 @@
default: check
include weather_app/Tasks.mk

.PHONY: tasks
tasks: ## Print available tasks
@printf "\nUsage: make [target]\n\n"
@grep -E '^[a-z][^:]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
.PHONY: install check

.PHONY: cyclic_dependency_checks/install
cyclic_dependency_checks/install: ## Fetch dependencies for cyclic_dependency_checks
cd cyclic_dependency_checks; dart pub get
install: weather_app/install

.PHONY: cyclic_dependency_checks/format
cyclic_dependency_checks/format: ## Format cyclic_dependency_checks code
cd cyclic_dependency_checks; dart format lib --line-length 100 --set-exit-if-changed

.PHONY: cyclic_dependency_checks/test
cyclic_dependency_checks/test: ## Run cyclic_dependency_checks tests
cd cyclic_dependency_checks; dart scripts/generate_big_codebase.dart && dart test

.PHONY: weather_app/install
weather_app/install: ## Fetch dependencies for weather_app
cd weather_app; flutter pub get

.PHONY: weather_app/format
weather_app/format: ## Format weather_app code
cd weather_app; dart format lib --line-length 100 --set-exit-if-changed

.PHONY: weather_app/test
weather_app/test: ## Run weather_app tests
cd weather_app; flutter test

.PHONY: format
format: cyclic_dependency_checks/format weather_app/format ## Format all code

.PHONY: test
test: cyclic_dependency_checks/test weather_app/test ## Run all tests

.PHONY: check-cycles
check-cycles: ## Test cyclic dependencies
cd cyclic_dependency_checks; dart run cyclic_dependency_checks ../weather_app

.PHONY: check
check: format test check-cycles ## Check formatting and run tests
check: weather_app/check
35 changes: 7 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,44 +50,23 @@ dependency injection and predictable testing of API integrations.
* Select in Android Studio's device list
* Run `main.dart`

## Running tests
## Running checks

This checks formatting, runs tests and checks for dependency cycles

```
make test
make check
```

## Formatting
### Formatting

We use a line length of `100` characters, which is good enough to show two files side by side on a modern 27 inch
screen.
Line length can be set in Android Studio `Preferences > Editor > Code Style > Dart`.

```
make format
```

If your prefer a different line length, feel free to update the `Makefile` to your team's liking
If your prefer a different line length, feel free to update the `Tasks.mk` to your team's liking
and have developers configure their IDE as well.

## Checking for cyclic dependencies
### Cyclic dependencies

Make sure your imports are relative only for files in the same folder, otherwise use `package:` imports.
Run the make task for checking cycles:

```
make check-cycles
```

## Check before push

To check formatting, cyclic dependencies and run tests before pushing your code

```
make check
```

or

```
make
```
41 changes: 0 additions & 41 deletions cyclic_dependency_checks/bin/cyclic_dependency_checks.dart

This file was deleted.

80 changes: 0 additions & 80 deletions cyclic_dependency_checks/lib/cycle_detection/cycle_detector.dart

This file was deleted.

123 changes: 0 additions & 123 deletions cyclic_dependency_checks/lib/cycle_detection/imported_dependency.dart

This file was deleted.

11 changes: 0 additions & 11 deletions cyclic_dependency_checks/lib/cycle_detection/list_extensions.dart

This file was deleted.

Loading

0 comments on commit c3bc1c0

Please sign in to comment.