2019-01-30 18:13:23 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2019-04-19 19:11:43 +00:00
|
|
|
# We recommend you run this as a pre-push hook: to reduce
|
|
|
|
# review turn-around time, we want all pushes to run tasks
|
|
|
|
# locally. Using this hook will guarantee your hook gets
|
|
|
|
# updated as the repository changes.
|
|
|
|
#
|
|
|
|
# This hook tries to run as much as possible without taking
|
|
|
|
# too long.
|
|
|
|
#
|
|
|
|
# You can use it by running this command from the project root:
|
2020-07-01 20:23:11 +00:00
|
|
|
# `ln -s ../../config/pre-push-recommended.sh .git/hooks/pre-push`
|
2019-04-19 19:11:43 +00:00
|
|
|
|
|
|
|
# Descriptions for each gradle task below can be found in the
|
|
|
|
# output of `./gradlew tasks`.
|
|
|
|
|
2021-02-24 22:33:32 +00:00
|
|
|
# Prevent push if generated glean docs are not committed.
|
|
|
|
# A better implementation would make sure these doc updates
|
|
|
|
# only came from this commit.
|
|
|
|
./gradlew -q \
|
|
|
|
gleanGenerateMetricsDocsForDebug \
|
|
|
|
gleanGenerateMetricsSourceForDebug
|
|
|
|
if git status --porcelain=v1 | grep -q "docs/metrics.md"; then
|
|
|
|
echo "
|
|
|
|
FAIL pre-push hook: generated glean file, docs/metrics.md, has uncommitted changes.
|
|
|
|
Please commit these files and try again.
|
|
|
|
|
|
|
|
This check tries to prevent these generated files from being uncommitted on master.
|
|
|
|
However, it may fail unintuitively if we're in that state. If this happens often
|
|
|
|
and is disruptive to your workflow, please notify mcomella so we can improve this
|
|
|
|
check." >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Run core checks.
|
2019-01-30 18:13:23 +00:00
|
|
|
./gradlew -q \
|
|
|
|
ktlint \
|
|
|
|
detekt \
|
2020-08-06 20:08:09 +00:00
|
|
|
assembleDebug \
|
|
|
|
assembleDebugAndroidTest \
|
2020-10-21 17:40:04 +00:00
|
|
|
mozilla-detekt-rules:test \
|
|
|
|
mozilla-lint-rules:test \
|
2020-08-06 20:08:09 +00:00
|
|
|
testDebug
|
2019-12-06 20:46:37 +00:00
|
|
|
|
|
|
|
# Tasks omitted because they take a long time to run:
|
|
|
|
# - assembling all variants
|
|
|
|
# - unit test on all variants
|
|
|
|
# - UI tests
|
|
|
|
# - android lint (takes a long time to run)
|