Skip to content

Commit

Permalink
github: workflow: add docker daemon to sdk build jobs
Browse files Browse the repository at this point in the history
A from scratch docker daemon is required to build with the
sdk containers, this is because the default docker in docker
uses a abstracted docker socket that is hard to map the host
folders to the container. Also the check is more complete
when using a clean docker daemon.

Signed-off-by: Matheus Castello <[email protected]>
  • Loading branch information
microhobby committed Jan 15, 2025
1 parent d4fa1ac commit cc7d947
Show file tree
Hide file tree
Showing 6 changed files with 93 additions and 18 deletions.
22 changes: 20 additions & 2 deletions .github/workflows/build-ccpp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ on:

jobs:
ccpp:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
container:
image: torizonextras/torizon-dev:dev
options: --user root
options: --privileged --user root
if: github.ref == 'refs/heads/bookworm' || github.ref == 'refs/heads/dev'
name: C/C++ Container
strategy:
Expand All @@ -32,13 +32,31 @@ jobs:
echo "${{ github.workspace }}" >> abs-path
cat abs-path
- name: Update torizon-utils module
run: |
chmod a+rwx . -R
sudo -u torizon pipx inject xonsh ./scripts/utils/pip/
- name: Run Docker Daemon
run: |
mkdir -p /var/lib/docker
dockerd \
--data-root=/var/lib/docker \
--host=unix:///var/run/docker-alt.sock \
--tls=false \
--host=tcp://0.0.0.0:2376 \
--userland-proxy-path=/usr/libexec/docker/docker-proxy \
--userland-proxy=false &
sleep 10
- name: Build ${{ matrix.project.folder }} Dockerfile
shell: xonsh {0}
env:
PROJECT_FOLDER: ${{ matrix.project.folder }}
PROJECT_CONTAINER: ${{ matrix.project.container }}
VENDOR: ${{ matrix.project.vendor }}
DOCKER_LOGIN: localhost:5002
GITHUB_WORKSPACE_DOCKER: 2376

run: |
import os
Expand Down
31 changes: 22 additions & 9 deletions .github/workflows/build-debug-ccpp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,14 @@ on:
jobs:
ccpp-debug:
runs-on: ubuntu-latest
container:
image: torizonextras/torizon-dev:dev
options: --user root
if: github.ref == 'refs/heads/bookworm' || github.ref == 'refs/heads/dev'
name: C/C++ Container Debug
strategy:
matrix:
project:
- folder: cppQML
container: cpp-qml
vendor: '{ "arch": "arm64", "torizon_arch": "aarch64" }'
# - folder: cppQML
# container: cpp-qml
# vendor: '{ "arch": "arm64", "torizon_arch": "aarch64" }'

- folder: cppSlint
container: cpp-slint
Expand All @@ -32,13 +29,26 @@ jobs:
echo "${{ github.workspace }}" >> abs-path
cat abs-path
- name: Setup Xonsh
run: |
apt-get update
apt-get install -y python3 python3-pip pipx
bash ./scripts/bash/setup-xonsh.sh
ln -s /root/.local/bin/xonsh /usr/bin/xonsh
- name: Update torizon-utils module
run: |
pipx inject xonsh ./scripts/utils/pip/
- name: Build ${{ matrix.project.folder }} Dockerfile
shell: xonsh {0}
continue-on-error: true
env:
PROJECT_FOLDER: ${{ matrix.project.folder }}
PROJECT_CONTAINER: ${{ matrix.project.container }}
VENDOR: ${{ matrix.project.vendor }}
DOCKER_LOGIN: localhost:5002
TASKS_DEBUG: "true"

run: |
import os
Expand Down Expand Up @@ -70,9 +80,12 @@ jobs:
with open(".vscode/settings.json", "w") as file:
json.dump(settings_json, file, indent=4)
# FIXME: this is bad, but it's the only to make it work here
chmod 777 . -R
chmod a+rwx . -R
xonsh ./.vscode/tasks.xsh run run-torizon-binfmt
xonsh ./.vscode/tasks.xsh run @(f"build-debug-{os.environ['PROJECT_ARCH']}")
xonsh ./.vscode/tasks.xsh run @(f"build-container-torizon-debug-{os.environ['PROJECT_ARCH']}")
- name: Check
run: |
pwd
ls -lah .
5 changes: 5 additions & 0 deletions .github/workflows/build-debug-python.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ jobs:
echo "${{ github.workspace }}" >> abs-path
cat abs-path
- name: Update torizon-utils module
run: |
chmod a+rwx . -R
sudo -u torizon pipx inject xonsh ./scripts/utils/pip/
- name: Build ${{ matrix.project.folder }} Dockerfile
shell: xonsh {0}
env:
Expand Down
26 changes: 21 additions & 5 deletions .github/workflows/build-debug-rust.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ on:

