1
- name : Build Firmware
1
+ name : ' Build Firmware'
2
2
3
3
on :
4
4
push :
5
- branches : [ master ]
5
+ branches : [ master, feature/dev-container ]
6
6
pull_request :
7
- branches : [ master ]
7
+ branches : [ master, feature/dev-container ]
8
8
workflow_dispatch :
9
9
10
10
jobs :
@@ -21,48 +21,71 @@ jobs:
21
21
run : |
22
22
docker build -t s2t-builder:latest -f .devcontainer/Dockerfile .devcontainer/
23
23
24
- - name : Configure CMake
24
+ - name : Build firmware in container
25
25
run : |
26
- docker run --rm \
26
+ # Create container with source mounted
27
+ docker run -d --name s2t-build \
27
28
-v ${{ github.workspace }}:/workspaces/Speech2Touch \
28
29
-w /workspaces/Speech2Touch \
29
30
s2t-builder:latest \
30
- /usr/bin/cmake \
31
- -DCMAKE_BUILD_TYPE=Release \
32
- -DCMAKE_TOOLCHAIN_FILE=/workspaces/Speech2Touch/cmake/gcc-arm-none-eabi.cmake \
33
- -S /workspaces/Speech2Touch \
34
- -B /workspaces/Speech2Touch/build/Release \
35
- -G Ninja
31
+ tail -f /dev/null
32
+
33
+ # Configure CMake
34
+ docker exec s2t-build /usr/bin/cmake \
35
+ -DCMAKE_BUILD_TYPE=Release \
36
+ -DCMAKE_TOOLCHAIN_FILE=/workspaces/Speech2Touch/cmake/gcc-arm-none-eabi.cmake \
37
+ -S /workspaces/Speech2Touch \
38
+ -B /workspaces/Speech2Touch/build/Release \
39
+ -G Ninja
40
+
41
+ # Clean build
42
+ docker exec s2t-build /usr/bin/cmake \
43
+ --build /workspaces/Speech2Touch/build/Release --target clean --
44
+
45
+ # Build firmware
46
+ docker exec s2t-build /usr/bin/cmake \
47
+ --build /workspaces/Speech2Touch/build/Release --target all --
48
+
49
+ # List built files
50
+ docker exec s2t-build ls -la /workspaces/Speech2Touch/build/Release/
36
51
37
- - name : Clean build
52
+ - name : Copy artifacts from container
38
53
run : |
39
- docker run --rm \
40
- -v ${{ github.workspace }}:/workspaces/Speech2Touch \
41
- -w /workspaces/Speech2Touch \
42
- s2t-builder:latest \
43
- /usr/bin/cmake --build /workspaces/Speech2Touch/build/Release --target clean --
54
+ # Create build directory on host
55
+ mkdir -p ${{ github.workspace }}/build/Release
56
+
57
+ # Copy artifacts from container to host
58
+ docker cp s2t-build:/workspaces/Speech2Touch/build/Release/Speech2Touch.bin \
59
+ ${{ github.workspace }}/build/Release/Speech2Touch.bin
60
+ docker cp s2t-build:/workspaces/Speech2Touch/build/Release/Speech2Touch.elf \
61
+ ${{ github.workspace }}/build/Release/Speech2Touch.elf
62
+ docker cp s2t-build:/workspaces/Speech2Touch/build/Release/Speech2Touch.hex \
63
+ ${{ github.workspace }}/build/Release/Speech2Touch.hex
64
+ docker cp s2t-build:/workspaces/Speech2Touch/build/Release/Speech2Touch.map \
65
+ ${{ github.workspace }}/build/Release/Speech2Touch.map
66
+
67
+ # Stop and remove container
68
+ docker stop s2t-build
69
+ docker rm s2t-build
44
70
45
- - name : Build firmware
71
+ - name : Verify build artifacts
46
72
run : |
47
- docker run --rm \
48
- -v ${{ github.workspace }}:/workspaces/Speech2Touch \
49
- -w /workspaces/Speech2Touch \
50
- s2t-builder:latest \
51
- /usr/bin/cmake --build /workspaces/Speech2Touch/build/Release --target all --
73
+ echo "Build artifacts on host:"
74
+ ls -lah ${{ github.workspace }}/build/Release/
52
75
53
76
- name : Upload firmware artifact
54
77
uses : actions/upload-artifact@v4
55
78
with :
56
79
name : speech2touch-firmware-${{ github.sha }}
57
- path : build/Release/Speech2Touch.bin
80
+ path : ${{ github.workspace }}/ build/Release/Speech2Touch.bin
58
81
if-no-files-found : error
59
82
retention-days : 90
60
83
61
84
- name : Upload firmware artifact (latest)
62
- if : github.ref == 'refs/heads/main '
85
+ if : github.ref == 'refs/heads/master '
63
86
uses : actions/upload-artifact@v4
64
87
with :
65
88
name : speech2touch-firmware-latest
66
- path : build/Release/Speech2Touch.bin
89
+ path : ${{ github.workspace }}/ build/Release/Speech2Touch.bin
67
90
if-no-files-found : error
68
91
retention-days : 90
0 commit comments