github: workflow: add docker daemon to sdk build jobs #212
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Rust Containers | |
on: | |
push: | |
branches: | |
- dev | |
- bookworm | |
jobs: | |
rust: | |
runs-on: ubuntu-24.04 | |
container: | |
image: torizonextras/torizon-dev:dev | |
options: --privileged --user root | |
if: github.ref == 'refs/heads/bookworm' || github.ref == 'refs/heads/dev' | |
name: Rust Container | |
strategy: | |
matrix: | |
project: | |
- folder: rustSlint | |
container: rust-slint | |
vendor: '{ "arch": "arm64", "torizon_arch": "aarch64" }' | |
steps: | |
- uses: actions/checkout@v3 | |
- 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 | |
import json | |
$RAISE_SUBPROC_ERROR = True | |
$XONSH_SHOW_TRACEBACK = True | |
$UPDATE_OS_ENVIRON = True | |
vendor = json.loads(os.environ['VENDOR']) | |
$TORIZON_ARCH = vendor["torizon_arch"] | |
$PROJECT_ARCH = vendor["arch"] | |
xonsh ./scripts/create-from-template.xsh \ | |
@(f"{os.environ['GITHUB_WORKSPACE']}/{os.environ['PROJECT_FOLDER']}") \ | |
@(f"{os.environ['PROJECT_FOLDER']}CITest") \ | |
@(f"{os.environ['PROJECT_CONTAINER']}-ci-test") \ | |
@(os.environ['GITHUB_WORKSPACE']) \ | |
@(os.environ['PROJECT_FOLDER']) \ | |
"false" \ | |
"false" | |
cp "abs-path" @(f"{os.environ['GITHUB_WORKSPACE']}/{os.environ['PROJECT_FOLDER']}CITest") | |
os.chdir(f"{os.environ['GITHUB_WORKSPACE']}/{os.environ['PROJECT_FOLDER']}CITest") | |
with open(".vscode/settings.json", "r") as file: | |
settings_json = json.load(file) | |
settings_json["torizon_arch"] = os.environ['TORIZON_ARCH'] | |
with open(".vscode/settings.json", "w") as file: | |
json.dump(settings_json, file, indent=4) | |
xonsh ./.vscode/tasks.xsh run run-torizon-binfmt | |
xonsh ./.vscode/tasks.xsh run @(f"build-container-torizon-release-{os.environ['PROJECT_ARCH']}") |