jobs:
rust-debug:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
container:
image: torizonextras/torizon-dev:dev
options: --user root
options: --privileged --user root
if: github.ref == 'refs/heads/bookworm' || github.ref == 'refs/heads/dev'
name: Rust Container Debug
strategy:
Expand All @@ -28,13 +28,31 @@ jobs:
echo "${{ github.workspace }}" >> abs-path
cat abs-path
- name: Update torizon-utils module
run: |
chmod a+rwx . -R
sudo -u torizon pipx inject xonsh ./scripts/utils/pip/
- name: Run Docker Daemon
run: |
mkdir -p /var/lib/docker
dockerd \
--data-root=/var/lib/docker \
--host=unix:///var/run/docker-alt.sock \
--tls=false \
--host=tcp://0.0.0.0:2376 \
--userland-proxy-path=/usr/libexec/docker/docker-proxy \
--userland-proxy=false &
sleep 10
- name: Build ${{ matrix.project.folder }} Dockerfile
shell: xonsh {0}
env:
PROJECT_FOLDER: ${{ matrix.project.folder }}
PROJECT_CONTAINER: ${{ matrix.project.container }}
VENDOR: ${{ matrix.project.vendor }}
DOCKER_LOGIN: localhost:5002
GITHUB_WORKSPACE_DOCKER: 2376

run: |
import os
Expand Down Expand Up @@ -66,9 +84,7 @@ jobs:
with open(".vscode/settings.json", "w") as file:
json.dump(settings_json, file, indent=4)
# FIXME: this is bad, but it's the only to make it work here
chmod 777 . -R
chmod a+rwx . -R
xonsh ./.vscode/tasks.xsh run run-torizon-binfmt
xonsh ./.vscode/tasks.xsh run @(f"build-debug-{os.environ['PROJECT_ARCH']}")
xonsh ./.vscode/tasks.xsh run @(f"copy-debug-executable-{os.environ['PROJECT_ARCH']}")
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/build-python.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ jobs:
echo "${{ github.workspace }}" >> abs-path
cat abs-path
- name: Update torizon-utils module
run: |
chmod a+rwx . -R
sudo -u torizon pipx inject xonsh ./scripts/utils/pip/
- name: Build ${{ matrix.project.folder }} Dockerfile
shell: xonsh {0}
env:
Expand Down
22 changes: 20 additions & 2 deletions .github/workflows/build-rust.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ on:

jobs:
rust:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
container:
image: torizonextras/torizon-dev:dev
options: --user root
options: --privileged --user root
if: github.ref == 'refs/heads/bookworm' || github.ref == 'refs/heads/dev'
name: Rust Container
strategy:
Expand All @@ -28,13 +28,31 @@ jobs:
echo "${{ github.workspace }}" >> abs-path
cat abs-path
- name: Update torizon-utils module
run: |
chmod a+rwx . -R
sudo -u torizon pipx inject xonsh ./scripts/utils/pip/
- name: Run Docker Daemon
run: |
mkdir -p /var/lib/docker
dockerd \
--data-root=/var/lib/docker \
--host=unix:///var/run/docker-alt.sock \
--tls=false \
--host=tcp://0.0.0.0:2376 \
--userland-proxy-path=/usr/libexec/docker/docker-proxy \
--userland-proxy=false &
sleep 10
- name: Build ${{ matrix.project.folder }} Dockerfile
shell: xonsh {0}
env:
PROJECT_FOLDER: ${{ matrix.project.folder }}
PROJECT_CONTAINER: ${{ matrix.project.container }}
VENDOR: ${{ matrix.project.vendor }}
DOCKER_LOGIN: localhost:5002
GITHUB_WORKSPACE_DOCKER: 2376

run: |
import os
Expand Down

0 comments on commit cc7d947

Please sign in to comment.