Skip to content

Commit f832386

Browse files
committed
Merge remote-tracking branch 'adafruit/main' into banglejs2
2 parents b79661d + 00a03c3 commit f832386

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+871
-369
lines changed

.github/actions/deps/external/action.yml

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ runs:
4545

4646
# arm
4747
- name: Get arm toolchain
48-
if: inputs.platform == 'aarch' || inputs.platform == 'arm' || inputs.platform == 'nrf'
48+
if: inputs.platform == 'aarch' || inputs.platform == 'arm'
4949
uses: carlosperate/arm-none-eabi-gcc-action@v1
5050
with:
5151
release: '10-2020-q4'
@@ -73,22 +73,6 @@ runs:
7373
echo >> $GITHUB_PATH "$PATH"
7474
shell: bash
7575

76-
# nrf
77-
- name: Get nrfutil 7+
78-
if: inputs.platform == 'nrf'
79-
run: |
80-
wget https://developer.nordicsemi.com/.pc-tools/nrfutil/x64-linux/nrfutil
81-
chmod +x nrfutil
82-
./nrfutil install nrf5sdk-tools
83-
mkdir -p $HOME/.local/bin
84-
mv nrfutil $HOME/.local/bin
85-
echo "$HOME/.local/bin" >> $GITHUB_PATH
86-
shell: bash
87-
- name: Print nrfutil version
88-
if: inputs.platform == 'nrf'
89-
run: nrfutil -V
90-
shell: bash
91-
9276
# riscv
9377
- name: Get riscv toolchain
9478
if: inputs.platform == 'riscv'

