-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
135 lines (108 loc) · 4.87 KB
/
Copy pathMakefile
File metadata and controls
135 lines (108 loc) · 4.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# Simple Flutter helper targets
SHELL := /bin/bash
.PHONY: format-package format-demo format-all lint-package lint-demo lint-all \
test-package-unit test-package-unit-coverage \
test-package-widget test-package-widget-coverage \
test-package-all \
test-demo-integration test-demo-integration-coverage \
test-package-integration test-package-integration-coverage
install:
flutter pub get
cd demo && flutter pub get && cd -
run-demo:
cd demo && flutter run && cd -
# Formatting
format-package:
dart format --set-exit-if-changed .
format-demo:
cd demo && dart format --set-exit-if-changed . && cd -
format-all: format-package format-demo
# Linting
lint-package:
flutter analyze
lint-demo:
cd demo && flutter analyze && cd -
lint-all: lint-package lint-demo
# Testing: Unit & Widget tests
test-package-unit:
flutter test test/unit
test-package-unit-coverage:
mkdir -p coverage/unit build/test-results/unit
@if [ "$$CI" = "true" ]; then \
set -o pipefail -x; \
flutter test --coverage --coverage-path=coverage/unit/lcov.info --machine test/unit \
| tojunit --output build/test-results/unit/junit.xml; \
else \
flutter test --coverage --coverage-path=coverage/unit/lcov.info test/unit; \
fi
test-package-widget:
@# Check if LIBQUICKJSC_TEST_PATH is set, if not and we're not on macOS, try to set it
@if [ -z "$$LIBQUICKJSC_TEST_PATH" ] && [ "$$(uname)" = "Linux" ]; then \
if [ ! -f "demo/build/linux/x64/debug/bundle/lib/libquickjs_c_bridge_plugin.so" ]; then \
echo "Building Linux desktop app to compile native libraries..."; \
cd demo && flutter pub get && flutter build linux --debug && cd ..; \
fi; \
export LIBQUICKJSC_TEST_PATH="$$PWD/demo/build/linux/x64/debug/bundle/lib/libquickjs_c_bridge_plugin.so"; \
fi; \
flutter test test/widget
test-package-widget-coverage:
@# Check if LIBQUICKJSC_TEST_PATH is set, if not and we're not on macOS, try to set it
@if [ -z "$$LIBQUICKJSC_TEST_PATH" ] && [ "$$(uname)" = "Linux" ]; then \
if [ ! -f "demo/build/linux/x64/debug/bundle/lib/libquickjs_c_bridge_plugin.so" ]; then \
echo "Building Linux desktop app to compile native libraries..."; \
cd demo && flutter pub get && flutter build linux --debug && cd ..; \
fi; \
export LIBQUICKJSC_TEST_PATH="$$PWD/demo/build/linux/x64/debug/bundle/lib/libquickjs_c_bridge_plugin.so"; \
fi; \
mkdir -p coverage/widget build/test-results/widget; \
if [ "$$CI" = "true" ]; then \
set -o pipefail -x; \
flutter test --coverage --coverage-path=coverage/widget/lcov.info --machine test/widget \
| tojunit --output build/test-results/widget/junit.xml; \
else \
flutter test --coverage --coverage-path=coverage/widget/lcov.info test/widget; \
fi
# Runs the package widget suite with integration binding for visual debugging if desired
test-package-integration:
cd demo && flutter test integration_test/tests/widget_suite_test.dart && cd -
test-package-integration-coverage:
cd demo && \
mkdir -p coverage/package_integration build/test-results/package_integration && \
if [ "$$CI" = "true" ]; then \
set -o pipefail -x; \
flutter test --coverage --coverage-path=coverage/package_integration/lcov.info --machine integration_test/tests/widget_suite_test.dart \
| tojunit --output build/test-results/package_integration/junit.xml; \
else \
flutter test --coverage --coverage-path=coverage/package_integration/lcov.info integration_test/tests/widget_suite_test.dart; \
fi && cd -
test-package-all:
$(MAKE) test-package-unit
$(MAKE) test-package-widget
$(MAKE) test-package-integration
# Testing: Integration tests
# Runs the demo application's dedicated integration smoke test
test-demo-integration:
cd demo && flutter test integration_test/tests/demo_test.dart && cd -
test-demo-integration-coverage:
cd demo && \
mkdir -p coverage/integration build/test-results/integration && \
if [ "$$CI" = "true" ]; then \
set -o pipefail -x; \
flutter test --coverage --coverage-path=coverage/integration/lcov.info --machine integration_test/tests/demo_test.dart --dart-define=CI=true \
| tojunit --output build/test-results/integration/junit.xml; \
else \
flutter test --coverage --coverage-path=coverage/integration/lcov.info integration_test/tests/demo_test.dart --dart-define=CI=true; \
fi && cd -
# Combined integration test
test-integration:
cd demo && flutter test integration_test/tests && cd -
test-integration-coverage:
cd demo && \
mkdir -p coverage/integration build/test-results/integration && \
if [ "$$CI" = "true" ]; then \
set -o pipefail -x; \
flutter test --coverage --coverage-path=coverage/integration/lcov.info --machine integration_test/tests --dart-define=CI=true \
| tojunit --output build/test-results/integration/junit.xml; \
else \
flutter test --coverage --coverage-path=coverage/integration/lcov.info integration_test/tests --dart-define=CI=true; \
fi && cd -