diff options
Diffstat (limited to 'util')
-rwxr-xr-x | util/activate_msys2.sh | 1 | ||||
-rwxr-xr-x | util/activate_wsl.sh | 1 | ||||
-rwxr-xr-x | util/atmega32a_program.py | 110 | ||||
-rwxr-xr-x | util/docker_build.sh | 1 | ||||
-rwxr-xr-x | util/linux_install.sh | 18 | ||||
-rwxr-xr-x | util/macos_install.sh | 7 | ||||
-rwxr-xr-x | util/msys2_install.sh | 66 | ||||
-rwxr-xr-x | util/travis_build.sh | 79 | ||||
-rwxr-xr-x | util/travis_compiled_push.sh | 3 | ||||
-rwxr-xr-x | util/travis_docs.sh | 1 | ||||
-rwxr-xr-x | util/travis_push.sh | 5 | ||||
-rw-r--r-- | util/travis_test.sh | 27 | ||||
-rwxr-xr-x | util/travis_utils.sh | 24 | ||||
-rwxr-xr-x | util/win_shared_install.sh | 4 |
14 files changed, 117 insertions, 230 deletions
diff --git a/util/activate_msys2.sh b/util/activate_msys2.sh index 1ddffbaad7..85d645e6d0 100755 --- a/util/activate_msys2.sh +++ b/util/activate_msys2.sh @@ -5,6 +5,7 @@ function export_variables { export PATH=$PATH:$util_dir export PATH=$PATH:$util_dir/dfu-programmer export PATH=$PATH:$util_dir/dfu-util-0.9-win64 + export PATH=$PATH:$util_dir/bootloadHID.2012-12-08/commandline export PATH=$PATH:$util_dir/flip/bin export PATH=$PATH:$util_dir/avr8-gnu-toolchain/bin export PATH=$PATH:$util_dir/gcc-arm-none-eabi/bin diff --git a/util/activate_wsl.sh b/util/activate_wsl.sh index e2312b56d4..cd88d2b655 100755 --- a/util/activate_wsl.sh +++ b/util/activate_wsl.sh @@ -7,6 +7,7 @@ function export_variables { export DFU_PROGRAMMER=$download_dir/dfu-programmer/dfu-programmer.exe export DFU_UTIL=$download_dir/dfu-util-0.9-win64/dfu-util.exe export TEENSY_LOADER_CLI=$download_dir/teensy_loader_cli.exe + export BOOTLOADHID_PROGRAMMER=$download_dir/bootloadHID.2012-12-08/commandline/bootloadHID.exe export BATCHISP=batchisp.exe } diff --git a/util/atmega32a_program.py b/util/atmega32a_program.py deleted file mode 100755 index 9438c7e779..0000000000 --- a/util/atmega32a_program.py +++ /dev/null @@ -1,110 +0,0 @@ -#!/usr/bin/env python -# Copyright 2017 Luiz Ribeiro <[email protected]>, Sebastian Kaim <[email protected]> -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. - -from __future__ import print_function - -import os -import sys -import time -import argparse -import usb - - -def check_keyboard_normal_mode(vendor, product): - """Returns a device if a ps2avrGB device in normal made (that is in keyboard mode) or None if it is not found.""" - return usb.core.find(idVendor=vendor, idProduct=product) - -def check_keyboard_bootloader_mode(): - """Returns True if a ps2avrGB device in bootloader (flashable) mode is found and False otherwise.""" - return (usb.core.find(idVendor=0x16c0, idProduct=0x05df) is not None) - -def flash_keyboard(firmware_file): - """Calls bootloadHID to flash the given file to the device.""" - print('Flashing firmware to device ...') - if os.system('bootloadHID -r "%s"' % firmware_file) == 0: - print('\nDone!') - else: - print('\nbootloadHID returned an error.') - -def print_device_info(dev): - """Prints all infos for a given USB device""" - print('Device Information:') - print(' idVendor: %d (0x%04x)' % (dev.idVendor, dev.idVendor)) - print(' idProduct: %d (0x%04x)' % (dev.idProduct, dev.idProduct)) - print('Manufacturer: %s' % (dev.iManufacturer)) - print('Serial: %s' % (dev.iSerialNumber)) - print('Product: %s' % (dev.iProduct), end='\n\n') - -def send_device_to_bootloader_mode(dev): - """Tries to send a given ps2avrGB keyboard to bootloader mode to allow flashing.""" - try: - dev.set_configuration() - - request_type = usb.util.build_request_type( - usb.util.CTRL_OUT, - usb.util.CTRL_TYPE_CLASS, - usb.util.CTRL_RECIPIENT_DEVICE) - - USBRQ_HID_SET_REPORT = 0x09 - HID_REPORT_OPTION = 0x0301 - - dev.ctrl_transfer(request_type, USBRQ_HID_SET_REPORT, HID_REPORT_OPTION, 0, [0, 0, 0xFF] + [0] * 5) - except usb.core.USBError: - # for some reason I keep getting USBError, but it works! - pass - -def auto_int(value): - """Helper for argparse to enable auto base detection""" - return int(value, 0) - -parser = argparse.ArgumentParser(description='Flash bootloadHID device') -parser.add_argument('--vendor', type=auto_int, default=0x20A0, help='Non bootloader idVendor to search for (default: 0x%(default)04x)') -parser.add_argument('--product', type=auto_int, default=0x422D, help='Non bootloader idProduct to search for (default: 0x%(default)04x)') -parser.add_argument('firmware_hex', type=argparse.FileType('r'), help='Firmware hex file to flash') -args = parser.parse_args() - -kb = check_keyboard_normal_mode(args.vendor, args.product) - -if kb is not None: - print('Found a keyboard in normal mode. Attempting to send it to bootloader mode ...', end='') - send_device_to_bootloader_mode(kb) - print(' done.') - print("Hint: If your keyboard can't be set to bootloader mode automatically, plug it in while pressing the bootloader key to do so manually.") - print(" You can find more infos about this here: https://github.com/qmk/qmk_firmware/tree/master/keyboards/ps2avrGB#setting-the-board-to-bootloader-mode") - -attempts = 12 # 60 seconds -found = False -for attempt in range(1, attempts + 1): - print("Searching for keyboard in bootloader mode (%i/%i) ... " % (attempt, attempts), end='') - - if check_keyboard_bootloader_mode(): - print('Found', end='\n\n') - flash_keyboard(args.firmware_hex.name) - found = True - break - else: - print('Nothing.', end='') - - if attempt != attempts: # no need to wait on the last attempt - print(' Sleeping 5 seconds.', end='') - time.sleep(5) - - # print a newline - print() - -if not found: - print("Couldn't find a flashable keyboard. Aborting.") - sys.exit(2) diff --git a/util/docker_build.sh b/util/docker_build.sh index 99d59d1696..d8c4c759a3 100755 --- a/util/docker_build.sh +++ b/util/docker_build.sh @@ -51,6 +51,7 @@ dir=$(pwd -W 2>/dev/null) || dir=$PWD # Use Windows path if on Windows # Run container and build firmware docker run --rm -it $usb_args \ + --user $(id -u):$(id -g) \ -w /qmk_firmware \ -v "$dir":/qmk_firmware \ -e ALT_GET_KEYBOARDS=true \ diff --git a/util/linux_install.sh b/util/linux_install.sh index c54a806234..9229814182 100755 --- a/util/linux_install.sh +++ b/util/linux_install.sh @@ -10,6 +10,16 @@ SOLUS_INFO="Your tools are now installed. To start using them, open new terminal util_dir=$(dirname "$0") +# For those distros that do not package bootloadHID +install_bootloadhid() { + wget https://www.obdev.at/downloads/vusb/bootloadHID.2012-12-08.tar.gz -O - | tar -xz -C /tmp + cd /tmp/bootloadHID.2012-12-08/commandline/ + if make; then + sudo cp bootloadHID /usr/local/bin + fi + cd - +} + if grep ID /etc/os-release | grep -qE "fedora"; then sudo dnf install \ arm-none-eabi-binutils-cs \ @@ -28,6 +38,7 @@ if grep ID /etc/os-release | grep -qE "fedora"; then glibc-headers \ kernel-devel \ kernel-headers \ + libusb-devel \ make \ perl \ python3 \ @@ -54,7 +65,9 @@ elif grep ID /etc/os-release | grep -qE 'debian|ubuntu'; then gcc-avr \ git \ libnewlib-arm-none-eabi \ + libusb-dev \ python3 \ + python3-pip \ unzip \ wget \ zip @@ -70,12 +83,14 @@ elif grep ID /etc/os-release | grep -q 'arch\|manjaro'; then avr-libc \ avr-gcc \ base-devel \ + bootloadhid \ clang \ dfu-programmer \ dfu-util \ diffutils \ gcc \ git \ + libusb-compat \ python \ python-pip \ unzip \ @@ -138,6 +153,7 @@ elif grep ID /etc/os-release | grep -qE "opensuse|tumbleweed"; then dfu-tool \ dfu-programmer \ gcc \ + libusb-devel \ python3 \ unzip \ wget \ @@ -177,6 +193,7 @@ elif grep ID /etc/os-release | grep -q solus; then avrdude \ dfu-util \ dfu-programmer \ + libusb-devel \ python3 \ git \ wget \ @@ -214,4 +231,5 @@ else fi # Global install tasks +install_bootloadhid pip3 install --user -r ${util_dir}/../requirements.txt diff --git a/util/macos_install.sh b/util/macos_install.sh index c5c27d1670..a4037cce9e 100755 --- a/util/macos_install.sh +++ b/util/macos_install.sh @@ -22,8 +22,11 @@ if ! brew --version >/dev/null 2>&1; then fi brew tap osx-cross/avr -brew tap PX4/homebrew-px4 +brew tap osx-cross/arm brew update -brew install avr-gcc@8 gcc-arm-none-eabi dfu-programmer avrdude clang-format dfu-util python3 +brew install avr-gcc@8 arm-gcc-bin@8 dfu-programmer avrdude clang-format dfu-util python3 +brew install --HEAD https://raw.githubusercontent.com/robertgzr/homebrew-tap/master/bootloadhid.rb brew link --force avr-gcc@8 +brew link --force arm-gcc-bin@8 + pip3 install -r "${util_dir}/../requirements.txt" diff --git a/util/msys2_install.sh b/util/msys2_install.sh index 58397c7a3f..d1e24ca6d0 100755 --- a/util/msys2_install.sh +++ b/util/msys2_install.sh @@ -8,25 +8,27 @@ installflip=false util_dir=$(dirname "$0") echo "Installing dependencies needed for the installation (quazip)" -pacman --needed -S base-devel mingw-w64-x86_64-toolchain mingw-w64-x86_64-clang msys/git msys/p7zip msys/python3 msys/unzip +pacman --needed --noconfirm --disable-download-timeout -Sy base-devel mingw-w64-x86_64-toolchain mingw-w64-x86_64-clang msys/git msys/p7zip mingw-w64-x86_64-python3-pip msys/unzip source "$dir/win_shared_install.sh" function install_avr { rm -f -r "$avrtools" - wget "http://ww1.microchip.com/downloads/en/DeviceDoc/avr8-gnu-toolchain-3.6.1.1752-win32.any.x86.zip" + wget "https://blog.zakkemble.net/download/avr-gcc-8.3.0-x86-mingw.zip" echo "Extracting AVR toolchain..." - unzip -q avr8-gnu-toolchain-3.6.1.1752-win32.any.x86.zip - mv avr8-gnu-toolchain-win32_x86/ avr8-gnu-toolchain - rm __MACOSX -R - rm avr8-gnu-toolchain-3.6.1.1752-win32.any.x86.zip - pacman --needed -S mingw-w64-x86_64-avrdude + unzip -q -d . avr-gcc-8.3.0-x86-mingw.zip + mv avr-gcc-8.3.0-x86-mingw avr8-gnu-toolchain + rm avr8-gnu-toolchain/bin/make.exe + rm avr-gcc-8.3.0-x86-mingw.zip + pacman --needed --disable-download-timeout -S mingw-w64-x86_64-avrdude } function install_arm { - wget -O gcc-arm-none-eabi.zip "https://developer.arm.com/-/media/Files/downloads/gnu-rm/6-2017q2/gcc-arm-none-eabi-6-2017-q2-update-win32.zip?product=GNU%20ARM%20Embedded%20Toolchain,ZIP,,Windows,6-2017-q2-update" - unzip -d gcc-arm-none-eabi gcc-arm-none-eabi.zip - rm gcc-arm-none-eabi.zip + rm -f -r "$armtools" + wget -O gcc-arm-none-eabi-8-2019-q3-update-win32.zip "https://developer.arm.com/-/media/Files/downloads/gnu-rm/8-2019q3/RC1.1/gcc-arm-none-eabi-8-2019-q3-update-win32.zip" + echo "Extracting ARM toolchain..." + unzip -q -d gcc-arm-none-eabi gcc-arm-none-eabi-8-2019-q3-update-win32.zip + rm gcc-arm-none-eabi-8-2019-q3-update-win32.zip } function extract_flip { @@ -43,17 +45,10 @@ if [ -f "FlipInstaller.exe" ]; then fi if [ ! -d "$avrtools" ]; then - while true; do - echo - echo "The AVR toolchain is not installed." - echo "This is needed for building AVR based keboards." - read -p "Do you want to install it? (Y/N) " res - case $res in - [Yy]* ) install_avr; break;; - [Nn]* ) break;; - * ) echo "Invalid answer";; - esac - done + echo + echo "The AVR toolchain is not installed." + echo "This is needed for building AVR based keyboards." + install_avr else while true; do echo @@ -68,17 +63,10 @@ else fi if [ ! -d "$armtools" ]; then - while true; do - echo - echo "The ARM toolchain is not installed." - echo "This is needed for building ARM based keyboards." - read -p "Do you want to install it? (Y/N) " res - case $res in - [Yy]* ) install_arm; break;; - [Nn]* ) break;; - * ) echo "Invalid answer";; - esac - done + echo + echo "The ARM toolchain is not installed." + echo "This is needed for building ARM based keyboards." + install_arm else while true; do echo @@ -103,18 +91,10 @@ then echo "The line source ~/qmk_utils/activate_msys2.sh is already added to your /.bashrc" echo "Not adding it twice!" else - while true; do echo - echo "Do you want to add 'source ~/qmk_utils/activate_msys2.sh' to the end of your" - echo ".bashrc file? Without this make won't find the needed utils, so if you don't" - echo "want to do it automatically, then you have to do it manually later." - read -p "(Y/N)? " res - case $res in - [Yy]* ) echo "source ~/qmk_utils/activate_msys2.sh" >> ~/.bashrc; break;; - [Nn]* ) break;; - * ) echo "Invalid answer";; - esac - done + echo "Adding 'source ~/qmk_utils/activate_msys2.sh' to the end of your" + echo ".bashrc file. Without this make won't find the needed utils." + echo "source ~/qmk_utils/activate_msys2.sh" >> ~/.bashrc; fi echo diff --git a/util/travis_build.sh b/util/travis_build.sh index 225c8548f5..6d5dbed684 100755 --- a/util/travis_build.sh +++ b/util/travis_build.sh @@ -1,57 +1,42 @@ #!/bin/bash -# if docker is installed - patch calls to within the qmk docker image -if command -v docker >/dev/null; then - function make() { - docker run --rm -e MAKEFLAGS="$MAKEFLAGS" -w /qmk_firmware/ -v "$PWD":/qmk_firmware --user $(id -u):$(id -g) qmkfm/base_container make "$@" - } +source util/travis_utils.sh + +NUM_CORE_CHANGES=$(echo "$QMK_CHANGES" | grep -Ecv -e '^(docs/)' -e '^(keyboards/)' -e '^(layouts/)' -e '^(util/)' -e '^(lib/python/)' -e '^(bin/qmk)' -e '^(requirements.txt)' -e '(.travis.yml)') + +if [[ "$TRAVIS_COMMIT_MESSAGE" == *"[skip build]"* ]]; then + echo "Skipping due to commit message" + exit 0 fi -# test force push -#TRAVIS_COMMIT_RANGE="c287f1bfc5c8...81f62atc4c1d" +if [ "$LOCAL_BRANCH" == "master" ] || [ "$NUM_CORE_CHANGES" != "0" ]; then + echo "Making default keymaps for all keyboards" + make all:default + exit $? +fi -TRAVIS_COMMIT_MESSAGE="${TRAVIS_COMMIT_MESSAGE:-none}" -TRAVIS_COMMIT_RANGE="${TRAVIS_COMMIT_RANGE:-HEAD~1..HEAD}" -MAKE_ALL="make all:default" +exit_code=0 -if [[ "$TRAVIS_COMMIT_MESSAGE" != *"[skip build]"* ]] ; then - exit_code=0 - git diff --name-only -n 1 ${TRAVIS_COMMIT_RANGE} - if [ $? -eq 128 ]; then - # We don't know what changed so just build the default keymaps - echo "Making default keymaps for all keyboards (fallback)" - eval $MAKE_ALL +for KB in $(make list-keyboards); do + KEYBOARD_CHANGES=$(echo "$QMK_CHANGES" | grep -E '^(keyboards/'${KB}'/)') + if [[ -z "$KEYBOARD_CHANGES" ]]; then + # skip as no changes for this keyboard + continue + fi + + KEYMAP_ONLY=$(echo "$KEYBOARD_CHANGES" | grep -cv /keymaps/) + if [[ $KEYMAP_ONLY -gt 0 ]]; then + echo "Making all keymaps for $KB" + make ${KB}:all : $((exit_code = $exit_code + $?)) else - NEFM=$(git diff --name-only -n 1 ${TRAVIS_COMMIT_RANGE} | grep -Ev '^(keyboards/)' | grep -Ev '^(docs/)' | grep -Ev '^(lib/python/)' | grep -Ev '^(bin/qmk)' | grep -Ev '^(requirements.txt)' | grep -Ev '^(util/)' | wc -l) - BRANCH=$(git rev-parse --abbrev-ref HEAD) - # is this branch master or a "non docs, non keyboards" change - if [ $NEFM -gt 0 -o "$BRANCH" = "master" ]; then - echo "Making default keymaps for all keyboards" - eval $MAKE_ALL + CHANGED_KEYMAPS=$(echo "$KEYBOARD_CHANGES" | grep -oP '(?<=keyboards/'${KB}'/keymaps/)([a-zA-Z0-9_-]+)(?=\/)') + for KM in $CHANGED_KEYMAPS ; do + echo "Making $KM for $KB" + make ${KB}:${KM} : $((exit_code = $exit_code + $?)) - else - # keyboards project format - # /keyboards/board1/rev/keymaps/ - # /keyboards/board2/keymaps/ - # ensure we strip everything off after and including the keymaps folder to get board and/or revision - MKB=$(git diff --name-only -n 1 ${TRAVIS_COMMIT_RANGE} | grep -oP '(?<=keyboards\/)([a-zA-Z0-9_\/]+)(?=\/)' | sed 's^/keymaps/.*^^' | sort -u) - for KB in $MKB ; do - KEYMAP_ONLY=$(git diff --name-only -n 1 ${TRAVIS_COMMIT_RANGE} | grep -Ev '^(keyboards/'${KB}'/keymaps/)' | wc -l) - if [[ $KEYMAP_ONLY -gt 0 ]]; then - echo "Making all keymaps for $KB" - make ${KB}:all - : $((exit_code = $exit_code + $?)) - else - MKM=$(git diff --name-only -n 1 ${TRAVIS_COMMIT_RANGE} | grep -oP '(?<=keyboards/'${KB}'/keymaps/)([a-zA-Z0-9_]+)(?=\/)' | sort -u) - for KM in $MKM ; do - echo "Making $KM for $KB" - make ${KB}:${KM} - : $((exit_code = $exit_code + $?)) - done - fi - done - fi + done fi - exit $exit_code -fi +done + +exit $exit_code diff --git a/util/travis_compiled_push.sh b/util/travis_compiled_push.sh index 8ca65f21a0..c18e42a293 100755 --- a/util/travis_compiled_push.sh +++ b/util/travis_compiled_push.sh @@ -1,5 +1,6 @@ #!/bin/bash +source util/travis_utils.sh source util/travis_push.sh set -o errexit -o nounset @@ -12,7 +13,7 @@ if [[ "$TRAVIS_BRANCH" == "master" && "$TRAVIS_PULL_REQUEST" == "false" ]] ; the # fix formatting git checkout master git diff --diff-filter=AM --name-only -n 1 -z ${TRAVIS_COMMIT_RANGE} | xargs -0 dos2unix -git diff --diff-filter=AM --name-only -n 1 -z ${TRAVIS_COMMIT_RANGE} | grep -e '^drivers' -e '^quantum' -e '^tests' -e '^tmk_core' | grep -v 'quantum/template' | xargs -0 clang-format +git diff --diff-filter=AM --name-only -n 1 -z ${TRAVIS_COMMIT_RANGE} '*.c' '*.h' '*.cpp' | grep -z -e '^drivers' -e '^quantum' -e '^tests' -e '^tmk_core' | grep -zv -e 'quantum/template' -e 'tmk_core/protocol/usb_hid' | xargs -0 clang-format -i git diff --diff-filter=AM --name-only -n 1 -z ${TRAVIS_COMMIT_RANGE} | xargs -0 git add git commit -m "format code according to conventions [skip ci]" && git push [email protected]:qmk/qmk_firmware.git master diff --git a/util/travis_docs.sh b/util/travis_docs.sh index 5cfd63466d..93c2d71867 100755 --- a/util/travis_docs.sh +++ b/util/travis_docs.sh @@ -1,5 +1,6 @@ #!/bin/bash +source util/travis_utils.sh source util/travis_push.sh if [[ "$TRAVIS_COMMIT_MESSAGE" != *"[skip docs]"* ]] ; then diff --git a/util/travis_push.sh b/util/travis_push.sh index d100f9d48f..7f7d4c2c64 100755 --- a/util/travis_push.sh +++ b/util/travis_push.sh @@ -1,10 +1,5 @@ # Use this by sourcing it in your script. -TRAVIS_BRANCH="${TRAVIS_BRANCH:master}" -TRAVIS_PULL_REQUEST="${TRAVIS_PULL_REQUEST:false}" -TRAVIS_COMMIT_MESSAGE="${TRAVIS_COMMIT_MESSAGE:-none}" -TRAVIS_COMMIT_RANGE="${TRAVIS_COMMIT_RANGE:-HEAD~1..HEAD}" - if [[ "$TRAVIS_BRANCH" == "master" && "$TRAVIS_PULL_REQUEST" == "false" ]] ; then git config --global user.name "QMK Bot" git config --global user.email "[email protected]" diff --git a/util/travis_test.sh b/util/travis_test.sh index 9b7402c282..95991907ef 100644 --- a/util/travis_test.sh +++ b/util/travis_test.sh @@ -1,26 +1,9 @@ #!/bin/bash -# if docker is installed - patch calls to within the qmk docker image -if command -v docker >/dev/null; then - function make() { - docker run --rm -e MAKEFLAGS="$MAKEFLAGS" -w /qmk_firmware/ -v "$PWD":/qmk_firmware --user $(id -u):$(id -g) qmkfm/base_container make "$@" - } - function qmk() { - docker run --rm -w /qmk_firmware/ -v "$PWD":/qmk_firmware --user $(id -u):$(id -g) qmkfm/base_container bin/qmk "$@" - } -fi - -TRAVIS_COMMIT_MESSAGE="${TRAVIS_COMMIT_MESSAGE:-none}" -TRAVIS_COMMIT_RANGE="${TRAVIS_COMMIT_RANGE:-HEAD~1..HEAD}" - -# test force push -#TRAVIS_COMMIT_RANGE="c287f1bfc5c8...81f62atc4c1d" - -BRANCH=$(git rev-parse --abbrev-ref HEAD) -CHANGES=$(git diff --name-only -n 1 ${TRAVIS_COMMIT_RANGE}) +source util/travis_utils.sh -NUM_CORE_CHANGES=$(echo "$CHANGES" | grep -Ecv -e '^(docs/)' -e '^(keyboards/)' -e '^(layouts/)') -NUM_PY_CHANGES=$(echo "$CHANGES" | grep -Ec -e '^(lib/python/)' -e '^(bin/qmk)') +NUM_CORE_CHANGES=$(echo "$QMK_CHANGES" | grep -Ecv -e '^(docs/)' -e '^(keyboards/)' -e '^(layouts/)' -e '^(util/)' -e '^(lib/python/)' -e '^(bin/qmk)' -e '^(requirements.txt)' -e '(.travis.yml)') +NUM_PY_CHANGES=$(echo "$QMK_CHANGES" | grep -Ec -e '^(lib/python/)' -e '^(bin/qmk)') if [[ "$TRAVIS_COMMIT_MESSAGE" == *"[skip test]"* ]]; then echo "Skipping due to commit message" @@ -29,14 +12,14 @@ fi exit_code=0 -if [ "$BRANCH" == "master" ] || [ "$NUM_CORE_CHANGES" != "0" ]; then +if [ "$LOCAL_BRANCH" == "master" ] || [ "$NUM_CORE_CHANGES" != "0" ]; then echo "Running tests." make test:all : $((exit_code = $exit_code + $?)) fi -if [ "$BRANCH" == "master" ] || [ "$NUM_PY_CHANGES" != "0" ]; then +if [ "$LOCAL_BRANCH" == "master" ] || [ "$NUM_PY_CHANGES" != "0" ]; then echo "Running python tests." qmk pytest : $((exit_code = $exit_code + $?)) diff --git a/util/travis_utils.sh b/util/travis_utils.sh new file mode 100755 index 0000000000..e3d806dfba --- /dev/null +++ b/util/travis_utils.sh @@ -0,0 +1,24 @@ +# Use this by sourcing it in your script. + +# Provide sane defaults for travis environment +TRAVIS_BRANCH="${TRAVIS_BRANCH:master}" +TRAVIS_PULL_REQUEST="${TRAVIS_PULL_REQUEST:false}" +TRAVIS_COMMIT_MESSAGE="${TRAVIS_COMMIT_MESSAGE:-none}" +TRAVIS_COMMIT_RANGE="${TRAVIS_COMMIT_RANGE:-HEAD~1..HEAD}" + +# test force push +#TRAVIS_COMMIT_RANGE="c287f1bfc5c8...81f62atc4c1d" + +# Extra variables +LOCAL_BRANCH=$(git rev-parse --abbrev-ref HEAD) +QMK_CHANGES=$(git diff --name-only -n 1 ${TRAVIS_COMMIT_RANGE}) + +# if docker is installed - patch calls to within the qmk docker image +if command -v docker >/dev/null; then + function make() { + docker run --rm -e MAKEFLAGS="$MAKEFLAGS" -w /qmk_firmware/ -v "$PWD":/qmk_firmware --user $(id -u):$(id -g) qmkfm/base_container make "$@" + } + function qmk() { + docker run --rm -w /qmk_firmware/ -v "$PWD":/qmk_firmware --user $(id -u):$(id -g) qmkfm/base_container bin/qmk "$@" + } +fi diff --git a/util/win_shared_install.sh b/util/win_shared_install.sh index f8fc9308f4..7ad000bfc4 100755 --- a/util/win_shared_install.sh +++ b/util/win_shared_install.sh @@ -18,6 +18,10 @@ function install_utils { wget 'https://www.pjrc.com/teensy/teensy_loader_cli_windows.zip' unzip teensy_loader_cli_windows.zip + echo "Installing bootloadHID" + wget 'https://www.obdev.at/downloads/vusb/bootloadHID.2012-12-08.zip' + unzip bootloadHID.2012-12-08.zip + echo "Installing Atmel Flip" wget 'http://ww1.microchip.com/downloads/en/DeviceDoc/Flip%20Installer%20-%203.4.7.112.exe' mv Flip\ Installer\ \-\ 3.4.7.112.exe FlipInstaller.exe |