Skip to content

Commit

Permalink
Update Containerfile and conan cache setup
Browse files Browse the repository at this point in the history
  • Loading branch information
pnoltes committed Jun 18, 2024
1 parent e5a0640 commit d2779cc
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 24 deletions.
15 changes: 7 additions & 8 deletions .devcontainer/Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,10 @@ RUN DEBIAN_FRONTEND="noninteractive" apt-get update && \
build-essential \
ccache \
cmake \
cmake-curses-gui \
curl \
default-jdk \
gcc \
g++ \
gdb \
make \
zip \
ninja-build \
lcov \
sudo \
Expand All @@ -44,7 +41,8 @@ FROM build as conan-build
RUN pip3 install conan && pip3 cache purge

# Setup conan profile for root
RUN conan profile detect
COPY .devcontainer/conan-container-default-profile /root/.conan2/profiles/default
COPY .devcontainer/conan-container-debug-profile /root/.conan2/profiles/debug

# Build image using apt dependencies
FROM build as apt-build
Expand Down Expand Up @@ -77,12 +75,13 @@ USER celixdev
WORKDIR /home/celixdev

# Setup conan profile for celixdev
RUN conan profile detect
COPY .devcontainer/conan-container-default-profile /home/celixdev/.conan2/profiles/default
COPY .devcontainer/conan-container-debug-profile /home/celixdev/.conan2/profiles/debug

#Install development dependencies
RUN sudo DEBIAN_FRONTEND="noninteractive" apt-get update && \
sudo DEBIAN_FRONTEND="noninteractive" apt-get install -y --no-install-recommends \
gnupg2 dos2unix git locales-all rsync tar ssh tzdata sudo vim openssh-server && \
gnupg2 dos2unix git locales-all rsync tar ssh tzdata sudo vim openssh-server cmake-curses-gui gdb && \
sudo apt-get clean

RUN sudo mkdir /run/sshd
Expand All @@ -99,7 +98,7 @@ WORKDIR /home/celixdev
#Install development dependencies
RUN sudo DEBIAN_FRONTEND="noninteractive" apt-get update && \
sudo DEBIAN_FRONTEND="noninteractive" apt-get install -y --no-install-recommends \
gnupg2 dos2unix git locales-all rsync tar ssh tzdata sudo vim openssh-server && \
gnupg2 dos2unix git locales-all rsync tar ssh tzdata sudo vim openssh-server cmake-curses-gui gdb && \
sudo apt-get clean

RUN sudo mkdir /run/sshd
26 changes: 26 additions & 0 deletions .devcontainer/conan-container-debug-profile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

#Based on gcc from ubuntu:22.04 base image
[settings]
arch=x86_64
build_type=Debug
compiler=gcc
compiler.cppstd=17
compiler.libcxx=libstdc++11
compiler.version=11
os=Linux
26 changes: 26 additions & 0 deletions .devcontainer/conan-container-default-profile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

#Based on gcc from ubuntu:22.04 base image
[settings]
arch=x86_64
build_type=Release
compiler=gcc
compiler.cppstd=17
compiler.libcxx=libstdc++11
compiler.version=11
os=Linux
40 changes: 24 additions & 16 deletions .github/workflows/containers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,34 +14,42 @@ jobs:
- name: Cache Conan
uses: actions/cache@v3
with:
path: ~/.conan2
key: conan-container-cache-${{ runner.os }}-${{ hashFiles('conanfile.py') }}
path: ~/.conan2-container
key: conan-container-cache-${{ runner.os }}-${{ hashFiles('conanfile.py', '.devcontainer/Containerfile') }}
restore-keys: conan-container-cache-${{ runner.os }}-
- name: Build container image
run: |
docker build --tag apache/celix-conan-build:latest --target conan-build --file .devcontainer/Containerfile .
- name: Build Celix dependencies
run: |
mkdir -p ~/.conan2 && \
docker run --rm -v ~/.conan2:/root/.conan2 -v $(pwd):/workspace apache/celix-conan-build:latest /bin/bash -c \
"conan profile detect && \
cd /workspace && \
conan install . --build missing --options build_all=True --options enable_address_sanitizer=True \
--options enable_testing=True --options enable_ccache=True --output-folder build \
--conf tools.cmake.cmaketoolchain:generator=Ninja"
run: | #Using .conan2-container so that the steps can be reproduced locally without affecting the host conan
mkdir -p ~/.conan2-container/profiles && \
cp .devcontainer/conan-container-default-profile ~/.conan2-container/profiles/default && \
cp .devcontainer/conan-container-debug-profile ~/.conan2-container/profiles/debug && \
docker run --rm -v ~/.conan2-container:/root/.conan2 -v $(pwd):/workspace \
apache/celix-conan-build:latest /bin/bash -c \
"cd /workspace && \
conan install . --build missing --profile debug \
--options celix/*:build_all=True --options celix/*:enable_address_sanitizer=True \
--options celix/*:enable_testing=True --options celix/*:enable_ccache=True \
--conf:build tools.cmake.cmaketoolchain:generator=Ninja \
--output-folder build"
- name: Build Celix
run: |
docker run --rm -v ~/.conan2:/root/.conan2 -v $(pwd):/workspace apache/celix-conan-build:latest /bin/bash -c \
docker run --rm -v ~/.conan2-container:/root/.conan2 -v $(pwd):/workspace \
apache/celix-conan-build:latest /bin/bash -c \
"cd /workspace && \
conan build . --build missing --options build_all=True --options enable_address_sanitizer=True \
--options enable_testing=True --options enable_ccache=True --output-folder build \
--conf tools.cmake.cmaketoolchain:generator=Ninja --settings build_type=Debug"
conan build . --profile debug \
--options celix/*:build_all=True --options celix/*:enable_address_sanitizer=True \
--options celix/*:enable_testing=True --options celix/*:enable_ccache=True \
--conf:build tools.cmake.cmaketoolchain:generator=Ninja \
--output-folder build"
- name: Test Celix
run: |
docker run --rm -v ~/.conan2:/root/.conan2 -v $(pwd):/workspace apache/celix-conan-build:latest /bin/bash -c \
docker run --rm -v ~/.conan2-container:/root/.conan2 -v $(pwd):/workspace \
apache/celix-conan-build:latest /bin/bash -c \
"cd /workspace/build && \
source conanrun.sh && \
ctest --output-on-failure"
ctest --output-on-failure -E unit_test_discovery_zeroconf"
container-apt-build-ubuntu:
runs-on: ubuntu-22.04
Expand Down

0 comments on commit d2779cc

Please sign in to comment.