Skip to content

Commit 27051e0

Browse files
committed
github: Add dependabot configuration and update workflows
- Added dependabot configuration for GitHub Actions and Docker. - Updated docker_manifest.yml to include ARM64 build job. - Modified on_pr.yml and on_push.yml to comment out unused platforms. - Updated Containerfile to define fork repository arguments. - Added LICENSE file with MIT License. - Created action.yml for Circuitpython Port Builder Composite Action. - Enhanced entrypoint.sh for better build and release handling. Signed-off-by: Chiho Sin <[email protected]>
1 parent a9d13be commit 27051e0

File tree

9 files changed

+452
-45
lines changed

9 files changed

+452
-45
lines changed

.github/dependabot.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: github-actions
4+
directory: /
5+
schedule:
6+
interval: daily
7+
- package-ecosystem: docker
8+
directory: /
9+
schedule:
10+
interval: daily

.github/workflows/docker_build.yml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: Build container
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
platform:
7+
description: Docker platform to target
8+
required: true
9+
type: string
10+
runs-on:
11+
description: Runner to use
12+
required: true
13+
type: string
14+
push:
15+
description: Push images to registry
16+
required: false
17+
type: boolean
18+
default: false
19+
cpy_platform:
20+
description: CircuitPython platform to target
21+
required: true
22+
type: string
23+
outputs:
24+
digest:
25+
description: Digest of built image
26+
value: ${{ jobs.docker-build.outputs.digest }}
27+
28+
env:
29+
REGISTRY: ghcr.io
30+
IMAGE_NAME: ${{ github.repository }}
31+
32+
permissions:
33+
contents: read
34+
packages: write
35+
id-token: write
36+
attestations: write
37+
38+
jobs:
39+
docker-build:
40+
name: build-${{ inputs.platform }}
41+
outputs:
42+
digest: ${{ steps.docker_platform.outputs.digest }}
43+
runs-on: ${{ inputs.runs-on }}
44+
steps:
45+
- uses: actions/checkout@v4
46+
47+
- uses: docker/setup-qemu-action@v3
48+
49+
- uses: docker/setup-buildx-action@v3
50+
51+
- name: Docker login
52+
if: ${{ inputs.push }}
53+
uses: docker/login-action@v3
54+
with:
55+
registry: ${{ env.REGISTRY }}
56+
username: ${{ github.actor }}
57+
password: ${{ secrets.GITHUB_TOKEN }}
58+
59+
- name: Sanitize platform string
60+
id: sanitize_platform
61+
# Replace slashes with underscores
62+
run: echo "cleaned_platform=${{ inputs.platform }}" | sed 's/\//_/g' >> $GITHUB_OUTPUT
63+
64+
- name: Docker tag
65+
id: meta
66+
uses: docker/metadata-action@v5
67+
with:
68+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
69+
tags: |
70+
GHA-main-${{ inputs.cpy_platform }}-${{ steps.sanitize_platform.outputs.cleaned_platform }}
71+
flavor: latest=false
72+
73+
- name: Docker build and push
74+
uses: docker/build-push-action@v6
75+
id: docker_platform
76+
with:
77+
context: .
78+
push: ${{ inputs.push }}
79+
tags: ${{ steps.meta.outputs.tags }}
80+
labels: ${{ steps.meta.outputs.labels }}
81+
platforms: ${{ inputs.platform }}
82+
build-args: |
83+
BUILD_PLATFORM=${{ inputs.cpy_platform }}
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: Build container manifest
2+
on:
3+
workflow_call:
4+
inputs:
5+
cpy_platform:
6+
description: CircuitPython platform to target
7+
required: true
8+
type: string
9+
10+
env:
11+
REGISTRY: ghcr.io
12+
IMAGE_NAME: ${{ github.repository }}
13+
14+
permissions:
15+
contents: read
16+
packages: write
17+
id-token: write
18+
attestations: write
19+
20+
jobs:
21+
docker-amd64:
22+
uses: ./.github/workflows/docker_build.yml
23+
with:
24+
cpy_platform: ${{ inputs.cpy_platform }}
25+
platform: linux/amd64
26+
runs-on: ubuntu-24.04
27+
push: true
28+
secrets: inherit
29+
30+
docker-arm64:
31+
if: inputs.cpy_platform != 'litex'
32+
uses: ./.github/workflows/docker_build.yml
33+
with:
34+
cpy_platform: ${{ inputs.cpy_platform }}
35+
platform: linux/arm64
36+
runs-on: ubuntu-24.04-arm
37+
push: true
38+
secrets: inherit
39+
40+
docker-manifest:
41+
needs:
42+
- docker-amd64
43+
- docker-arm64
44+
runs-on: ubuntu-24.04
45+
steps:
46+
- uses: actions/checkout@v4
47+
48+
- name: Docker Login GHCR
49+
uses: docker/login-action@v3
50+
with:
51+
registry: ${{ env.REGISTRY }}
52+
username: ${{ github.actor }}
53+
password: ${{ secrets.GITHUB_TOKEN }}
54+
55+
- name: Docker meta
56+
id: meta_docker
57+
uses: docker/metadata-action@v5
58+
with:
59+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
60+
tags: |
61+
main-${{ inputs.cpy_platform }}
62+
flavor: latest=false
63+
64+
- name: Create Docker manifest
65+
id: manifest_docker
66+
uses: int128/docker-manifest-create-action@v2
67+
with:
68+
tags: |
69+
${{ steps.meta_docker.outputs.tags }}
70+
push: true
71+
sources: |
72+
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@${{ needs.docker-amd64.outputs.digest }}
73+
${{ inputs.cpy_platform != 'litex' && env.REGISTRY }}/${{ inputs.cpy_platform != 'litex' && env.IMAGE_NAME }}@${{ inputs.cpy_platform != 'litex' && needs.docker-arm64.outputs.digest }}

