Skip to content

Commit 27229be

Browse files
authored
Merge pull request #286 from jepler/ci-macos
Fix macos build (mp & cp), add mac builds to ci
2 parents d62d07e + cbe3e4c commit 27229be

File tree

4 files changed

+107
-40
lines changed

4 files changed

+107
-40
lines changed

.github/workflows/build.yml

Lines changed: 20 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,12 @@ on:
1414

1515
jobs:
1616
micropython:
17-
runs-on: ubuntu-16.04
17+
strategy:
18+
matrix:
19+
os:
20+
- ubuntu-16.04
21+
- macos-10.14
22+
runs-on: ${{ matrix.os }}
1823
steps:
1924
- name: Dump GitHub context
2025
env:
@@ -38,30 +43,16 @@ jobs:
3843
repository: micropython/micropython
3944
path: micropython
4045

41-
- name: Checkout micropython submodules
42-
run: (cd micropython && git submodule update --init)
43-
44-
- name: Build mpy-cross
45-
run: make -C micropython/mpy-cross -j2
46-
47-
- name: Build micropython unix port
48-
run: |
49-
make -C micropython/ports/unix -j2 deplibs
50-
make -C micropython/ports/unix -j2 USER_C_MODULES=$(readlink -f .)
51-
52-
- name: Run tests
53-
run: env MICROPYTHON_CPYTHON3=python3.5 MICROPY_MICROPYTHON=micropython/ports/unix/micropython micropython/tests/run-tests -d tests
54-
- name: Print failure info
55-
run: |
56-
for exp in *.exp;
57-
do testbase=$(basename $exp .exp);
58-
echo -e "\nFAILURE $testbase";
59-
diff -u $testbase.exp $testbase.out;
60-
done
61-
if: failure()
46+
- name: Run build.sh
47+
run: ./build.sh
6248

6349
circuitpython:
64-
runs-on: ubuntu-16.04
50+
strategy:
51+
matrix:
52+
os:
53+
- ubuntu-16.04
54+
- macos-10.14
55+
runs-on: ${{ matrix.os }}
6556
steps:
6657
- name: Dump GitHub context
6758
env:
@@ -82,8 +73,12 @@ jobs:
8273

8374
- name: Install requirements
8475
run: |
85-
sudo apt install librsvg2-bin gettext
86-
pip install "Sphinx<4" sphinx-rtd-theme recommonmark sphinx-autoapi sphinxcontrib-svg2pdfconverter astroid isort polib black
76+
if type -path apt-get; then
77+
sudo apt-get install gettext
78+
else
79+
brew install gettext
80+
echo >>$GITHUB_PATH /usr/local/opt/gettext/bin
81+
fi
8782
8883
- name: Run build-cp.sh
8984
run: ./build-cp.sh

build-cp.sh

