Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker workflow #1105

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 23 additions & 7 deletions .github/docker/ubuntu-20.04.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Copyright (C) 2024 Intel Corporation
# Copyright (C) 2024-2025 Intel Corporation
# Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

#
# Dockerfile - a 'recipe' for Docker to build an image of ubuntu-based
# environment for building the Unified Memory Framework project.
# environment for building the Unified Memory Framework project.
#

# Pull base image ("20.04")
Expand All @@ -29,7 +29,10 @@ ARG UMF_DEPS="\

# Dependencies for tests (optional)
ARG TEST_DEPS="\
libnuma-dev"
libnuma-dev \
libhwloc-dev \
libtbb-dev\
valgrind"

# Miscellaneous for our builds/CI (optional)
ARG MISC_DEPS="\
Expand All @@ -38,7 +41,16 @@ ARG MISC_DEPS="\
g++-7 \
python3-pip \
sudo \
whois"
whois \
lcov"

# Hwloc installation dependencies
ARG HWLOC_DEPS="\
dos2unix \
libtool"

# Copy hwloc
COPY .github/scripts/install_hwloc.sh /opt/umf/install_hwloc.sh

# Update and install required packages
RUN apt-get update \
Expand All @@ -47,17 +59,21 @@ RUN apt-get update \
${UMF_DEPS} \
${TEST_DEPS} \
${MISC_DEPS} \
${HWLOC_DEPS} \
&& dos2unix /opt/umf/install_hwloc.sh \
&& bash -x /opt/umf/install_hwloc.sh \
&& ldconfig \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean all

# Prepare a dir (accessible by anyone)
RUN mkdir --mode 777 /opt/umf/
RUN mkdir -p --mode 777 /opt/umf/

# Additional dependencies (installed via pip)
COPY third_party/requirements.txt /opt/umf/requirements.txt
RUN pip3 install --no-cache-dir -r /opt/umf/requirements.txt
# It's actively used and tested only on selected distros. Be aware
# they may not work, because pip packages list differ from OS to OS.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pls move this comment above the COPY


# Add a new (non-root) 'test_user'
ENV USER test_user
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why remove this comment?

ENV USERPASS pass
RUN useradd -m "${USER}" -g sudo -p "$(mkpasswd ${USERPASS})"
Expand Down
27 changes: 22 additions & 5 deletions .github/docker/ubuntu-22.04.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2024 Intel Corporation
# Copyright (C) 2024-2025 Intel Corporation
# Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

Expand All @@ -12,7 +12,7 @@ FROM registry.hub.docker.com/library/ubuntu@sha256:e6173d4dc55e76b87c4af8db8821b

# Set environment variables
ENV OS ubuntu
ENV OS_VER 22.04
ENV OS_VER 20.04
ENV NOTTY 1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

random change 😉

ENV DEBIAN_FRONTEND noninteractive

Expand All @@ -29,15 +29,28 @@ ARG UMF_DEPS="\

# Dependencies for tests (optional)
ARG TEST_DEPS="\
libnuma-dev"
libnuma-dev \
libhwloc-dev \
libtbb-dev\
valgrind"

# Miscellaneous for our builds/CI (optional)
ARG MISC_DEPS="\
automake \
clang \
g++-11 \
python3-pip \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why -11? I guess g++ delivered in build-essential should be ok

sudo \
whois"
whois \
lcov"

# Hwloc installation dependencies
ARG HWLOC_DEPS="\
dos2unix \
libtool"

# Copy hwloc
COPY .github/scripts/install_hwloc.sh /opt/umf/install_hwloc.sh

# Update and install required packages
RUN apt-get update \
Expand All @@ -46,11 +59,15 @@ RUN apt-get update \
${UMF_DEPS} \
${TEST_DEPS} \
${MISC_DEPS} \
${HWLOC_DEPS} \
&& dos2unix /opt/umf/install_hwloc.sh \
&& bash -x /opt/umf/install_hwloc.sh \
&& ldconfig \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean all

# Prepare a dir (accessible by anyone)
RUN mkdir --mode 777 /opt/umf/
RUN mkdir -p --mode 777 /opt/umf/

# Additional dependencies (installed via pip)
COPY third_party/requirements.txt /opt/umf/requirements.txt
Expand Down
80 changes: 80 additions & 0 deletions .github/docker/ubuntu-24.04.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# Copyright (C) 2025 Intel Corporation
# Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

#
# Dockerfile - a 'recipe' for Docker to build an image of ubuntu-based
# environment for building the Unified Memory Framework project.
#

# Pull base image ("24.04")
FROM registry.hub.docker.com/library/ubuntu@sha256:72297848456d5d37d1262630108ab308d3e9ec7ed1c3286a32fe09856619a782

# Set environment variables
ENV OS ubuntu
ENV OS_VER 20.04
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bump

ENV NOTTY 1
ENV DEBIAN_FRONTEND noninteractive

# Base development packages
ARG BASE_DEPS="\
build-essential \
cmake \
git"

# UMF's dependencies
ARG UMF_DEPS="\
libhwloc-dev \
libtbb-dev"

# Dependencies for tests (optional)
ARG TEST_DEPS="\
libnuma-dev \
libhwloc-dev \
libtbb-dev\
valgrind"

# Miscellaneous for our builds/CI (optional)
ARG MISC_DEPS="\
automake \
clang \
g++-11 \
python3-pip \
sudo \
whois \
lcov"

# Hwloc installation dependencies
ARG HWLOC_DEPS="\
dos2unix \
libtool"

# Copy hwloc
COPY .github/scripts/install_hwloc.sh /opt/umf/install_hwloc.sh

