Compare commits

...

15 Commits

Author SHA1 Message Date
cole
370eb151e2 removed unused file 2023-02-19 19:54:25 -08:00
cole
d0b93bd275 cleaning up 2023-02-19 19:30:50 -08:00
cole
f1f5ac01bd more striping 2023-02-19 19:26:51 -08:00
cole
8101f98860 why use docker inside 2023-02-19 19:17:23 -08:00
cole
3b4c00b1bb working on work flow 2023-02-19 19:06:31 -08:00
cole
4518983b36 workflow file 2023-02-19 19:00:25 -08:00
cole
d5106dd5e2 editing build script 2023-02-19 18:44:10 -08:00
cole
730a18437c editing build script 2023-02-19 18:39:49 -08:00
cole
1ae2de4315 working on work flow 2023-02-19 18:33:27 -08:00
cole
8bcaa7a235 working on work flow 2023-02-19 18:28:45 -08:00
cole
b2ae0d364a docker compose version bump 2023-02-19 18:21:20 -08:00
cole
51528cbb41 docker compose version bump 2023-02-19 18:17:31 -08:00
cole
db4030f49b working on work flow 2023-02-19 18:12:24 -08:00
cole
fb87de1d85 working on work flow 2023-02-19 18:11:07 -08:00
cole
f65f436273 made new docker file to build mpy files 2023-02-19 18:09:02 -08:00
8 changed files with 103 additions and 39 deletions

23
.github/workflows/build.yml vendored Normal file
View File

@ -0,0 +1,23 @@
name: build_mpy
on: [push]
jobs:
build:
runs-on: ubuntu-latest
name: Build
steps:
- name: Checkout
uses: actions/checkout@v3
- name: run build script
run: ./docker_mpy_build.sh
- name: look
run: ls -la compiled/
- name: Archive
uses: actions/upload-artifact@v3
with:
name: mpy
path: compiled

View File

@ -1,39 +1,20 @@
FROM python:3.9-slim-buster
ARG KMKPY_REF
ARG KMKPY_URL
ENV KMKPY_REF ${KMKPY_REF}
ENV KMKPY_URL ${KMKPY_URL}
RUN mkdir -p /app /dist
WORKDIR /app
RUN apt-get update && apt-get install -y build-essential curl gettext git git-lfs rsync wget zip lbzip2
RUN pip install pipenv
# Pull CircuitPython-designated ARM GCC to avoid mismatches/weird
# inconsistencies with upstream
RUN curl -L -o /tmp/gcc-arm.tar.bz2 https://adafruit-circuit-python.s3.amazonaws.com/gcc-arm-none-eabi-9-2019-q4-major-x86_64-linux.tar.bz2 && \
tar -C /usr --strip-components=1 -xaf /tmp/gcc-arm.tar.bz2 && \
rm -rf /tmp/gcc-arm.tar.bz2
# Get a local copy of KMKPython and its dependencies. We don't provide MPY
# builds for kmkpython anymore, so we can get away with being opinionated
# here.
RUN git init /opt/kmkpython && \
git -C /opt/kmkpython remote add origin ${KMKPY_URL} && \
git -C /opt/kmkpython fetch --depth 1 origin ${KMKPY_REF} && \
git -C /opt/kmkpython checkout FETCH_HEAD && \
git -C /opt/kmkpython submodule update --init --recursive
# Build the MPY compiler
RUN make -C /opt/kmkpython/mpy-cross
ENV PATH=/opt/kmkpython/mpy-cross:${PATH}
RUN mkdir -p /opt/kmkpython/frozen/kmk/kmk
COPY ./build_kmkpython_release.sh /app/
COPY ./kmk /opt/kmkpython/frozen/kmk/kmk
CMD /app/build_kmkpython_release.sh
FROM python:3.9-slim-buster
RUN mkdir -p /app /dist
WORKDIR /app
RUN apt-get update && apt-get install -y curl
RUN curl https://adafruit-circuit-python.s3.amazonaws.com/bin/mpy-cross/linux-amd64/mpy-cross.static-amd64-linux-8.0.0 --output mpy-cross-8
RUN curl https://adafruit-circuit-python.s3.amazonaws.com/bin/mpy-cross/linux-amd64/mpy-cross.static-amd64-linux-7.0.0 --output mpy-cross-7
RUN chmod +x mpy-cross-8
RUN chmod +x mpy-cross-7
COPY ./docker_mpy_build.sh /app/build.sh
# COPY ./kmk /app/kmk/
CMD ["bash", "build.sh"]

0
compiled/.gitkeep Normal file
View File

7
docker-compose.yml Normal file
View File

@ -0,0 +1,7 @@
version: '3.3'
services:
mpy_kmk:
build: .
volumes:
- ./kmk:/app/kmk
- ./.compiled:/app/compiled

14
docker_mpy_build.sh Executable file
View File

@ -0,0 +1,14 @@
#!/bin/sh
echo "building mpy"
echo $(ls compiled)
find kmk/ -name "*.py" -exec sh -c 'mkdir -p compiled/8/$(dirname {}) &&\
./mpy-cross-8 -O2 {} -o compiled/8/$(dirname {})/$(basename -s .py {}).mpy' \;
find kmk/ -name "*.py" -exec sh -c 'mkdir -p compiled/7/$(dirname {}) &&\
./mpy-cross-7 -O2 {} -o compiled/7/$(dirname {})/$(basename -s .py {}).mpy' \;
echo $(ls compiled)
echo "done building"

39
kmk_python_Dockerfile Normal file
View File

@ -0,0 +1,39 @@
FROM python:3.9-slim-buster
ARG KMKPY_REF
ARG KMKPY_URL
ENV KMKPY_REF ${KMKPY_REF}
ENV KMKPY_URL ${KMKPY_URL}
RUN mkdir -p /app /dist
WORKDIR /app
RUN apt-get update && apt-get install -y build-essential curl gettext git git-lfs rsync wget zip lbzip2
RUN pip install pipenv
# Pull CircuitPython-designated ARM GCC to avoid mismatches/weird
# inconsistencies with upstream
RUN curl -L -o /tmp/gcc-arm.tar.bz2 https://adafruit-circuit-python.s3.amazonaws.com/gcc-arm-none-eabi-9-2019-q4-major-x86_64-linux.tar.bz2 && \
tar -C /usr --strip-components=1 -xaf /tmp/gcc-arm.tar.bz2 && \
rm -rf /tmp/gcc-arm.tar.bz2
# Get a local copy of KMKPython and its dependencies. We don't provide MPY
# builds for kmkpython anymore, so we can get away with being opinionated
# here.
RUN git init /opt/kmkpython && \
git -C /opt/kmkpython remote add origin ${KMKPY_URL} && \
git -C /opt/kmkpython fetch --depth 1 origin ${KMKPY_REF} && \
git -C /opt/kmkpython checkout FETCH_HEAD && \
git -C /opt/kmkpython submodule update --init --recursive
# Build the MPY compiler
RUN make -C /opt/kmkpython/mpy-cross
ENV PATH=/opt/kmkpython/mpy-cross:${PATH}
RUN mkdir -p /opt/kmkpython/frozen/kmk/kmk
COPY ./build_kmkpython_release.sh /app/
COPY ./kmk /opt/kmkpython/frozen/kmk/kmk
CMD /app/build_kmkpython_release.sh

BIN
mpy-cross-7 Executable file

Binary file not shown.

BIN
mpy-cross-8 Executable file

Binary file not shown.