Skip to content

Commit 60a9c7e

Browse files
committed
move windows workflow to build ci and more
1 parent f4f95ad commit 60a9c7e

File tree

5 files changed

+118
-122
lines changed

5 files changed

+118
-122
lines changed

.github/workflows/build.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ 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 }}
2728
boards-atmel: ${{ steps.set-matrix.outputs.boards-atmel }}
@@ -218,6 +219,74 @@ jobs:
218219
[ -z "$TWINE_USERNAME" ] || echo "Uploading dev release to PyPi"
219220
[ -z "$TWINE_USERNAME" ] || twine upload circuitpython-stubs/dist/*
220221
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+
221290
aarch:
222291
needs: [scheduler, mpy-cross, tests]
223292
if: ${{ needs.scheduler.outputs.boards-aarch != '[]' }}

.github/workflows/ports_windows.yml

Lines changed: 0 additions & 111 deletions
This file was deleted.

tools/ci_changes_per_commit.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ def get_bad_check_runs(query_check_runs):
172172

173173
run_types = ["failed", "incomplete"]
174174

175-
regex_matrix = re.compile("^[^\n ]+ \/ (build|run) \([^\n ]+\)$")
175+
regex_matrix = re.compile(r"^\S+ \/ (build|run) \(\S+\)$")
176176

177177
while more_pages:
178178
check_runs = query_check_runs.fetch()["data"]["node"]

tools/ci_fetch_deps.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,14 +80,16 @@ def main():
8080
submodules = ["extmod/ulab", "lib/", "tools/"]
8181
elif TARGET == "build-doc":
8282
# used in .readthedocs.yml to generate RTD
83-
submodules = ["extmod/ulab", "frozen/"]
83+
submodules = ["extmod/ulab"]
84+
submodules_tags = ["frozen/"]
8485
elif TARGET == "mpy-cross" or TARGET == "mpy-cross-mac":
8586
submodules = ["tools/"] # for huffman
86-
elif TARGET == "windows":
87+
elif TARGET == "build-windows":
8788
# This builds one board from a number of ports so fill out a bunch of submodules
8889
submodules = ["extmod/ulab", "lib/", "tools/", "ports/", "data/nvm.toml"]
8990
elif TARGET == "website":
90-
submodules = ["tools/adabot/", "frozen/"]
91+
submodules = ["tools/adabot/"]
92+
submodules_tags = ["frozen/"]
9193
elif TARGET == "pre-commit":
9294
submodules = ["extmod/ulab"]
9395
else:

tools/ci_set_matrix.py

Lines changed: 43 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,24 @@
6262
# Files in these directories never influence board builds
6363
IGNORE_DIRS = ["tests", "docs", ".devcontainer"]
6464

65+
PATTERN_DOCS = (
66+
r"^(?:\.github|docs|extmod\/ulab)|"
67+
r"^(?:(?:ports\/\w+\/bindings|shared-bindings)\S+\.c|tools\/extract_pyi\.py|conf\.py|requirements-doc\.txt)$|"
68+
r"(?:-stubs|\.(?:md|MD|rst|RST))$"
69+
)
70+
71+
PATTERN_WINDOWS = [
72+
".github/",
73+
"extmod/",
74+
"lib/",
75+
"mpy-cross/",
76+
"ports/unix/",
77+
"ports/windows/",
78+
"py/",
79+
"requirements",
80+
"tools/",
81+
]
82+
6583
if len(sys.argv) > 1:
6684
print("Using files list on commandline")
6785
changed_files = sys.argv[1:]
@@ -240,21 +258,19 @@ def set_docs_to_build(build_doc: bool):
240258
if last_failed_jobs.get("build-doc"):
241259
build_doc = True
242260
else:
243-
doc_pattern = re.compile(
244-
r"^(?:\.github\/workflows\/|docs|extmod\/ulab|(?:(?:ports\/\w+\/bindings|shared-bindings)\S+\.c|conf\.py|tools\/extract_pyi\.py|requirements-doc\.txt)$)|(?:-stubs|\.(?:md|MD|rst|RST))$"
245-
)
261+
doc_pattern = re.compile(PATTERN_DOCS)
246262
github_workspace = os.environ.get("GITHUB_WORKSPACE") or ""
247263
github_workspace = github_workspace and github_workspace + "/"
248-
for p in changed_files:
249-
if doc_pattern.search(p) and (
264+
for file in changed_files:
265+
if doc_pattern.search(file) and (
250266
(
251267
subprocess.run(
252-
f"git diff -U0 $BASE_SHA...$HEAD_SHA {github_workspace + p} | grep -o -m 1 '^[+-]\/\/|'",
268+
f"git diff -U0 $BASE_SHA...$HEAD_SHA {github_workspace + file} | grep -o -m 1 '^[+-]\/\/|'",
253269
capture_output=True,
254270
shell=True,
255271
).stdout
256272
)
257-
if p.endswith(".c")
273+
if file.endswith(".c")
258274
else True
259275
):
260276
build_doc = True
@@ -265,6 +281,25 @@ def set_docs_to_build(build_doc: bool):
265281
set_output("build-doc", build_doc)
266282

267283

284+
def set_windows_to_build(build_windows):
285+
if not build_windows:
286+
if last_failed_jobs.get("build-windows"):
287+
build_windows = True
288+
else:
289+
for file in changed_files:
290+
for pattern in PATTERN_WINDOWS:
291+
if file.startswith(pattern):
292+
build_windows = True
293+
break
294+
else:
295+
continue
296+
break
297+
298+
# Set the step outputs
299+
print("Building windows:", build_windows)
300+
set_output("build-windows", build_windows)
301+
302+
268303
def check_changed_files():
269304
if not changed_files:
270305
print("Building all docs/boards")
@@ -277,6 +312,7 @@ def check_changed_files():
277312
def main():
278313
build_all = check_changed_files()
279314
set_docs_to_build(build_all)
315+
set_windows_to_build(build_all)
280316
set_boards_to_build(build_all)
281317

282318

0 commit comments

Comments
 (0)