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:
push:
@@ -14,39 +15,64 @@ env:
TEST_TAG: pico_test_sdk
jobs:
sdk_container:
build-and-test:
runs-on: ubuntu-latest
steps:
- name: Checkout
- name: Checkout code
uses: actions/checkout@v3
- name: Set up QEMU
- name: Set up QEMU (for ARM builds)
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
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
uses: docker/login-action@v3
with:
username: ${{ github.actor }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Extract SDK metadata
id: meta
uses: docker/metadata-action@v4
- name: Build Docker image (multi-arch, no push)
uses: docker/build-push-action@v6
id: build
with:
images: lukstep/raspberry-pi-pico-sdk
- name: Push SDK image
if: github.event_name == 'release' && github.event.action == 'published'
context: .
platforms: linux/amd64
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
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64
push: true
tags: lukstep/raspberry-pi-pico-sdk:latest
cache-from: type=gha
cache-to: type=gha,mode=max