diff --git a/README.md b/README.md index bacf1669..47d64d95 100644 --- a/README.md +++ b/README.md @@ -166,28 +166,39 @@ deploy: 1. Install arduino-cli from here: https://arduino.github.io/arduino-cli/installation/ 2. Download ci-arduino * `git clone https://github.com/adafruit/ci-arduino` -3. Put these lines at the end of your `.bashrc` or `.bash_profile` if you're on OSX. Make sure to fill in the path to where you installed ci-arduino and replacing USER with your username. +3. Put these lines at the end of your `.bashrc` or `.bash_profile` if you're on OSX. Make sure to fill in the path to where you installed ci-arduino. Make sure to that the libraries directory exists by installing a library first: + * `arduino-cli lib install "Adafruit NeoPixel"` + * Linux ```bash alias test-platforms='python3 ~/path/to/ci-arduino/build_platform.py' - export HOME=/home/USER/ + export HOME_DIR=/home/$USER ``` + * Mac/OSX + ```bash + alias test-platforms='python3 ~/path/to/ci-arduino/build_platform.py' + export HOME_DIR=/Users/$USER + export ARDUINO_LIB_DIR=/Documents/Arduino/libraries + ``` + * Then run `source ~/.bashrc` (Linux) or `source ~/.bash_profile` (Mac/OSX) + * If this file doesn't already exist, you can create it with `source ~/.bashrc` (Linux) or `source ~/.bash_profile` (Mac/OSX) 4. Run this at the top level of the library you want to test ```bash adafruit@adafruit:~/Adafruit_BMP183_Library$ export GITHUB_WORKSPACE=$(pwd) ``` 5. Remove everything in test library, and re-create it ```bash - adafruit@adafruit:~/Adafruit_BMP183_Library$ rm -rf ~/Arduino/libraries/Adafruit_Test_Library/; mkdir ~/Arduino/libraries/Adafruit_Test_Library + adafruit@adafruit:~/Adafruit_BMP183_Library$ rm -rf $HOME_DIR$ARDUINO_LIB_DIR/Adafruit_Test_Library/; mkdir $HOME_DIR$ARDUINO_LIB_DIR/Adafruit_Test_Library ``` 6. Still in the top-level directory of the library you'll be testing, copy the current library to Adafruit_Test_Library ```bash - adafruit@adafruit:~/Adafruit_BMP183_Library$ cp * ~/Arduino/libraries/Adafruit_Test_Library/ + adafruit@adafruit:~/Adafruit_BMP183_Library$ cp * $HOME_DIR$ARDUINO_LIB_DIR/Adafruit_Test_Library/ ``` 7. Grep for build_platform.py in githubci.yml to find out what boards to test. ```bash adafruit@adafruit:~/Adafruit_BMP183_Library$ grep 'build_platform.py' .github/workflows/githubci.yml run: python3 ci/build_platform.py main_platforms ``` + * If nothing useful is returned, open .github/workflows/githubci.yml and find the list where the platforms to test are 8. Run test-platforms. This may take a while, and tests for some boards sometimes run orders of magnitude slower than tests for other boards. ```bash test-platforms main_platforms diff --git a/build_platform.py b/build_platform.py index 1952dde7..a6c96229 100644 --- a/build_platform.py +++ b/build_platform.py @@ -26,6 +26,17 @@ BUILD_DIR = os.path.abspath(".") pass +# Get home directory +try: + HOME = os.environ["HOME_DIR"] +except KeyError: + HOME = os.environ["HOME"] + +try: + ARDUINO_LOCATION = os.environ["ARDUINO_LIB_DIR"] +except KeyError: + ARDUINO_LOCATION = '/Arduino/libraries' + os.environ["PATH"] += os.pathsep + BUILD_DIR + "/bin" print("build dir:", BUILD_DIR) @@ -179,7 +190,7 @@ def run_or_die(cmd, error): # link test library folder to the arduino libraries folder if not IS_LEARNING_SYS: try: - os.symlink(BUILD_DIR, os.environ['HOME']+'/Arduino/libraries/Adafruit_Test_Library') + os.symlink(BUILD_DIR, HOME+ARDUINO_LOCATION+'/Adafruit_Test_Library') except FileExistsError: pass @@ -209,7 +220,7 @@ def run_or_die(cmd, error): if our_name: run_or_die("arduino-cli lib uninstall \""+our_name+"\"", "Could not uninstall") -print("Libraries installed: ", glob.glob(os.environ['HOME']+'/Arduino/libraries/*')) +print("Libraries installed: ", glob.glob(HOME+ARDUINO_LOCATION+'/*')) ################################ Test platforms platforms = []