mirror of
https://git.proxmox.com/git/fwupd
synced 2025-08-06 09:00:55 +00:00
Offer to run tests before pushing in contrib/setup
Also make clearer that the default choice is "no" for interactive prompts.
This commit is contained in:
parent
5e52b3527f
commit
93aae762a6
2
.github/workflows/main.yml
vendored
2
.github/workflows/main.yml
vendored
@ -21,7 +21,7 @@ jobs:
|
||||
./contrib/setup
|
||||
source venv/bin/activate
|
||||
sed -i "/no-commit-to-branch/,+1d" .pre-commit-config.yaml
|
||||
pre-commit run --all-files
|
||||
pre-commit run --hook-stage commit --all-files
|
||||
abi:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
|
@ -1,3 +1,4 @@
|
||||
default_stages: [commit]
|
||||
repos:
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v4.0.1
|
||||
@ -53,6 +54,11 @@ repos:
|
||||
language: system
|
||||
entry: shellcheck --severity=warning -e SC2068
|
||||
types: [shell]
|
||||
- id: run-tests
|
||||
name: run tests before pushing
|
||||
language: script
|
||||
entry: ./contrib/run-tests.sh
|
||||
stages: [push]
|
||||
- id: clang-format
|
||||
name: clang-format
|
||||
language: script
|
||||
|
2
contrib/run-tests.sh
Executable file
2
contrib/run-tests.sh
Executable file
@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
meson build && ninja -C build test
|
@ -12,7 +12,7 @@ rename_branch()
|
||||
NEW=main
|
||||
if git log $OLD >/dev/null 2>&1 &&
|
||||
git remote get-url origin 2>&1 | grep fwupd/fwupd.git >/dev/null 2>&1; then
|
||||
read -p "Rename existing $OLD branch to $NEW? (y/n) " question
|
||||
read -p "Rename existing $OLD branch to $NEW? (y/N) " question
|
||||
if [ "$question" = "y" ]; then
|
||||
git branch -m $OLD $NEW
|
||||
git fetch origin
|
||||
@ -24,7 +24,7 @@ rename_branch()
|
||||
|
||||
setup_deps()
|
||||
{
|
||||
read -p "Install build dependencies? (y/n) " question
|
||||
read -p "Install build dependencies? (y/N) " question
|
||||
if [ "$question" = "y" ]; then
|
||||
$(which sudo) python3 $HELPER install-dependencies $HELPER_ARGS -y
|
||||
fi
|
||||
@ -32,7 +32,7 @@ setup_deps()
|
||||
|
||||
setup_run_dev()
|
||||
{
|
||||
read -p "Set up dbus activated daemon and PolicyKit actions from /usr/local? (y/n) " question
|
||||
read -p "Set up dbus activated daemon and PolicyKit actions from /usr/local? (y/N) " question
|
||||
if [ "$question" = "y" ]; then
|
||||
./contrib/prepare-system /usr/local install
|
||||
fi
|
||||
@ -40,7 +40,7 @@ setup_run_dev()
|
||||
|
||||
setup_unsafe_polkit_rules()
|
||||
{
|
||||
read -p "Install developer-friendly **unsafe** PolicyKit rules into /etc/polkit-1/rules.d? (y/n) " question
|
||||
read -p "Install developer-friendly **unsafe** PolicyKit rules into /etc/polkit-1/rules.d? (y/N) " question
|
||||
if [ "$question" = "y" ]; then
|
||||
sudo cp ./policy/org.freedesktop.fwupd-unsafe.rules /etc/polkit-1/rules.d/
|
||||
fi
|
||||
@ -85,6 +85,16 @@ setup_precommit()
|
||||
pre-commit install
|
||||
}
|
||||
|
||||
setup_prepush()
|
||||
{
|
||||
read -p "Run tests locally before pushing to remote branches? THIS WILL SLOW DOWN EVERY PUSH but reduce the risk of failing CI. (y/N) " question
|
||||
if [ "$question" = "y" ]; then
|
||||
pre-commit install -t pre-push
|
||||
else
|
||||
pre-commit uninstall -t pre-push
|
||||
fi
|
||||
}
|
||||
|
||||
check_markdown()
|
||||
{
|
||||
if ! python3 $HELPER test-markdown; then
|
||||
@ -128,6 +138,12 @@ detect_os()
|
||||
#needed for arguments for some commands
|
||||
detect_os "$@"
|
||||
|
||||
#always setup pre-commit
|
||||
setup_precommit
|
||||
|
||||
#always setup git environment
|
||||
setup_git
|
||||
|
||||
#if interactive install build deps and prepare environment
|
||||
if [ -t 2 ]; then
|
||||
case $OS in
|
||||
@ -143,10 +159,5 @@ if [ -t 2 ]; then
|
||||
check_markdown
|
||||
setup_vscode
|
||||
rename_branch
|
||||
setup_prepush
|
||||
fi
|
||||
|
||||
#always setup pre-commit
|
||||
setup_precommit
|
||||
|
||||
#always setup git environment
|
||||
setup_git
|
||||
|
Loading…
Reference in New Issue
Block a user