1- name : Build Firmware
1+ name : ' Build Firmware'
22
33on :
44 push :
5- branches : [ master ]
5+ branches : [ master, feature/dev-container ]
66 pull_request :
7- branches : [ master ]
7+ branches : [ master, feature/dev-container ]
88 workflow_dispatch :
99
1010jobs :
@@ -21,48 +21,71 @@ jobs:
2121 run : |
2222 docker build -t s2t-builder:latest -f .devcontainer/Dockerfile .devcontainer/
2323
24- - name : Configure CMake
24+ - name : Build firmware in container
2525 run : |
26- docker run --rm \
26+ # Create container with source mounted
27+ docker run -d --name s2t-build \
2728 -v ${{ github.workspace }}:/workspaces/Speech2Touch \
2829 -w /workspaces/Speech2Touch \
2930 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/
3651
37- - name : Clean build
52+ - name : Copy artifacts from container
3853 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
4470
45- - name : Build firmware
71+ - name : Verify build artifacts
4672 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/
5275
5376 - name : Upload firmware artifact
5477 uses : actions/upload-artifact@v4
5578 with :
5679 name : speech2touch-firmware-${{ github.sha }}
57- path : build/Release/Speech2Touch.bin
80+ path : ${{ github.workspace }}/ build/Release/Speech2Touch.bin
5881 if-no-files-found : error
5982 retention-days : 90
6083
6184 - name : Upload firmware artifact (latest)
62- if : github.ref == 'refs/heads/main '
85+ if : github.ref == 'refs/heads/master '
6386 uses : actions/upload-artifact@v4
6487 with :
6588 name : speech2touch-firmware-latest
66- path : build/Release/Speech2Touch.bin
89+ path : ${{ github.workspace }}/ build/Release/Speech2Touch.bin
6790 if-no-files-found : error
6891 retention-days : 90
0 commit comments