# Update and install required packages
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
${BASE_DEPS} \
${UMF_DEPS} \
${TEST_DEPS} \
${MISC_DEPS} \
${HWLOC_DEPS} \
&& dos2unix /opt/umf/install_hwloc.sh \
&& bash -x /opt/umf/install_hwloc.sh \
&& ldconfig \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean all

# Prepare a dir (accessible by anyone)
RUN mkdir -p --mode 777 /opt/umf/

# Additional dependencies (installed via pip)
COPY third_party/requirements.txt /opt/umf/requirements.txt
RUN pip3 install --no-cache-dir --break-system-packages -r /opt/umf/requirements.txt

# Add a new (non-root) 'test_user'
ENV USER test_user
ENV USERPASS pass
RUN useradd -m "${USER}" -g sudo -p "$(mkpasswd ${USERPASS})"
USER test_user
40 changes: 40 additions & 0 deletions .github/workflows/build_ci_container.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Build and push Docker images to GHCR
name: BuildDockers

on:
workflow_call:
workflow_dispatch:

permissions:
packages: write
contents: read

jobs:
build-ci-container:
runs-on: ubuntu-latest
strategy:
matrix:
ubuntu-version: [20.04, 22.04, 24.04]
outputs:
status: ${{ job.status }}
env:
GHCR_TOKEN: ${{ secrets.GHCR_TOKEN }}
IMG: ghcr.io/${{ github.actor }}/umf-ubuntu-${{ matrix.ubuntu-version }}:latest
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perhaps already here set ENV var for the user (actor) and use it in both places in this workflow


steps:
- name: Checkout repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
fetch-depth: 0

- name: Login to GitHub Container Registry
uses: docker/login-action@30f019fb76bb54d03ec1e716054622be511a13b2 # v3.2.0
with:
registry: ghcr.io
username: ${{ github.actor }} # ${{ sys_bb-umf }}
password: ${{ env.GHCR_TOKEN }}

- name: Build and push ubuntu-${{ matrix.ubuntu-version }} Docker image
run: |
docker build -f .github/docker/ubuntu-${{ matrix.ubuntu-version }}.Dockerfile -t ${{ env.IMG }} .
docker push ${{ env.IMG }}
45 changes: 42 additions & 3 deletions .github/workflows/pr_push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,50 +14,87 @@ concurrency:

permissions:
contents: read
packages: read

jobs:
CodeChecks:
uses: ./.github/workflows/reusable_checks.yml
DocsBuild:
uses: ./.github/workflows/reusable_docs_build.yml
DetectChanges:
runs-on: ubuntu-latest
outputs:
changed_files: ${{ steps.changed-files.outputs.all_changed_files }}
steps:
- name: Checkout code
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
fetch-depth: 0

- name: Get changed files
id: changed-files
uses: tj-actions/[email protected]

- name: List all changed files
env:
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
run: |
echo "Changed files: ${{ steps.changed-files.outputs.all_changed_files }}"
BuildDockers:
if: ${{ contains(join(needs.DetectChanges.outputs.changed_files, ' '), '.github/docker/') }}
needs: [DetectChanges]
permissions:
contents: read
packages: write
secrets: inherit
uses: ./.github/workflows/build_ci_container.yml
FastBuild:
name: Fast builds
needs: [CodeChecks, DocsBuild]
if: always() && (needs.BuildDockers.result == 'skipped' || needs.BuildDockers.result == 'success')
needs: [CodeChecks, DocsBuild, BuildDockers]
uses: ./.github/workflows/reusable_fast.yml
Build:
name: Basic builds
if: always() && (needs.FastBuild.result == 'success')
needs: [FastBuild]
uses: ./.github/workflows/reusable_basic.yml
DevDax:
if: always() && (needs.FastBuild.result == 'success')
needs: [FastBuild]
uses: ./.github/workflows/reusable_dax.yml
MultiNuma:
if: always() && (needs.FastBuild.result == 'success')
needs: [FastBuild]
uses: ./.github/workflows/reusable_multi_numa.yml
L0:
if: always() && (needs.Build.result == 'success')
needs: [Build]
uses: ./.github/workflows/reusable_gpu.yml
with:
name: "LEVEL_ZERO"
shared_lib: "['ON']"
CUDA:
if: always() && (needs.Build.result == 'success')
needs: [Build]
uses: ./.github/workflows/reusable_gpu.yml
with:
name: "CUDA"
shared_lib: "['ON']"
Sanitizers:
if: always() && (needs.FastBuild.result == 'success')
needs: [FastBuild]
uses: ./.github/workflows/reusable_sanitizers.yml
QEMU:
if: always() && (needs.FastBuild.result == 'success')
needs: [FastBuild]
uses: ./.github/workflows/reusable_qemu.yml
with:
short_run: true
ProxyLib:
if: always() && (needs.Build.result == 'success')
needs: [Build]
uses: ./.github/workflows/reusable_proxy_lib.yml
Valgrind:
if: always() && (needs.Build.result == 'success')
needs: [Build]
uses: ./.github/workflows/reusable_valgrind.yml
Coverage:
Expand All @@ -70,16 +107,18 @@ jobs:
trigger: "${{github.event_name}}"
Coverage_partial:
# partial coverage (on forks)
if: github.repository != 'oneapi-src/unified-memory-framework'
if: github.repository != 'oneapi-src/unified-memory-framework' && always() && (needs.Build.result == 'success')
needs: [Build, QEMU, ProxyLib]
uses: ./.github/workflows/reusable_coverage.yml
CodeQL:
if: always() && (needs.Build.result == 'success')
needs: [Build]
permissions:
contents: read
security-events: write
uses: ./.github/workflows/reusable_codeql.yml
Trivy:
if: always() && (needs.Build.result == 'success')
needs: [Build]
permissions:
contents: read
Expand Down
Loading
Loading