This commit is contained in:
lukstep
2025-07-29 00:26:19 +02:00
parent 44f236e9cd
commit 6417e81cd0

View File

@@ -1,4 +1,5 @@
name: Raspberry PI Pico Docker SDK CI
name: Build, test and push Docker image
on: on:
push: push:
@@ -14,39 +15,64 @@ env:
TEST_TAG: pico_test_sdk TEST_TAG: pico_test_sdk
jobs: jobs:
sdk_container: build-and-test:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: Checkout code
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: Set up QEMU
- name: Set up QEMU (for ARM builds)
uses: docker/setup-qemu-action@v3 uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3 uses: docker/setup-buildx-action@v3
- name: Build SDK
uses: docker/build-push-action@v6
with:
context: .
load: true
tags: ${{ env.TEST_TAG }}
- name: Test SDK
run: bash ./test_sdk.sh ${{ env.TEST_TAG }}
- name: Login to DockerHub - name: Login to DockerHub
uses: docker/login-action@v3 uses: docker/login-action@v3
with: with:
username: ${{ github.actor }} username: ${{ github.actor }}
password: ${{ secrets.DOCKER_HUB_TOKEN }} password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Extract SDK metadata
id: meta - name: Build Docker image (multi-arch, no push)
uses: docker/metadata-action@v4 uses: docker/build-push-action@v6
id: build
with: with:
images: lukstep/raspberry-pi-pico-sdk context: .
- name: Push SDK image platforms: linux/amd64
if: github.event_name == 'release' && github.event.action == 'published' push: false
load: true # Allows testing the image locally
tags: ${{ env.TEST_TAG }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Run Tests (from built image)
run: bash ./test_sdk.sh ${{ env.TEST_TAG }}
push-image:
needs: build-and-test
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ github.actor }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Build and Push Docker image (multi-arch)
uses: docker/build-push-action@v6 uses: docker/build-push-action@v6
with: with:
context: . context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64 platforms: linux/amd64,linux/arm64
push: true
tags: lukstep/raspberry-pi-pico-sdk:latest
cache-from: type=gha
cache-to: type=gha,mode=max