Skip to content

Commit

Permalink
gh: use docker-in-docker service
Browse files Browse the repository at this point in the history
  • Loading branch information
xlauko committed Sep 4, 2024
1 parent 1bdb76b commit 7337bb1
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 69 deletions.
28 changes: 17 additions & 11 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,30 +11,36 @@ ARG LLVM_VERSION
# CMake reinstall choices: none, 3.21.5, 3.22.2, or versions from https://cmake.org/download/
ARG REINSTALL_CMAKE_VERSION_FROM_SOURCE="3.29.2"

# Optionally install the cmake for vcpkg
# Optionally install CMake for vcpkg
COPY ./reinstall-cmake.sh /tmp/
RUN if [ "${REINSTALL_CMAKE_VERSION_FROM_SOURCE}" != "none" ]; then \
chmod +x /tmp/reinstall-cmake.sh && /tmp/reinstall-cmake.sh ${REINSTALL_CMAKE_VERSION_FROM_SOURCE}; \
fi \
&& rm -f /tmp/reinstall-cmake.sh
chmod +x /tmp/reinstall-cmake.sh && \
/tmp/reinstall-cmake.sh ${REINSTALL_CMAKE_VERSION_FROM_SOURCE}; \
fi && \
rm -f /tmp/reinstall-cmake.sh

COPY ./dependencies.txt /tmp/
RUN apt-get update && \
export DEBIAN_FRONTEND=noninteractive && \
xargs -a /tmp/dependencies.txt apt-get -y install --no-install-recommends && \
apt-get clean --yes && \
xargs -a /tmp/dependencies.txt apt-get install -y --no-install-recommends && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

# Install Docker
RUN curl -fsSL https://get.docker.com -o get-docker.sh \
&& sh get-docker.sh \
&& rm get-docker.sh
RUN curl -fsSL https://get.docker.com -o get-docker.sh && \
sh get-docker.sh && \
rm get-docker.sh

# Remove old versions of LLVM and Clang
RUN apt-get -y purge llvm-14 clang-14

# Install Python packages
RUN pip3 install lit codespell jinja2 Pygments

COPY ./install-llvm.sh /tmp/
RUN chmod +x /tmp/install-llvm.sh && /tmp/install-llvm.sh ${LLVM_VERSION} all
RUN chmod +x /tmp/install-llvm.sh && \
/tmp/install-llvm.sh ${LLVM_VERSION} all

RUN groupadd docker || true && usermod -aG docker root
# Add docker group and add root to it
RUN groupadd docker || true && \
usermod -aG docker root
71 changes: 13 additions & 58 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,18 @@ jobs:
image:
ghcr.io/lifting-bits/patchestry-ubuntu-${{ matrix.image-version }}-llvm-${{ matrix.llvm-version }}-dev:latest

services:
docker:
image: docker:20.10-dind
options: --privileged
ports:
- 2375:2375

env:
CMAKE_PREFIX_PATH: "/usr/lib/llvm-${{ matrix.llvm-version }}/lib/cmake/mlir/;/usr/lib/llvm-${{ matrix.llvm-version }}/lib/cmake/clang/"
LLVM_EXTERNAL_LIT: "/usr/local/bin/lit"
ENABLE_SANITIZER_UNDEFINED_BEHAVIOR: ${{ matrix.sanitizers }}
ENABLE_SANITIZER_ADDRESS: ${{ matrix.sanitizers }}
CMAKE_PREFIX_PATH: "/usr/lib/llvm-${{ matrix.llvm-version }}/lib/cmake/mlir/;/usr/lib/llvm-${{ matrix.llvm-version }}/lib/cmake/clang/"
LLVM_EXTERNAL_LIT: "/usr/local/bin/lit"
ENABLE_SANITIZER_UNDEFINED_BEHAVIOR: ${{ matrix.sanitizers }}
ENABLE_SANITIZER_ADDRESS: ${{ matrix.sanitizers }}

steps:
- name: Clone the Patchestry repository
Expand All @@ -54,59 +61,7 @@ jobs:
- name: Build ${{ matrix.build-type }} with sanitizers set ${{ matrix.sanitizers }}
run: cmake --build --preset ci --config ${{ matrix.build-type }} -j $(nproc)

#- name: Test ${{ matrix.build-type }} with sanitizers set ${{ matrix.sanitizers }}
# run: |
# cmake --preset ci
# ctest --preset ci --build-config ${{ matrix.build-type }}
test:
needs: build
strategy:
matrix:
llvm-version: [18]
image-version: [22.04]
build-type: [Release, Debug]
sanitizers: [ON, OFF]
runs-on: ubuntu-${{ matrix.image-version }}
env:
CMAKE_PREFIX_PATH: "/usr/lib/llvm-${{ matrix.llvm-version }}/lib/cmake/mlir/;/usr/lib/llvm-${{ matrix.llvm-version }}/lib/cmake/clang/"
LLVM_EXTERNAL_LIT: "/usr/local/bin/lit"
ENABLE_SANITIZER_UNDEFINED_BEHAVIOR: ${{ matrix.sanitizers }}
ENABLE_SANITIZER_ADDRESS: ${{ matrix.sanitizers }}

steps:
- name: Clone the Patchestry repository
uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 1

- name: Install CTest dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
software-properties-common \
ninja-build python3-pip \
ccache cmake lld lcov \
doxygen libzstd-dev
curl -fsSL https://get.docker.com -o get-docker.sh \
&& sh get-docker.sh \
&& rm get-docker.sh
sudo apt-get -y purge llvm-14 clang-14
pip3 install lit codespell jinja2 Pygments
curl -fsSL https://apt.llvm.org/llvm.sh -o llvm.sh && \
chmod +x llvm.sh && \
sudo ./llvm.sh ${{ matrix.llvm-version }} all && \
rm llvm.sh
sudo apt-get install libmlir-${{ matrix.llvm-version }}-dev mlir-${{ matrix.llvm-version }}-tools
sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang++-${{ matrix.llvm-version }} 60
sudo update-alternatives --install /usr/bin/cc cc /usr/bin/clang-${{ matrix.llvm-version }} 60
sudo ln -s /usr/bin/FileCheck-${{ matrix.llvm-version }} /usr/bin/FileCheck
- name: Run CTest
- name: Test ${{ matrix.build-type }} with sanitizers set ${{ matrix.sanitizers }}
run: |
cmake --preset ci
ctest --preset ci --build-config ${{ matrix.build-type }}
ctest --preset ci --build-config ${{ matrix.build-type }}

0 comments on commit 7337bb1

Please sign in to comment.