Skip to content

Commit c3c290f

Browse files
Add initial CircuitPython packaging
1 parent 50964b6 commit c3c290f

File tree

8 files changed

+142
-1
lines changed

8 files changed

+142
-1
lines changed

.github/workflows/build.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Build CI
2+
3+
on: [pull_request, push]
4+
5+
jobs:
6+
test:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Set up Python 3
10+
uses: actions/setup-python@v4
11+
with:
12+
python-version: 3.x
13+
- name: Versions
14+
run: |
15+
python3 --version
16+
- uses: actions/checkout@v3
17+
with:
18+
submodules: true
19+
- name: Fetch correct submodule shas
20+
run: git submodule foreach 'git fetch --tags --depth 1 origin $sha1 && git checkout -q $sha1'
21+
- name: Install deps
22+
run: |
23+
sudo apt-get install -y gettext gawk
24+
pip install -r requirements.txt
25+
- name: Library version
26+
run: git describe --dirty --always --tags
27+
- name: Build assets
28+
run: ./build.sh

.github/workflows/release.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Release Actions
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
upload-release-assets:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Translate Repo Name For Build Tools filename_prefix
12+
id: repo-name
13+
run: |
14+
echo "repo-name=$(
15+
echo ${{ github.repository }} |
16+
awk -F '\/' '{ print tolower($2) }' |
17+
tr '_' '-'
18+
)" >> $GITHUB_OUTPUT
19+
- name: Set up Python 3
20+
uses: actions/setup-python@v4
21+
with:
22+
python-version: 3.x
23+
- name: Versions
24+
run: |
25+
python3 --version
26+
- uses: actions/checkout@v3
27+
with:
28+
submodules: true
29+
- name: Fetch correct submodule shas
30+
run: git submodule foreach 'git fetch --tags --depth 1 origin $sha1 && git checkout -q $sha1'
31+
- name: Install deps
32+
run: |
33+
sudo apt-get install -y gettext gawk
34+
pip install -r requirements.txt
35+
- name: Build assets
36+
run: circuitpython-build-bundles --filename_prefix ${{ steps.repo-name.outputs.repo-name }} --library_location qwiic/circuitpython --library_depth 2 --package_folder_prefix "Qwiic, qwiic, Pi"
37+
- name: Upload Release Assets
38+
uses: shogo82148/actions-upload-release-asset@v1
39+
with:
40+
asset_path: "bundles/*"
41+
github_token: ${{ secrets.GITHUB_TOKEN }}
42+
upload_url: ${{ github.event.release.upload_url }}

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,3 +113,6 @@
113113
path = qwiic/drivers/qwiic_otos
114114
url = https://github.com/sparkfun/Qwiic_OTOS_Py
115115

116+
[submodule "qwiic/circuitpython/Qwiic_SerLCD_Py"]
117+
path = qwiic/circuitpython/Qwiic_SerLCD_Py
118+
url = [email protected]:sparkfun/Qwiic_SerLCD_Py.git

build.sh

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#! /bin/bash
2+
3+
# The MIT License (MIT)
4+
#
5+
# Copyright (c) 2021 Scott Shawcroft for Adafruit Industries
6+
#
7+
# Permission is hereby granted, free of charge, to any person obtaining a copy
8+
# of this software and associated documentation files (the "Software"), to deal
9+
# in the Software without restriction, including without limitation the rights
10+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11+
# copies of the Software, and to permit persons to whom the Software is
12+
# furnished to do so, subject to the following conditions:
13+
#
14+
# The above copyright notice and this permission notice shall be included in
15+
# all copies or substantial portions of the Software.
16+
#
17+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23+
# THE SOFTWARE.
24+
25+
# This script builds the bundle
26+
27+
set -e
28+
29+
# Below way extracted comma-separated list of package folder prefixes automatically, but it's not working as expected
30+
# Also we know explicitly what package folder prefixes are used in the our libraries. Keeping this here in case we end up
31+
# using it in future.
32+
# P=$(
33+
# ls -RUx |
34+
# gawk -F '\n' '{ match($1, /(drivers|helpers)\/(.+)\/(.+)\:/, arr) ; if (length(arr[0]) > 0 && match(arr[3], arr[2]) > 0) printf "%s, ", arr[3] }' |
35+
# gawk '{ trimmed = substr($0, 1, length($0) - 2) ; print "\"" trimmed "\"" }'
36+
# )
37+
38+
circuitpython-build-bundles --filename_prefix qwiic-py --library_location qwiic/circuitpython --library_depth 2 --package_folder_prefix "Qwiic, qwiic, Pi"
Submodule Qwiic_SerLCD_Py added at 2c51fcb

requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
circuitpython-build-tools
2+
setuptools

setup.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@
9393

9494
# Specify the Python versions you support here. In particular, ensure
9595
# that you indicate whether you support Python 2, Python 3 or both.
96-
'Programming Language :: Python :: 2.7',
9796
'Programming Language :: Python :: 3.5',
9897
'Programming Language :: Python :: 3.6',
9998
'Programming Language :: Python :: 3.7',

update-submodules.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#! /bin/bash
2+
3+
# The MIT License (MIT)
4+
#
5+
# Copyright (c) 2016 Scott Shawcroft for Adafruit Industries
6+
#
7+
# Permission is hereby granted, free of charge, to any person obtaining a copy
8+
# of this software and associated documentation files (the "Software"), to deal
9+
# in the Software without restriction, including without limitation the rights
10+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11+
# copies of the Software, and to permit persons to whom the Software is
12+
# furnished to do so, subject to the following conditions:
13+
#
14+
# The above copyright notice and this permission notice shall be included in
15+
# all copies or substantial portions of the Software.
16+
#
17+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23+
# THE SOFTWARE.
24+
25+
# This script updates all submodules to the latest tag (hopefully release).
26+
git submodule update
27+
git submodule foreach git fetch
28+
git submodule foreach "tag=\$(git rev-list --tags --max-count=1); git checkout -q \$tag"

0 commit comments

Comments
 (0)