Lines changed: 43 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,49 @@
11
#!/bin/sh
22
set -e
3-
nproc=$(python -c 'import multiprocessing; print(multiprocessing.cpu_count())')
4-
HERE="$(dirname -- "$(readlink -f -- "${0}")" )"
5-
[ -e circuitpython/py/py.mk ] || (git clone --depth 100 --branch 6.0.x https://github.com/adafruit/circuitpython && cd circuitpython && git submodule update --init)
3+
# POSIX compliant version
4+
readlinkf_posix() {
5+
[ "${1:-}" ] || return 1
6+
max_symlinks=40
7+
CDPATH='' # to avoid changing to an unexpected directory
8+
9+
target=$1
10+
[ -e "${target%/}" ] || target=${1%"${1##*[!/]}"} # trim trailing slashes
11+
[ -d "${target:-/}" ] && target="$target/"
12+
13+
cd -P . 2>/dev/null || return 1
14+
while [ "$max_symlinks" -ge 0 ] && max_symlinks=$((max_symlinks - 1)); do
15+
if [ ! "$target" = "${target%/*}" ]; then
16+
case $target in
17+
/*) cd -P "${target%/*}/" 2>/dev/null || break ;;
18+
*) cd -P "./${target%/*}" 2>/dev/null || break ;;
19+
esac
20+
target=${target##*/}
21+
fi
22+
23+
if [ ! -L "$target" ]; then
24+
target="${PWD%/}${target:+/}${target}"
25+
printf '%s\n' "${target:-/}"
26+
return 0
27+
fi
28+
29+
# `ls -dl` format: "%s %u %s %s %u %s %s -> %s\n",
30+
# <file mode>, <number of links>, <owner name>, <group name>,
31+
# <size>, <date and time>, <pathname of link>, <contents of link>
32+
# https://pubs.opengroup.org/onlinepubs/9699919799/utilities/ls.html
33+
link=$(ls -dl -- "$target" 2>/dev/null) || break
34+
target=${link#*" $target -> "}
35+
done
36+
return 1
37+
}
38+
NPROC=$(python -c 'import multiprocessing; print(multiprocessing.cpu_count())')
39+
HERE="$(dirname -- "$(readlinkf_posix -- "${0}")" )"
40+
[ -e circuitpython/py/py.mk ] || (git clone --no-recurse-submodules --depth 100 --branch 6.0.x https://github.com/adafruit/circuitpython && cd circuitpython && git submodule update --init lib/uzlib tools)
641
rm -rf circuitpython/extmod/ulab; ln -s "$HERE" circuitpython/extmod/ulab
7-
make -C circuitpython/mpy-cross -j$nproc
8-
make -C circuitpython/ports/unix -j$nproc deplibs
9-
make -C circuitpython/ports/unix -j$nproc
42+
make -C circuitpython/mpy-cross -j$NPROC
43+
sed -e '/MICROPY_PY_UHASHLIB/s/1/0/' < circuitpython/ports/unix/mpconfigport.h > circuitpython/ports/unix/mpconfigport_ulab.h
44+
# Work around circuitpython#3990
45+
make -C circuitpython/ports/unix -j$NPROC DEBUG=1 MICROPY_PY_FFI=0 MICROPY_PY_BTREE=0 MICROPY_SSL_AXTLS=0 MICROPY_PY_USSL=0 CFLAGS_EXTRA='-DMP_CONFIGFILE="<mpconfigport_ulab.h>" -Wno-tautological-constant-out-of-range-compare' build/genhdr/qstrdefs.generated.h
46+
make -k -C circuitpython/ports/unix -j$NPROC DEBUG=1 MICROPY_PY_FFI=0 MICROPY_PY_BTREE=0 MICROPY_SSL_AXTLS=0 MICROPY_PY_USSL=0 CFLAGS_EXTRA='-DMP_CONFIGFILE="<mpconfigport_ulab.h>" -Wno-tautological-constant-out-of-range-compare'
1047

1148
for dir in "circuitpy" "common"
1249
do

build.sh

Lines changed: 42 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,47 @@
11
#!/bin/sh
2+
# POSIX compliant version
3+
readlinkf_posix() {
4+
[ "${1:-}" ] || return 1
5+
max_symlinks=40
6+
CDPATH='' # to avoid changing to an unexpected directory
7+
8+
target=$1
9+
[ -e "${target%/}" ] || target=${1%"${1##*[!/]}"} # trim trailing slashes
10+
[ -d "${target:-/}" ] && target="$target/"
11+
12+
cd -P . 2>/dev/null || return 1
13+
while [ "$max_symlinks" -ge 0 ] && max_symlinks=$((max_symlinks - 1)); do
14+
if [ ! "$target" = "${target%/*}" ]; then
15+
case $target in
16+
/*) cd -P "${target%/*}/" 2>/dev/null || break ;;
17+
*) cd -P "./${target%/*}" 2>/dev/null || break ;;
18+
esac
19+
target=${target##*/}
20+
fi
21+
22+
if [ ! -L "$target" ]; then
23+
target="${PWD%/}${target:+/}${target}"
24+
printf '%s\n' "${target:-/}"
25+
return 0
26+
fi
27+
28+
# `ls -dl` format: "%s %u %s %s %u %s %s -> %s\n",
29+
# <file mode>, <number of links>, <owner name>, <group name>,
30+
# <size>, <date and time>, <pathname of link>, <contents of link>
31+
# https://pubs.opengroup.org/onlinepubs/9699919799/utilities/ls.html
32+
link=$(ls -dl -- "$target" 2>/dev/null) || break
33+
target=${link#*" $target -> "}
34+
done
35+
return 1
36+
}
37+
NPROC=`python3 -c 'import multiprocessing; print(multiprocessing.cpu_count())'`
238
set -e
3-
HERE="$(dirname -- "$(readlink -f -- "${0}")" )"
4-
[ -e micropython/py/py.mk ] || git clone https://github.com/micropython/micropython
5-
[ -e micropython/lib/libffi/autogen.sh ] || (cd micropython && git submodule update --init lib/libffi )
6-
#git clone https://github.com/micropython/micropython
7-
make -C micropython/mpy-cross -j$(nproc)
8-
make -C micropython/ports/unix -j$(nproc) deplibs
9-
make -C micropython/ports/unix -j$(nproc) USER_C_MODULES="${HERE}" DEBUG=1 STRIP=:
39+
HERE="$(dirname -- "$(readlinkf_posix -- "${0}")" )"
40+
[ -e micropython/py/py.mk ] || git clone --no-recurse-submodules https://github.com/micropython/micropython
41+
[ -e micropython/lib/axtls/README ] || (cd micropython && git submodule update --init lib/axtls )
42+
make -C micropython/mpy-cross -j${NPROC}
43+
make -C micropython/ports/unix -j${NPROC} axtls
44+
make -C micropython/ports/unix -j${NPROC} USER_C_MODULES="${HERE}" DEBUG=1 STRIP=: MICROPY_PY_FFI=0 MICROPY_PY_BTREE=0
1045

1146

1247
for dir in "numpy" "common"

code/ulab.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,11 @@ mp_obj_float_t ulab_const_float_pi_obj = {{&mp_type_float}, MP_PI};
4949
#endif
5050

5151
#if ULAB_HAS_INF
52-
mp_obj_float_t ulab_const_float_inf_obj = {{&mp_type_float}, INFINITY};
52+
mp_obj_float_t ulab_const_float_inf_obj = {{&mp_type_float}, (mp_float_t)INFINITY};
5353
#endif
5454

5555
#if ULAB_HAS_NAN
56-
mp_obj_float_t ulab_const_float_nan_obj = {{&mp_type_float}, NAN};
56+
mp_obj_float_t ulab_const_float_nan_obj = {{&mp_type_float}, (mp_float_t)NAN};
5757
#endif
5858

5959
STATIC const mp_rom_map_elem_t ulab_ndarray_locals_dict_table[] = {

0 commit comments

Comments
 (0)