Skip to content

Commit 7e80a22

Browse files
committed
micropython: Add MicroPython build container.
Signed-off-by: Anson Mansfield <[email protected]>
1 parent f0e3576 commit 7e80a22

File tree

3 files changed

+59
-0
lines changed

3 files changed

+59
-0
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ jobs:
2424
- rust-linux
2525
- vast
2626
- mads
27+
- micropython
2728
- nix
2829
- bloaty
2930
- lfortran

Dockerfile.micropython

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
FROM ubuntu:20.04
2+
3+
ARG DEBIAN_FRONTEND=noninteractive
4+
RUN apt-get update -y -q && apt-get upgrade -y -q && apt-get update -y -q && \
5+
apt-get install -y -q \
6+
python3 \
7+
build-essential \
8+
libreadline-dev \
9+
libffi-dev \
10+
git \
11+
pkg-config \
12+
gcc-arm-none-eabi \
13+
libnewlib-arm-none-eabi
14+
15+
RUN mkdir -p /root
16+
COPY micropython /root/
17+
COPY common.sh /root/
18+
19+
WORKDIR /root

micropython/build.sh

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/bin/bash
2+
3+
set -ex
4+
source common.sh
5+
6+
VERSION=$1
7+
8+
URL=https://github.com/micropython/micropython.git
9+
REPO=micropython
10+
FULLNAME=micropython-${VERSION}.tar.xz
11+
OUTPUT=$2/${FULLNAME}
12+
13+
REVISION="micropython-${VERSION}"
14+
LAST_REVISION="${3:-}"
15+
16+
DEST="/opt/compiler-explorer/${REVISION}"
17+
18+
initialise "${REVISION}" "${OUTPUT}" "${LAST_REVISION}"
19+
20+
if [[ $VERSION == 'preview' ]]; then
21+
git clone --depth 1 "${URL}" "${REPO}"
22+
else
23+
git clone --depth 1 "${URL}" -b "v${VERSION}" "${REPO}"
24+
fi;
25+
26+
(
27+
cd "${REPO}"
28+
set +u
29+
source tools/ci.sh
30+
ci_unix_standard_build
31+
)
32+
33+
mkdir -p "${DEST}" "${DEST}/bin" "${DEST}/tools" "${DEST}/py"
34+
cp "${REPO}/mpy-cross/build/mpy-cross" "${DEST}/bin/mpy-cross"
35+
cp "${REPO}/ports/unix/build-standard/micropython" "${DEST}/bin/micropython"
36+
cp "${REPO}/tools/mpy-tool.py" "${DEST}/tools/mpy-tool.py"
37+
cp "${REPO}/py/makeqstrdata.py" "${DEST}/py/makeqstrdata.py"
38+
39+
complete "${DEST}" "${FULLNAME}" "${OUTPUT}"

0 commit comments

Comments
 (0)