Skip to content

Commit 3759363

Browse files
Try better docker behavior
1 parent 72dddc0 commit 3759363

5 files changed

Lines changed: 265 additions & 518 deletions

File tree

.github/workflows/builds.yml

Lines changed: 0 additions & 253 deletions
Original file line numberDiff line numberDiff line change
@@ -330,256 +330,3 @@ jobs:
330330
else
331331
./build.sh clean-all || true
332332
fi
333-
334-
docker-build-x64:
335-
name: Build (docker-linux-x64)
336-
runs-on: ubuntu-latest
337-
if: github.event_name == 'pull_request'
338-
339-
steps:
340-
- name: Checkout (with submodules)
341-
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
342-
with:
343-
submodules: recursive
344-
fetch-depth: 0
345-
346-
- name: Check if Dockerfile.base changed
347-
id: base_changed
348-
shell: bash
349-
run: |
350-
set -euo pipefail
351-
if git diff --name-only "origin/${{ github.base_ref }}...HEAD" | grep -q '^docker/Dockerfile\.base$'; then
352-
echo "changed=true" >> "$GITHUB_OUTPUT"
353-
else
354-
echo "changed=false" >> "$GITHUB_OUTPUT"
355-
fi
356-
357-
- name: Free disk space
358-
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # v1.3.1
359-
with:
360-
tool-cache: false
361-
android: true
362-
dotnet: true
363-
haskell: true
364-
large-packages: true
365-
docker-images: true
366-
swap-storage: true
367-
368-
- name: Pull base image from GHCR
369-
if: steps.base_changed.outputs.changed == 'false'
370-
shell: bash
371-
env:
372-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
373-
run: |
374-
set -euxo pipefail
375-
owner="$(echo "${GITHUB_REPOSITORY_OWNER}" | tr '[:upper:]' '[:lower:]')"
376-
echo "${GITHUB_TOKEN}" | docker login ghcr.io -u "${{ github.actor }}" --password-stdin
377-
docker pull "ghcr.io/${owner}/client-sdk-cpp-base:base-main-amd64"
378-
docker tag "ghcr.io/${owner}/client-sdk-cpp-base:base-main-amd64" \
379-
"livekit-cpp-sdk-base-x64:${{ github.sha }}"
380-
381-
- name: Build base Docker image
382-
if: steps.base_changed.outputs.changed == 'true'
383-
run: |
384-
docker build \
385-
--build-arg TARGETARCH=amd64 \
386-
-t livekit-cpp-sdk-base-x64:${{ github.sha }} \
387-
-f docker/Dockerfile.base \
388-
docker
389-
390-
- name: Build SDK Docker image
391-
run: |
392-
docker build \
393-
--build-arg BASE_IMAGE=livekit-cpp-sdk-base-x64:${{ github.sha }} \
394-
-t livekit-cpp-sdk-x64:${{ github.sha }} \
395-
. \
396-
-f docker/Dockerfile.sdk
397-
398-
- name: Verify installed SDK inside image
399-
run: |
400-
docker run --rm livekit-cpp-sdk-x64:${{ github.sha }} bash -c \
401-
'test -f /opt/livekit-sdk/lib/cmake/LiveKit/LiveKitConfig.cmake'
402-
403-
- name: Save Docker image artifact
404-
run: |
405-
docker save livekit-cpp-sdk-x64:${{ github.sha }} | gzip > livekit-cpp-sdk-x64-docker.tar.gz
406-
407-
- name: Upload Docker image artifact
408-
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
409-
with:
410-
name: livekit-cpp-sdk-docker-x64
411-
path: livekit-cpp-sdk-x64-docker.tar.gz
412-
retention-days: 7
413-
414-
docker-build-linux-arm64:
415-
name: Build (docker-linux-arm64)
416-
runs-on: ubuntu-24.04-arm
417-
if: github.event_name == 'pull_request'
418-
419-
steps:
420-
- name: Checkout (with submodules)
421-
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
422-
with:
423-
submodules: recursive
424-
fetch-depth: 0
425-
426-
- name: Check if Dockerfile.base changed
427-
id: base_changed
428-
shell: bash
429-
run: |
430-
set -euo pipefail
431-
if git diff --name-only "origin/${{ github.base_ref }}...HEAD" | grep -q '^docker/Dockerfile\.base$'; then
432-
echo "changed=true" >> "$GITHUB_OUTPUT"
433-
else
434-
echo "changed=false" >> "$GITHUB_OUTPUT"
435-
fi
436-
437-
- name: Free disk space
438-
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # v1.3.1
439-
with:
440-
tool-cache: false
441-
android: true
442-
dotnet: true
443-
haskell: true
444-
large-packages: true
445-
docker-images: true
446-
swap-storage: true
447-
448-
- name: Pull base image from GHCR
449-
if: steps.base_changed.outputs.changed == 'false'
450-
shell: bash
451-
env:
452-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
453-
run: |
454-
set -euxo pipefail
455-
owner="$(echo "${GITHUB_REPOSITORY_OWNER}" | tr '[:upper:]' '[:lower:]')"
456-
echo "${GITHUB_TOKEN}" | docker login ghcr.io -u "${{ github.actor }}" --password-stdin
457-
docker pull "ghcr.io/${owner}/client-sdk-cpp-base:base-main-arm64"
458-
docker tag "ghcr.io/${owner}/client-sdk-cpp-base:base-main-arm64" \
459-
"livekit-cpp-sdk-base-arm64:${{ github.sha }}"
460-
461-
- name: Build base Docker image
462-
if: steps.base_changed.outputs.changed == 'true'
463-
run: |
464-
docker build \
465-
--build-arg TARGETARCH=arm64 \
466-
-t livekit-cpp-sdk-base-arm64:${{ github.sha }} \
467-
-f docker/Dockerfile.base \
468-
docker
469-
470-
- name: Build SDK Docker image
471-
run: |
472-
docker build \
473-
--build-arg BASE_IMAGE=livekit-cpp-sdk-base-arm64:${{ github.sha }} \
474-
-t livekit-cpp-sdk:${{ github.sha }} \
475-
. \
476-
-f docker/Dockerfile.sdk
477-
478-
- name: Verify installed SDK inside image
479-
run: |
480-
docker run --rm livekit-cpp-sdk:${{ github.sha }} bash -c \
481-
'test -f /opt/livekit-sdk/lib/cmake/LiveKit/LiveKitConfig.cmake'
482-
483-
- name: Save Docker image artifact
484-
run: |
485-
docker save livekit-cpp-sdk:${{ github.sha }} | gzip > livekit-cpp-sdk-arm64-docker.tar.gz
486-
487-
- name: Upload Docker image artifact
488-
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
489-
with:
490-
name: livekit-cpp-sdk-docker-arm64
491-
path: livekit-cpp-sdk-arm64-docker.tar.gz
492-
retention-days: 7
493-
494-
build-collections-linux-arm64:
495-
name: Build (cpp-example-collection-linux-arm64)
496-
runs-on: ubuntu-24.04-arm
497-
needs: docker-build-linux-arm64
498-
if: github.event_name == 'pull_request'
499-
500-
steps:
501-
- name: Checkout
502-
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
503-
with:
504-
fetch-depth: 1
505-
506-
# Reclaim ~30GB before loading the multi-GB SDK image and building the
507-
# example collection inside it. Mirrors the docker-build jobs; without it
508-
# the x64 collection build has hit "no space left on device".
509-
- name: Free disk space
510-
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # v1.3.1
511-
with:
512-
tool-cache: false
513-
android: true
514-
dotnet: true
515-
haskell: true
516-
large-packages: true
517-
docker-images: true
518-
swap-storage: true
519-
520-
- name: Download Docker image artifact
521-
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
522-
with:
523-
name: livekit-cpp-sdk-docker-arm64
524-
525-
- name: Load Docker image
526-
run: gzip -dc livekit-cpp-sdk-arm64-docker.tar.gz | docker load
527-
528-
- name: Build cpp-example-collection against installed SDK
529-
run: |
530-
cpp_ex_ref="$(git rev-parse HEAD:cpp-example-collection)"
531-
docker run -e CPP_EX_REF="${cpp_ex_ref}" --rm livekit-cpp-sdk:${{ github.sha }} bash -lc '
532-
set -euxo pipefail
533-
git clone https://github.com/livekit-examples/cpp-example-collection.git /tmp/cpp-example-collection
534-
cd /tmp/cpp-example-collection
535-
git fetch --depth 1 origin "$CPP_EX_REF"
536-
git checkout "$CPP_EX_REF"
537-
cmake -S . -B build -DLIVEKIT_LOCAL_SDK_DIR=/opt/livekit-sdk
538-
cmake --build build --parallel
539-
'
540-
build-collections-x64:
541-
name: Build (cpp-example-collection-x64)
542-
runs-on: ubuntu-latest
543-
needs: docker-build-x64
544-
if: github.event_name == 'pull_request'
545-
546-
steps:
547-
- name: Checkout
548-
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
549-
with:
550-
fetch-depth: 1
551-
552-
# Reclaim ~30GB before loading the multi-GB SDK image and building the
553-
# example collection inside it. The standard ubuntu-latest runner has hit
554-
# "no space left on device" here without this step.
555-
- name: Free disk space
556-
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # v1.3.1
557-
with:
558-
tool-cache: false
559-
android: true
560-
dotnet: true
561-
haskell: true
562-
large-packages: true
563-
docker-images: true
564-
swap-storage: true
565-
566-
- name: Download Docker image artifact
567-
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
568-
with:
569-
name: livekit-cpp-sdk-docker-x64
570-
571-
- name: Load Docker image
572-
run: gzip -dc livekit-cpp-sdk-x64-docker.tar.gz | docker load
573-
574-
- name: Build cpp-example-collection against installed SDK
575-
run: |
576-
cpp_ex_ref="$(git rev-parse HEAD:cpp-example-collection)"
577-
docker run -e CPP_EX_REF="${cpp_ex_ref}" --rm livekit-cpp-sdk-x64:${{ github.sha }} bash -lc '
578-
set -euxo pipefail
579-
git clone https://github.com/livekit-examples/cpp-example-collection.git /tmp/cpp-example-collection
580-
cd /tmp/cpp-example-collection
581-
git fetch --depth 1 origin "$CPP_EX_REF"
582-
git checkout "$CPP_EX_REF"
583-
cmake -S . -B build -DLIVEKIT_LOCAL_SDK_DIR=/opt/livekit-sdk
584-
cmake --build build --parallel
585-
'

