Skip to content

Commit f9e97f5

Browse files
authored
Merge pull request #1 from rgrizzell/9.x
Update CircuitPython to 9.x
2 parents 7bc474f + 1316e15 commit f9e97f5

File tree

2 files changed

+127
-13
lines changed

2 files changed

+127
-13
lines changed

.github/workflows/docker-build.yml

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
---
2+
name: Docker Image
3+
4+
on:
5+
push:
6+
tags: [ '*.*.*' ]
7+
8+
env:
9+
REGISTRY_IMAGE: ghcr.io/rgrizzell/circuitpython
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
platform:
18+
- linux/amd64
19+
- linux/arm64
20+
steps:
21+
- name: Prepare
22+
run: |
23+
platform=${{ matrix.platform }}
24+
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
25+
26+
- name: Checkout
27+
uses: actions/checkout@v4
28+
29+
- name: Docker meta
30+
id: meta
31+
uses: docker/metadata-action@v5
32+
with:
33+
images: ${{ env.REGISTRY_IMAGE }}
34+
35+
- name: Set up QEMU
36+
uses: docker/setup-qemu-action@v3
37+
38+
- name: Set up Docker Buildx
39+
uses: docker/setup-buildx-action@v3
40+
41+
- name: Login to GitHub Container Registry
42+
uses: docker/login-action@v3
43+
with:
44+
registry: ghcr.io
45+
username: ${{ github.repository_owner }}
46+
password: ${{ secrets.GITHUB_TOKEN }}
47+
48+
- name: Build and push by digest
49+
id: build
50+
uses: docker/build-push-action@v5
51+
with:
52+
context: .
53+
platforms: ${{ matrix.platform }}
54+
labels: ${{ steps.meta.outputs.labels }}
55+
outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true
56+
57+
- name: Export digest
58+
run: |
59+
mkdir -p /tmp/digests
60+
digest="${{ steps.build.outputs.digest }}"
61+
touch "/tmp/digests/${digest#sha256:}"
62+
63+
- name: Upload digest
64+
uses: actions/upload-artifact@v4
65+
with:
66+
name: digests-${{ env.PLATFORM_PAIR }}
67+
path: /tmp/digests/*
68+
if-no-files-found: error
69+
retention-days: 1
70+
71+
merge:
72+
runs-on: ubuntu-latest
73+
needs:
74+
- build
75+
steps:
76+
- name: Download digests
77+
uses: actions/download-artifact@v4
78+
with:
79+
path: /tmp/digests
80+
pattern: digests-*
81+
merge-multiple: true
82+
83+
- name: Set up Docker Buildx
84+
uses: docker/setup-buildx-action@v3
85+
86+
- name: Docker meta
87+
id: meta
88+
uses: docker/metadata-action@v5
89+
with:
90+
images: ${{ env.REGISTRY_IMAGE }}
91+
92+
- name: Login to GitHub Container Registry
93+
uses: docker/login-action@v3
94+
with:
95+
registry: ghcr.io
96+
username: ${{ github.repository_owner }}
97+
password: ${{ secrets.GITHUB_TOKEN }}
98+
99+
- name: Create manifest list and push
100+
working-directory: /tmp/digests
101+
run: |
102+
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
103+
$(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *)
104+
105+
- name: Inspect image
106+
run: |
107+
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }}

Dockerfile

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,23 @@
1-
FROM debian:10-slim
2-
ARG VERSION=6.2.0
1+
FROM debian:12-slim as build
2+
ARG VERSION=9.0.5
33

4-
RUN apt update
5-
RUN DEBIAN_FRONTEND=noninteractive apt install -y build-essential pkg-config libffi-dev wget git gettext python3
6-
RUN git clone https://github.com/adafruit/circuitpython.git
4+
# Install system requirements
5+
RUN apt update \
6+
&& apt install -y build-essential cmake git git-lfs gettext libffi-dev pkg-config python3 python3-pip python3-venv uncrustify
7+
# Clone the CircuitPython project
8+
RUN git clone -b $VERSION https://github.com/adafruit/circuitpython.git
9+
# Setup build dependencies
710
WORKDIR /circuitpython
8-
RUN git checkout $VERSION
9-
RUN git submodule sync --quiet --recursive
10-
RUN git submodule update --init
11-
RUN make -C mpy-cross
12-
RUN cd ports/unix && make axtls && make micropython && make install
13-
RUN apt-get purge --auto-remove -y build-essential pkg-config libffi-dev wget git gettext python3
14-
RUN rm -rf /circuitpython
15-
WORKDIR /
11+
RUN python3 -m venv .venv
12+
ENV PATH="/circuitpython/.venv/bin:$PATH"
13+
RUN python3 -m pip install --upgrade -r requirements-dev.txt \
14+
&& python tools/ci_fetch_deps.py tests
15+
# Build the binaires
16+
RUN make -C mpy-cross \
17+
&& make -C ports/unix
18+
19+
# Create final runtime container
20+
FROM debian:12-slim
21+
COPY --from=build /circuitpython/mpy-cross/build/mpy-cross /usr/local/bin/mpy-cross
22+
COPY --from=build /circuitpython/ports/unix/build-standard/micropython /usr/local/bin/micropython
1623
CMD ["/usr/local/bin/micropython"]

0 commit comments

Comments
 (0)