.github/workflows/on_pr.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Build PR
2+
on:
3+
pull_request:
4+
5+
permissions:
6+
contents: read
7+
packages: write
8+
id-token: write
9+
attestations: write
10+
11+
jobs:
12+
docker-amd64:
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
cpy_platform:
17+
# - analog
18+
# - atmel-samd
19+
# - broadcom
20+
# - cxd56
21+
- espressif
22+
# - litex
23+
# - mimxrt10xx
24+
- nordic
25+
# - raspberrypi
26+
# - renode
27+
# - silabs
28+
# - stm
29+
# - zephyr-cp
30+
uses: ./.github/workflows/docker_build.yml
31+
with:
32+
cpy_platform: ${{ matrix.cpy_platform }}
33+
platform: linux/amd64
34+
runs-on: ubuntu-24.04
35+
push: false
36+
secrets: inherit

.github/workflows/on_push.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Build Release
2+
on:
3+
push:
4+
# build and push anytime commits are pushed/merged
5+
branches:
6+
- main
7+
schedule:
8+
# build and push weekly
9+
- cron: 0 5 * * 5
10+
workflow_dispatch: # allow manual triggering
11+
12+
permissions:
13+
contents: read
14+
packages: write
15+
id-token: write
16+
attestations: write
17+
18+
jobs:
19+
docker-platforms:
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
cpy_platform:
24+
# - analog
25+
# - atmel-samd
26+
# - broadcom
27+
# - cxd56
28+
- espressif
29+
# - litex
30+
# - mimxrt10xx
31+
- nordic
32+
# - raspberrypi
33+
# - renode
34+
# - silabs
35+
# - stm
36+
# - zephyr-cp
37+
uses: ./.github/workflows/docker_manifest.yml
38+
with:
39+
cpy_platform: ${{ matrix.cpy_platform }}
40+
secrets: inherit

0 commit comments

Comments
 (0)