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 14, 2025
1 parent d4fa1ac commit 3de4902
Show file tree
Hide file tree
Showing 6 changed files with 98 additions and 14 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
32 changes: 27 additions & 5 deletions .github/workflows/build-debug-ccpp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ on:

jobs:
ccpp-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: C/C++ Container Debug
strategy:
Expand All @@ -27,18 +27,42 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Cleanup Space
run: |
# our builds are a bit larger than expected
# so we need to clean up the space from the runner
sudo nsenter -t 1 -m -u -n -i -- df -h
- name: Get Host Absolute Workspace Path
run: |
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 @@ -70,9 +94,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"build-container-torizon-debug-{os.environ['PROJECT_ARCH']}")
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 3de4902

Please sign in to comment.