mirror of
https://git.proxmox.com/git/fwupd
synced 2025-08-10 02:21:41 +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
|
./contrib/setup
|
||||||
source venv/bin/activate
|
source venv/bin/activate
|
||||||
sed -i "/no-commit-to-branch/,+1d" .pre-commit-config.yaml
|
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:
|
abi:
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
steps:
|
steps:
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
default_stages: [commit]
|
||||||
repos:
|
repos:
|
||||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||||
rev: v4.0.1
|
rev: v4.0.1
|
||||||
@ -53,6 +54,11 @@ repos:
|
|||||||
language: system
|
language: system
|
||||||
entry: shellcheck --severity=warning -e SC2068
|
entry: shellcheck --severity=warning -e SC2068
|
||||||
types: [shell]
|
types: [shell]
|
||||||
|
- id: run-tests
|
||||||
|
name: run tests before pushing
|
||||||
|
language: script
|
||||||
|
entry: ./contrib/run-tests.sh
|
||||||
|
stages: [push]
|
||||||
- id: clang-format
|
- id: clang-format
|
||||||
name: clang-format
|
name: clang-format
|
||||||
language: script
|
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
|
NEW=main
|
||||||
if git log $OLD >/dev/null 2>&1 &&
|
if git log $OLD >/dev/null 2>&1 &&
|
||||||
git remote get-url origin 2>&1 | grep fwupd/fwupd.git >/dev/null 2>&1; then
|
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
|
if [ "$question" = "y" ]; then
|
||||||
git branch -m $OLD $NEW
|
git branch -m $OLD $NEW
|
||||||
git fetch origin
|
git fetch origin
|
||||||
@ -24,7 +24,7 @@ rename_branch()
|
|||||||
|
|
||||||
setup_deps()
|
setup_deps()
|
||||||
{
|
{
|
||||||
read -p "Install build dependencies? (y/n) " question
|
read -p "Install build dependencies? (y/N) " question
|
||||||
if [ "$question" = "y" ]; then
|
if [ "$question" = "y" ]; then
|
||||||
$(which sudo) python3 $HELPER install-dependencies $HELPER_ARGS -y
|
$(which sudo) python3 $HELPER install-dependencies $HELPER_ARGS -y
|
||||||
fi
|
fi
|
||||||
@ -32,7 +32,7 @@ setup_deps()
|
|||||||
|
|
||||||
setup_run_dev()
|
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
|
if [ "$question" = "y" ]; then
|
||||||
./contrib/prepare-system /usr/local install
|
./contrib/prepare-system /usr/local install
|
||||||
fi
|
fi
|
||||||
@ -40,7 +40,7 @@ setup_run_dev()
|
|||||||
|
|
||||||
setup_unsafe_polkit_rules()
|
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
|
if [ "$question" = "y" ]; then
|
||||||
sudo cp ./policy/org.freedesktop.fwupd-unsafe.rules /etc/polkit-1/rules.d/
|
sudo cp ./policy/org.freedesktop.fwupd-unsafe.rules /etc/polkit-1/rules.d/
|
||||||
fi
|
fi
|
||||||
@ -85,6 +85,16 @@ setup_precommit()
|
|||||||
pre-commit install
|
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()
|
check_markdown()
|
||||||
{
|
{
|
||||||
if ! python3 $HELPER test-markdown; then
|
if ! python3 $HELPER test-markdown; then
|
||||||
@ -128,6 +138,12 @@ detect_os()
|
|||||||
#needed for arguments for some commands
|
#needed for arguments for some commands
|
||||||
detect_os "$@"
|
detect_os "$@"
|
||||||
|
|
||||||
|
#always setup pre-commit
|
||||||
|
setup_precommit
|
||||||
|
|
||||||
|
#always setup git environment
|
||||||
|
setup_git
|
||||||
|
|
||||||
#if interactive install build deps and prepare environment
|
#if interactive install build deps and prepare environment
|
||||||
if [ -t 2 ]; then
|
if [ -t 2 ]; then
|
||||||
case $OS in
|
case $OS in
|
||||||
@ -143,10 +159,5 @@ if [ -t 2 ]; then
|
|||||||
check_markdown
|
check_markdown
|
||||||
setup_vscode
|
setup_vscode
|
||||||
rename_branch
|
rename_branch
|
||||||
|
setup_prepush
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#always setup pre-commit
|
|
||||||
setup_precommit
|
|
||||||
|
|
||||||
#always setup git environment
|
|
||||||
setup_git
|
|
||||||
|
Loading…
Reference in New Issue
Block a user