Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated instructions to work on mac also #101

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 13 additions & 2 deletions build_platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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 = []
Expand Down