Skip to content

Commit 3be916b

Browse files
committed
Add setup details to the README.
1 parent adf56bf commit 3be916b

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

README.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,50 @@ and individual library release zips on Travis CI.
88

99
The pip package includes mpy-crosses that run on Travis. They will likely not
1010
work in other environments.
11+
12+
## Setting up libraries
13+
14+
These build tools are intended for use with [Travis CI](https://travis-ci.org)
15+
to automatically build .mpy files and zip them up for CircuitPython when a new
16+
tagged release is created. This file is relatively generic and can be shared
17+
across multiple repositories by following these steps:
18+
19+
1. Use the [CircuitPython cookiecutter](https://github.com/adafruit/cookiecutter-adafruit-circuitpython) to generate .travis.yml and requirements.txt.
20+
2. For adafruit repositories, simply give the CircuitPythonLibrarians team
21+
write access to the repo and Adabot will do the rest.
22+
23+
Otherwise, go to travis-ci.org and find the repository (it needs to be
24+
setup to access your github account, and your github account needs access
25+
to write to the repo). Flip the 'ON' switch on for Travis and the repo,
26+
see the Travis docs for more details: https://docs.travis-ci.com/user/getting-started/
27+
3. Get a GitHub 'personal access token' which has at least 'public_repo' or
28+
'repo' scope: https://help.github.com/articles/creating-an-access-token-for-command-line-use/
29+
Keep this token safe and secure! Anyone with the token will be able to
30+
access and write to your GitHub repositories. Travis will use the token
31+
to attach the .mpy files to the release.
32+
4. In the Travis CI settings for the repository that was enabled find the
33+
environment variable editing page: https://docs.travis-ci.com/user/environment-variables/#Defining-Variables-in-Repository-Settings
34+
Add an environment variable named GITHUB_TOKEN and set it to the value
35+
of the GitHub personal access token above. Keep 'Display value in build
36+
log' flipped off.
37+
5. That's it! Tag a release and Travis should go to work to add .mpy files
38+
to the release. It takes about a 2-3 minutes for a worker to spin up,
39+
build mpy-cross, and add the binaries to the release.
40+
41+
The bundle build will produce one zip file for every major CircuitPython
42+
release containing compatible mpy files and a zip with human readable py files.
43+
It'll also "release" a `z-build_tools_version-x.x.x.ignore` file that will be
44+
used to determine when a library needs new release files because the build tools
45+
themselves changed such as when a new major CircuitPython release happens.
46+
47+
## Building libraries locally
48+
49+
To build libraries built with the build tools you'll need to install the
50+
circuitpython-travis-build-tools package.
51+
52+
```shell
53+
python3 -m venv .env
54+
source .env/bin/activate
55+
pip install -r requirements.txt
56+
circuitpython-build-bundles --filename_prefix <output file prefix> --library_location .
57+
```

0 commit comments

Comments
 (0)