.github/workflows/ci.yml

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ on:
1111
permissions:
1212
contents: read
1313
actions: read
14-
packages: read
14+
packages: write
1515

1616
jobs:
1717
# Compute once which path groups changed; every other job references these
@@ -23,6 +23,7 @@ jobs:
2323
runs-on: ubuntu-latest
2424
outputs:
2525
builds: ${{ steps.filter.outputs.builds }}
26+
docker: ${{ steps.filter.outputs.docker }}
2627
tests: ${{ steps.filter.outputs.tests }}
2728
docs: ${{ steps.filter.outputs.docs }}
2829
cpp_checks: ${{ steps.filter.outputs.cpp_checks }}
@@ -40,14 +41,23 @@ jobs:
4041
- cpp-example-collection/**
4142
- client-sdk-rust/**
4243
- cmake/**
43-
- docker/**
4444
- CMakeLists.txt
4545
- CMakePresets.json
4646
- build*
4747
- .build*
4848
- vcpkg.json
4949
- .github/workflows/ci.yml
5050
- .github/workflows/builds.yml
51+
docker:
52+
- docker/**
53+
- .dockerignore
54+
- CMakeLists.txt
55+
- CMakePresets.json
56+
- build*
57+
- .build*
58+
- cmake/**
59+
- .github/workflows/ci.yml
60+
- .github/workflows/docker-images.yml
5161
tests:
5262
- src/**
5363
- include/**
@@ -92,6 +102,13 @@ jobs:
92102
uses: ./.github/workflows/builds.yml
93103
secrets: inherit
94104

105+
docker-images:
106+
name: Docker Images
107+
needs: changes
108+
if: ${{ needs.changes.outputs.docker == 'true' || github.event_name == 'workflow_dispatch' }}
109+
uses: ./.github/workflows/docker-images.yml
110+
secrets: inherit
111+
95112
tests:
96113
name: Tests
97114
needs: changes
@@ -126,6 +143,7 @@ jobs:
126143
needs:
127144
- changes
128145
- builds
146+
- docker-images
129147
- tests
130148
- license-check
131149
- cpp-checks

0 commit comments

Comments
 (0)