From 82c0999469151bf9d3d1a53397ab217180443faa Mon Sep 17 00:00:00 2001 From: dherrada Date: Thu, 17 Jun 2021 10:59:53 -0400 Subject: [PATCH 1/5] Updated instructions to work on mac also --- README.md | 17 +++++++++++++---- build_platform.py | 9 +++++++-- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index bacf1669..4edd5783 100644 --- a/README.md +++ b/README.md @@ -166,22 +166,31 @@ 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 and replacing USER with your username. 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=/home/USER ``` + * Mac/OSX + ```bash + alias test-platforms='python3 ~/path/to/ci-arduino/build_platform.py' + export HOME=/Users/USER + export ARDUINO_LIB_DIR=/Documents/Arduino/libraries + ``` + * Then run `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$ARDUINO_LIB_DIR/Adafruit_Test_Library/; mkdir $HOME$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$ARDUINO_LIB_DIR/Adafruit_Test_Library/ ``` 7. Grep for build_platform.py in githubci.yml to find out what boards to test. ```bash diff --git a/build_platform.py b/build_platform.py index 1952dde7..9cc9d14c 100644 --- a/build_platform.py +++ b/build_platform.py @@ -26,6 +26,11 @@ BUILD_DIR = os.path.abspath(".") pass +try: + ARDUINO_LOCATION = os.environ["ARDUINO_LIB_DIR"] +except KeyError: + ARDUINO_LOCATION = os.environ['HOME']+'/Arduino/libraries' + os.environ["PATH"] += os.pathsep + BUILD_DIR + "/bin" print("build dir:", BUILD_DIR) @@ -179,7 +184,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, os.environ['HOME']+ARDUINO_LOCATION+'/Adafruit_Test_Library') except FileExistsError: pass @@ -209,7 +214,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(os.environ['HOME']+ARDUINO_LOCATION+'/*')) ################################ Test platforms platforms = [] From 9f045a3da68793cf829e934b72815a68800d619d Mon Sep 17 00:00:00 2001 From: Dylan Herrada <33632497+dherrada@users.noreply.github.com> Date: Thu, 17 Jun 2021 11:03:11 -0400 Subject: [PATCH 2/5] Added explanation for when lists are used for platforms to test --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 4edd5783..3b80d4c8 100644 --- a/README.md +++ b/README.md @@ -197,6 +197,7 @@ deploy: 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 From 66e6ad82834dee18d9b340e1f5277ea819861159 Mon Sep 17 00:00:00 2001 From: Dylan Herrada <33632497+dherrada@users.noreply.github.com> Date: Thu, 17 Jun 2021 11:04:16 -0400 Subject: [PATCH 3/5] Fixed path --- build_platform.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_platform.py b/build_platform.py index 9cc9d14c..05f6e070 100644 --- a/build_platform.py +++ b/build_platform.py @@ -29,7 +29,7 @@ try: ARDUINO_LOCATION = os.environ["ARDUINO_LIB_DIR"] except KeyError: - ARDUINO_LOCATION = os.environ['HOME']+'/Arduino/libraries' + ARDUINO_LOCATION = '/Arduino/libraries' os.environ["PATH"] += os.pathsep + BUILD_DIR + "/bin" print("build dir:", BUILD_DIR) From f825111aa3ed51fd66e106cee28baf5e1731bdd8 Mon Sep 17 00:00:00 2001 From: Dylan Herrada <33632497+dherrada@users.noreply.github.com> Date: Mon, 21 Jun 2021 14:42:45 -0400 Subject: [PATCH 4/5] Added explanation for bashrc and bash_profile --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3b80d4c8..16737523 100644 --- a/README.md +++ b/README.md @@ -179,7 +179,8 @@ deploy: export HOME=/Users/USER export ARDUINO_LIB_DIR=/Documents/Arduino/libraries ``` - * Then run `source .bashrc` (Linux) or `source .bash_profile` (Mac/OSX) + * 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) From 6963246a307659c73836c009911f3e495f197378 Mon Sep 17 00:00:00 2001 From: dherrada Date: Tue, 22 Jun 2021 10:51:58 -0400 Subject: [PATCH 5/5] Made local build_platforms not conflict with mac env variables --- README.md | 10 +++++----- build_platform.py | 10 ++++++++-- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 16737523..47d64d95 100644 --- a/README.md +++ b/README.md @@ -166,17 +166,17 @@ 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. Make sure to that the libraries directory exists by installing a library first: +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=/Users/USER + export HOME_DIR=/Users/$USER export ARDUINO_LIB_DIR=/Documents/Arduino/libraries ``` * Then run `source ~/.bashrc` (Linux) or `source ~/.bash_profile` (Mac/OSX) @@ -187,11 +187,11 @@ deploy: ``` 5. Remove everything in test library, and re-create it ```bash - adafruit@adafruit:~/Adafruit_BMP183_Library$ rm -rf $HOME$ARDUINO_LIB_DIR/Adafruit_Test_Library/; mkdir $HOME$ARDUINO_LIB_DIR/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 * $HOME$ARDUINO_LIB_DIR/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 diff --git a/build_platform.py b/build_platform.py index 05f6e070..a6c96229 100644 --- a/build_platform.py +++ b/build_platform.py @@ -26,6 +26,12 @@ 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: @@ -184,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_LOCATION+'/Adafruit_Test_Library') + os.symlink(BUILD_DIR, HOME+ARDUINO_LOCATION+'/Adafruit_Test_Library') except FileExistsError: pass @@ -214,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_LOCATION+'/*')) +print("Libraries installed: ", glob.glob(HOME+ARDUINO_LOCATION+'/*')) ################################ Test platforms platforms = []