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 4 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 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
Copy link
Member

@brentru brentru Jun 21, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way to do this without exporting the HOME alias? Could you try making another alias? Exporting HOME ended up seriously messing up my home directory in macOS, very difficult to restore back to original alias.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ooh, yeah I did not think about that. I'll change the name so it won't conflict with that.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please do!

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$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
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
9 changes: 7 additions & 2 deletions build_platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@
BUILD_DIR = os.path.abspath(".")
pass

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 +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

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