.github/actions/deps/ports/action.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Fetch port deps
2+
3+
inputs:
4+
board:
5+
required: true
6+
type: string
7+
8+
outputs:
9+
port:
10+
value: ${{ steps.board-to-port.outputs.port }}
11+
12+
runs:
13+
using: composite
14+
steps:
15+
- name: Board to port
16+
id: board-to-port
17+
run: |
18+
PORT=$(find ports/*/boards/ -type d -name ${{ inputs.board }} | sed 's/^ports\///g;s/\/boards.*//g')
19+
if [ -z $PORT ]; then (exit 1); else echo >> $GITHUB_OUTPUT "port=$PORT"; fi
20+
shell: bash
21+
22+
- name: Set up espressif port
23+
if: steps.board-to-port.outputs.port == 'espressif'
24+
uses: ./.github/actions/deps/ports/espressif
25+
26+
- name: Set up nrf port
27+
if: steps.board-to-port.outputs.port == 'nrf'
28+
uses: ./.github/actions/deps/ports/nrf
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Fetch nrf port deps
2+
3+
runs:
4+
using: composite
5+
steps:
6+
- name: Get nrfutil 7+
7+
run: |
8+
wget https://developer.nordicsemi.com/.pc-tools/nrfutil/x64-linux/nrfutil
9+
chmod +x nrfutil
10+
./nrfutil install nrf5sdk-tools
11+
mkdir -p $HOME/.local/bin
12+
mv nrfutil $HOME/.local/bin
13+
echo "$HOME/.local/bin" >> $GITHUB_PATH
14+
shell: bash
15+
- name: Print nrfutil version
16+
run: nrfutil -V
17+
shell: bash

.github/workflows/build-boards-custom.yml

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -51,20 +51,15 @@ jobs:
5151
if: inputs.debug || inputs.flags != ''
5252
run: |
5353
> custom-build && git add custom-build
54-
- name: Get port
55-
id: get-port
56-
run: |
57-
PORT=$(find ports/*/boards/ -type d -name ${{ inputs.board }} | sed 's/^ports\///g;s/\/boards.*//g')
58-
if [ -z $PORT ]; then (exit 1); else echo >> $GITHUB_OUTPUT "port=$PORT"; fi
59-
- name: Port to platform
60-
run: echo >> $GITHUB_ENV "PLATFORM=${{ env[format('PLATFORM_{0}', steps.get-port.outputs.port)] }}"
6154
- name: Set up python
6255
uses: actions/setup-python@v4
6356
with:
6457
python-version: 3.x
6558
- name: Set up port
66-
if: env.PLATFORM == 'esp'
67-
uses: ./.github/actions/deps/ports/espressif
59+
id: set-up-port
60+
uses: ./.github/actions/deps/ports
61+
with:
62+
board: ${{ inputs.board }}
6863
- name: Set up submodules
6964
id: set-up-submodules
7065
uses: ./.github/actions/deps/submodules
@@ -75,7 +70,7 @@ jobs:
7570
uses: ./.github/actions/deps/external
7671
with:
7772
action: cache
78-
platform: ${{ env.PLATFORM }}
73+
platform: ${{ env[format('PLATFORM_{0}', steps.set-up-port.outputs.port)] }}
7974
- name: Set up mpy-cross
8075
if: steps.set-up-submodules.outputs.frozen == 'True'
8176
uses: ./.github/actions/mpy_cross
@@ -96,9 +91,9 @@ jobs:
9691
mkfs.fat --version || true
9792
- name: Build board
9893
run: make -j2 ${{ inputs.flags }} BOARD=${{ inputs.board }} DEBUG=${{ inputs.debug && '1' || '0' }} TRANSLATION=${{ inputs.language }}
99-
working-directory: ports/${{ steps.get-port.outputs.port }}
94+
working-directory: ports/${{ steps.set-up-port.outputs.port }}
10095
- name: Upload artifact
10196
uses: actions/upload-artifact@v3
10297
with:
10398
name: ${{ inputs.board }}-${{ inputs.language }}-${{ inputs.version }}${{ inputs.flags != '' && '-custom' || '' }}${{ inputs.debug && '-debug' || '' }}
104-
path: ports/${{ steps.get-port.outputs.port }}/build-${{ inputs.board }}/firmware.*
99+
path: ports/${{ steps.set-up-port.outputs.port }}/build-${{ inputs.board }}/firmware.*

.github/workflows/build-boards.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,9 @@ jobs:
3838
with:
3939
python-version: 3.x
4040
- name: Set up port
41-
if: inputs.platform == 'esp'
42-
uses: ./.github/actions/deps/ports/espressif
41+
uses: ./.github/actions/deps/ports
42+
with:
43+
board: ${{ matrix.board }}
4344
- name: Set up submodules
4445
id: set-up-submodules
4546
uses: ./.github/actions/deps/submodules

.github/workflows/build.yml

Lines changed: 89 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ jobs:
2222
outputs:
2323
build-doc: ${{ steps.set-matrix.outputs.build-doc }}
2424
build-boards: ${{ steps.set-matrix.outputs.build-boards }}
25+
build-windows: ${{ steps.set-matrix.outputs.build-windows }}
2526
boards-aarch: ${{ steps.set-matrix.outputs.boards-aarch }}
2627
boards-arm: ${{ steps.set-matrix.outputs.boards-arm }}
28+
boards-atmel: ${{ steps.set-matrix.outputs.boards-atmel }}
2729
boards-esp: ${{ steps.set-matrix.outputs.boards-esp }}
28-
boards-nrf: ${{ steps.set-matrix.outputs.boards-nrf }}
2930
boards-riscv: ${{ steps.set-matrix.outputs.boards-riscv }}
30-
boards-rpi: ${{ steps.set-matrix.outputs.boards-rpi }}
3131
cp-version: ${{ steps.set-up-submodules.outputs.version }}
3232
steps:
3333
- name: Dump GitHub context
@@ -55,24 +55,23 @@ jobs:
5555
uses: ./.github/actions/deps/external
5656
with:
5757
action: cache
58-
# Disabled: Needs to be updated
59-
# - name: Get last commit with checks
60-
# id: get-last-commit-with-checks
61-
# if: github.event_name == 'pull_request'
62-
# working-directory: tools
63-
# run: python3 -u ci_changes_per_commit.py
64-
# env:
65-
# REPO: ${{ github.repository }}
66-
# PULL: ${{ github.event.number }}
67-
# GITHUB_TOKEN: ${{ github.token }}
68-
# EXCLUDE_COMMIT: ${{ github.event.after }}
6958
- name: Set up mpy-cross
7059
uses: ./.github/actions/mpy_cross
7160
with:
7261
download: false
62+
- name: Get last commit with checks
63+
id: get-last-commit-with-checks
64+
if: github.event_name == 'pull_request'
65+
working-directory: tools
66+
run: python3 -u ci_changes_per_commit.py
67+
env:
68+
REPO: ${{ github.repository }}
69+
PULL: ${{ github.event.number }}
70+
GITHUB_TOKEN: ${{ github.token }}
71+
EXCLUDE_COMMIT: ${{ github.event.pull_request.head.sha }}
7372
- name: Set head sha
7473
if: github.event_name == 'pull_request'
75-
run: echo "HEAD_SHA=$(git show -s --format=%s $GITHUB_SHA | grep -o -P "(?<=Merge ).*(?= into)")" >> $GITHUB_ENV
74+
run: echo "HEAD_SHA=${{ github.event.pull_request.head.sha }}" >> $GITHUB_ENV
7675
- name: Set base sha
7776
if: github.event_name == 'pull_request'
7877
run: |
@@ -220,6 +219,74 @@ jobs:
220219
[ -z "$TWINE_USERNAME" ] || echo "Uploading dev release to PyPi"
221220
[ -z "$TWINE_USERNAME" ] || twine upload circuitpython-stubs/dist/*
222221
222+
build-windows:
223+
runs-on: windows-2022
224+
needs: scheduler
225+
if: ${{ needs.scheduler.outputs.build-windows == 'True' }}
226+
env:
227+
CP_VERSION: ${{ needs.scheduler.outputs.cp-version }}
228+
defaults:
229+
run:
230+
# We define a custom shell script here, although `msys2.cmd` does neither exist nor is it available in the PATH yet
231+
shell: msys2 {0}
232+
steps:
233+
# We want to change the configuration of the git command that actions/checkout will be using
234+
# (since it is not possible to set autocrlf through the action yet, see actions/checkout#226).
235+
- run: git config --global core.autocrlf input
236+
shell: bash
237+
- name: Check python coding (cmd)
238+
run: python -c "import sys, locale; print(sys.getdefaultencoding(), locale.getpreferredencoding(False))"
239+
shell: cmd
240+
# We use a JS Action, which calls the system terminal or other custom terminals directly, if required
241+
- uses: msys2/setup-msys2@v2
242+
with:
243+
install: base-devel git wget unzip gcc python-pip
244+
# The goal of this was to test how things worked when the default file encoding (locale.getpreferedencoding())
245+
# was not UTF-8. However, msys2 python does use utf-8 as the preferred file encoding, and using actions/setup-python
246+
# python3.8 gave a broken build, so we're not really testing what we wanted to test.
247+
# However, commandline length limits are being tested so that does some good.
248+
- name: Check python coding (msys2)
249+
run: |
250+
locale -v
251+
which python; python --version
252+
python -c "import sys, locale; print(sys.getdefaultencoding(), locale.getpreferredencoding(False))"
253+
which python3; python3 --version
254+
python3 -c "import sys, locale; print(sys.getdefaultencoding(), locale.getpreferredencoding(False))"
255+
- name: Install dependencies
256+
run: |
257+
wget --no-verbose -O gcc-arm.zip https://developer.arm.com/-/media/Files/downloads/gnu-rm/10-2020q4/gcc-arm-none-eabi-10-2020-q4-major-win32.zip
258+
unzip -q -d /tmp gcc-arm.zip
259+
tar -C /tmp/gcc-arm-none-* -cf - . | tar -C /usr/local -xf -
260+
pip install wheel
261+
# requirements_dev.txt doesn't install on windows. (with msys2 python)
262+
# instead, pick a subset for what we want to do
263+
pip install cascadetoml jinja2 typer click intelhex
264+
# check that installed packages work....?
265+
which python; python --version; python -c "import cascadetoml"
266+
which python3; python3 --version; python3 -c "import cascadetoml"
267+
- name: Set up repository
268+
uses: actions/checkout@v3
269+
with:
270+
submodules: false
271+
fetch-depth: 1
272+
- name: Set up submodules
273+
uses: ./.github/actions/deps/submodules
274+
- name: build mpy-cross
275+
run: make -j2 -C mpy-cross
276+
- name: build rp2040
277+
run: make -j2 -C ports/raspberrypi BOARD=adafruit_feather_rp2040 TRANSLATION=de_DE
278+
- name: build samd21
279+
run: make -j2 -C ports/atmel-samd BOARD=feather_m0_express TRANSLATION=zh_Latn_pinyin
280+
- name: build samd51
281+
run: make -j2 -C ports/atmel-samd BOARD=feather_m4_express TRANSLATION=es
282+
- name: build nrf
283+
run: make -j2 -C ports/nrf BOARD=feather_nrf52840_express TRANSLATION=fr
284+
- name: build stm
285+
run: make -j2 -C ports/stm BOARD=feather_stm32f405_express TRANSLATION=pt_BR
286+
# I gave up trying to do esp builds on windows when I saw
287+
# ERROR: Platform MINGW64_NT-10.0-17763-x86_64 appears to be unsupported
288+
# https://github.com/espressif/esp-idf/issues/7062
289+
223290
aarch:
224291
needs: [scheduler, mpy-cross, tests]
225292
if: ${{ needs.scheduler.outputs.boards-aarch != '[]' }}
@@ -240,24 +307,24 @@ jobs:
240307
boards: ${{ needs.scheduler.outputs.boards-arm }}
241308
cp-version: ${{ needs.scheduler.outputs.cp-version }}
242309

243-
esp:
310+
atmel:
244311
needs: [scheduler, mpy-cross, tests]
245-
if: ${{ needs.scheduler.outputs.boards-esp != '[]' }}
312+
if: ${{ needs.scheduler.outputs.boards-atmel != '[]' }}
246313
uses: ./.github/workflows/build-boards.yml
247314
secrets: inherit
248315
with:
249-
platform: esp
250-
boards: ${{ needs.scheduler.outputs.boards-esp }}
316+
platform: arm
317+
boards: ${{ needs.scheduler.outputs.boards-atmel }}
251318
cp-version: ${{ needs.scheduler.outputs.cp-version }}
252319

253-
nrf:
320+
esp:
254321
needs: [scheduler, mpy-cross, tests]
255-
if: ${{ needs.scheduler.outputs.boards-nrf != '[]' }}
322+
if: ${{ needs.scheduler.outputs.boards-esp != '[]' }}
256323
uses: ./.github/workflows/build-boards.yml
257324
secrets: inherit
258325
with:
259-
platform: nrf
260-
boards: ${{ needs.scheduler.outputs.boards-nrf }}
326+
platform: esp
327+
boards: ${{ needs.scheduler.outputs.boards-esp }}
261328
cp-version: ${{ needs.scheduler.outputs.cp-version }}
262329

263330
riscv:
@@ -269,13 +336,3 @@ jobs:
269336
platform: riscv
270337
boards: ${{ needs.scheduler.outputs.boards-riscv }}
271338
cp-version: ${{ needs.scheduler.outputs.cp-version }}
272-
273-
rpi:
274-
needs: [scheduler, mpy-cross, tests]
275-
if: ${{ needs.scheduler.outputs.boards-rpi != '[]' }}
276-
uses: ./.github/workflows/build-boards.yml
277-
secrets: inherit
278-
with:
279-
platform: arm
280-
boards: ${{ needs.scheduler.outputs.boards-rpi }}
281-
cp-version: ${{ needs.scheduler.outputs.cp-version }}

0 commit comments

Comments
 (0)