|
1 |
| -name: Raspberry PI Pico Docker SDK CI |
| 1 | + |
| 2 | +name: Build, test and push Docker image |
2 | 3 |
|
3 | 4 | on:
|
4 | 5 | push:
|
|
14 | 15 | TEST_TAG: pico_test_sdk
|
15 | 16 |
|
16 | 17 | jobs:
|
17 |
| - sdk_container: |
| 18 | + build-and-test: |
18 | 19 | runs-on: ubuntu-latest
|
19 | 20 | steps:
|
20 |
| - - name: Checkout |
| 21 | + - name: Checkout code |
21 | 22 | uses: actions/checkout@v3
|
22 |
| - - name: Set up QEMU |
| 23 | + |
| 24 | + - name: Set up QEMU (for ARM builds) |
23 | 25 | uses: docker/setup-qemu-action@v3
|
| 26 | + |
24 | 27 | - name: Set up Docker Buildx
|
25 | 28 | uses: docker/setup-buildx-action@v3
|
26 |
| - - name: Build SDK |
| 29 | + |
| 30 | + - name: Login to DockerHub |
| 31 | + uses: docker/login-action@v3 |
| 32 | + with: |
| 33 | + username: ${{ github.actor }} |
| 34 | + password: ${{ secrets.DOCKER_HUB_TOKEN }} |
| 35 | + |
| 36 | + - name: Build Docker image (multi-arch, no push) |
27 | 37 | uses: docker/build-push-action@v6
|
| 38 | + id: build |
28 | 39 | with:
|
29 | 40 | context: .
|
30 |
| - load: true |
| 41 | + platforms: linux/amd64 |
| 42 | + push: false |
| 43 | + load: true # Allows testing the image locally |
31 | 44 | tags: ${{ env.TEST_TAG }}
|
32 |
| - - name: Test SDK |
| 45 | + cache-from: type=gha |
| 46 | + cache-to: type=gha,mode=max |
| 47 | + |
| 48 | + - name: Run Tests (from built image) |
33 | 49 | run: bash ./test_sdk.sh ${{ env.TEST_TAG }}
|
34 |
| - - name: Log into Docker Hub |
| 50 | + |
| 51 | + push-image: |
| 52 | + needs: build-and-test |
| 53 | + runs-on: ubuntu-latest |
| 54 | + steps: |
| 55 | + - name: Checkout code |
| 56 | + uses: actions/checkout@v3 |
| 57 | + |
| 58 | + - name: Set up QEMU |
| 59 | + uses: docker/setup-qemu-action@v3 |
| 60 | + |
| 61 | + - name: Set up Docker Buildx |
| 62 | + uses: docker/setup-buildx-action@v3 |
| 63 | + |
| 64 | + - name: Login to DockerHub |
35 | 65 | uses: docker/login-action@v3
|
36 | 66 | with:
|
37 | 67 | username: ${{ github.actor }}
|
38 | 68 | password: ${{ secrets.DOCKER_HUB_TOKEN }}
|
39 |
| - - name: Extract SDK metadata |
40 |
| - id: meta |
41 |
| - uses: docker/metadata-action@v4 |
42 |
| - with: |
43 |
| - images: lukstep/raspberry-pi-pico-sdk |
44 |
| - - name: Push SDK image |
45 |
| - if: github.event_name == 'release' && github.event.action == 'published' |
| 69 | + |
| 70 | + - name: Build and Push Docker image (multi-arch) |
46 | 71 | uses: docker/build-push-action@v6
|
47 | 72 | with:
|
48 | 73 | context: .
|
49 |
| - push: true |
50 |
| - tags: ${{ steps.meta.outputs.tags }} |
51 |
| - labels: ${{ steps.meta.outputs.labels }} |
52 | 74 | platforms: linux/amd64,linux/arm64
|
| 75 | + push: true |
| 76 | + tags: lukstep/raspberry-pi-pico-sdk:latest |
| 77 | + cache-from: type=gha |
| 78 | + cache-to: type=gha,mode=max |
0 commit comments