-
Notifications
You must be signed in to change notification settings - Fork 0
89 lines (80 loc) · 2.95 KB
/
docker-build.yml
File metadata and controls
89 lines (80 loc) · 2.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# ============================================================================
# docker-build.yml
# ============================================================================
# Copyright (c) 2025 Michael Gardner, A Bit of Help, Inc.
# SPDX-License-Identifier: BSD-3-Clause
# See LICENSE file in the project root.
# ============================================================================
name: Docker Build
on:
pull_request:
branches: [ main ]
push:
branches: [ main ]
jobs:
docker-build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- name: "upstream"
dockerfile: "Dockerfile"
image_name: "dev-container-cpp"
platforms: "linux/amd64,linux/arm64"
- name: "system"
dockerfile: "Dockerfile.system"
image_name: "dev-container-cpp-system"
platforms: "linux/amd64,linux/arm64"
steps:
- name: Check out repository
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- name: Set up QEMU
uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3.2.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0
- name: Build image (${{ matrix.name }}, ${{ matrix.platforms }})
run: |
docker buildx build \
--platform ${{ matrix.platforms }} \
-f ${{ matrix.dockerfile }} \
-t ${{ matrix.image_name }}:ci .
- name: Load amd64 image for smoke test
run: |
docker buildx build \
--platform linux/amd64 \
--load \
-f ${{ matrix.dockerfile }} \
-t ${{ matrix.image_name }}:ci .
- name: Smoke test
run: |
docker run --rm \
-e HOST_UID=$(id -u) \
-e HOST_GID=$(id -g) \
-e HOST_USER=$(whoami) \
-v "${{ github.workspace }}":/workspace \
-w /workspace/examples/hello_cpp \
${{ matrix.image_name }}:ci \
bash -c '
set -e
echo "=== Environment ==="
echo "USER=$(whoami) UID=$(id -u) GID=$(id -g) HOME=$HOME"
echo "DISPLAY_USER=$DISPLAY_USER"
echo "CONTAINER_RUNTIME=$CONTAINER_RUNTIME"
echo ""
echo "=== Compile test (CMake + Ninja) ==="
cmake -B build -G Ninja -DCMAKE_CXX_STANDARD=20
cmake --build build
echo ""
echo "=== Run test ==="
./build/hello_cpp
echo ""
echo "=== Toolchain versions ==="
gcc --version | head -1
g++ --version | head -1
clang --version | head -1
cmake --version | head -1
ninja --version
arm-none-eabi-gcc --version | head -1
echo "=== Smoke test passed ==="
'