Added formatting check to makefile and ci (#17)
This commit is contained in:
parent
cc38133aca
commit
0b2b9a1d22
23
.drone.yml
23
.drone.yml
|
@ -8,6 +8,18 @@ clone:
|
|||
tags: true
|
||||
|
||||
pipeline:
|
||||
build:
|
||||
image: nathansamson/flutter-builder-docker:v0.6.0
|
||||
pull: true
|
||||
commands:
|
||||
- flutter packages get
|
||||
- make format-check
|
||||
- make build-all
|
||||
- mkdir apks
|
||||
- mv build/app/outputs/apk/*/*/*.apk apks
|
||||
when:
|
||||
event: [ push, tag ]
|
||||
|
||||
test:
|
||||
image: nathansamson/flutter-builder-docker:v0.6.0
|
||||
pull: true
|
||||
|
@ -16,17 +28,6 @@ pipeline:
|
|||
when:
|
||||
event: [ push, tag, pull_request ]
|
||||
|
||||
build:
|
||||
image: nathansamson/flutter-builder-docker:v0.6.0
|
||||
pull: true
|
||||
commands:
|
||||
- flutter packages get
|
||||
- make build-all
|
||||
- mkdir apks
|
||||
- mv build/app/outputs/apk/*/*/*.apk apks
|
||||
when:
|
||||
event: [ push, tag ]
|
||||
|
||||
# Push the releases to our pseudo-s3-bucket
|
||||
release:
|
||||
image: plugins/s3:1
|
||||
|
|
23
Makefile
23
Makefile
|
@ -1,4 +1,5 @@
|
|||
GIT_LAST_COMMIT := $(shell git describe --tags --always | sed 's/-/+/' | sed 's/^v//')
|
||||
FLUTTER ?= flutter
|
||||
|
||||
ifneq ($(DRONE_TAG),)
|
||||
VERSION ?= $(subst v,,$(DRONE_TAG))-$(GIT_LAST_COMMIT)
|
||||
|
@ -12,19 +13,33 @@ endif
|
|||
|
||||
.PHONY: test
|
||||
test:
|
||||
flutter test
|
||||
$(FLUTTER) test
|
||||
|
||||
.PHONY: build-all
|
||||
build-all: build-release build-debug build-profile
|
||||
|
||||
.PHONY: build-release
|
||||
build-release:
|
||||
flutter build apk --release --build-name=$(VERSION) --flavor main
|
||||
$(FLUTTER) build apk --release --build-name=$(VERSION) --flavor main
|
||||
|
||||
.PHONY: build-debug
|
||||
build-debug:
|
||||
flutter build apk --debug --build-name=$(VERSION) --flavor unsigned
|
||||
$(FLUTTER) build apk --debug --build-name=$(VERSION) --flavor unsigned
|
||||
|
||||
.PHONY: build-profile
|
||||
build-profile:
|
||||
flutter build apk --profile --build-name=$(VERSION) --flavor unsigned
|
||||
$(FLUTTER) build apk --profile --build-name=$(VERSION) --flavor unsigned
|
||||
|
||||
.PHONY: format
|
||||
format:
|
||||
$(FLUTTER) format lib
|
||||
|
||||
.PHONY: format-check
|
||||
format-check:
|
||||
@diff=$$(flutter format -n lib); \
|
||||
if [ -n "$$diff" ]; then \
|
||||
echo "The following files are not formatted correctly:"; \
|
||||
echo "$${diff}"; \
|
||||
echo "Please run 'make format' and commit the result."; \
|
||||
exit 1; \
|
||||
fi;
|
Reference in New Issue
Block a user