add a basic ci test to make testing easier

This commit is contained in:
Zach White
2021-07-07 20:00:39 -07:00
parent 4772e68828
commit bcdac9a80e
2 changed files with 69 additions and 8 deletions
Executable
+58
View File
@@ -0,0 +1,58 @@
#!/usr/bin/env bash
set -e
#set -x
ADVANCED=false
TMPDIR=$(mktemp -d)
QMK_HOME="$TMPDIR/qmk_firmware"
export QMK_HOME
for arg in $@; do
if [ "$arg" = "-a" ]; then
ADVANCED=true
fi
done
if [ $ADVANCED = true ]; then
echo "*** Running in advanced mode with tmp files in $TMPDIR"
else
echo "*** Running in basic mode with tmp files in $TMPDIR"
fi
# Setup our virtualenv
if [ -e .ci_venv ]; then
rm -rf .ci_venv
fi
python3 -m venv .ci_venv
source .ci_venv/bin/activate
# Install dependencies
pip3 install -e .
pip3 install -r requirements-dev.txt
# Ensure that qmk works
echo "*** Testing 'qmk clone -h'"
qmk clone -h
echo "*** Testing 'qmk config -a'"
qmk config -a
echo "*** Testing 'qmk setup -n'"
qmk setup -n
echo
echo "*** Basic tests completed successfully!"
# Run advanced test if requested
if [ $ADVANCED = true ]; then
echo
echo "*** Testing 'qmk setup -y'"
qmk setup -y
echo
echo "*** Advanced tests completed successfully!"
fi
# Cleanup
deactivate
rm -rf .ci_venv $TMPDIR
+11 -8
View File
@@ -83,6 +83,8 @@ def setup(cli):
git_upstream(cli.args.home)
else:
exit(1)
else:
cli.log.warning('Not cloning qmk_firmware due to user input or --no flag.')
# Offer to set `user.qmk_home` for them.
if str(cli.args.home) != os.environ['QMK_HOME'] and yesno(home_prompt):
@@ -91,14 +93,15 @@ def setup(cli):
cli.write_config_option('user', 'qmk_home')
# Run `qmk doctor` to check the rest of the environment out
color = '--color' if cli.config.general.color else '--no-color'
unicode = '--unicode' if cli.config.general.unicode else '--no-unicode'
doctor_command = [Path(sys.argv[0]).as_posix(), color, unicode, 'doctor']
if cli.args.home.exists():
color = '--color' if cli.config.general.color else '--no-color'
unicode = '--unicode' if cli.config.general.unicode else '--no-unicode'
doctor_command = [Path(sys.argv[0]).as_posix(), color, unicode, 'doctor']
if cli.args.no:
doctor_command.append('--no')
if cli.args.no:
doctor_command.append('-n')
if cli.args.yes:
doctor_command.append('--yes')
if cli.args.yes:
doctor_command.append('-y')
cli.run(doctor_command, stdin=None, capture_output=False)
cli.run(doctor_command, stdin=None, capture_output=False)