Skip to content

Commit

Permalink
Split container install, build & test in multiple steps
Browse files Browse the repository at this point in the history
  • Loading branch information
pnoltes committed Jun 16, 2024
1 parent 8e5ff23 commit de8b49a
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 13 deletions.
5 changes: 4 additions & 1 deletion .devcontainer/Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ FROM build as conan-build
# Install conan
RUN pip3 install conan && pip3 cache purge

# Setup conan profile
# Setup conan profile for root
RUN conan profile detect

# Build image using apt dependencies
Expand Down Expand Up @@ -76,6 +76,9 @@ RUN useradd -m -s /bin/bash -G sudo celixdev && \
USER celixdev
WORKDIR /home/celixdev

# Setup conan profile for celixdev
RUN conan profile detect

#Install development dependencies
RUN sudo DEBIAN_FRONTEND="noninteractive" apt-get update && \
sudo DEBIAN_FRONTEND="noninteractive" apt-get install -y --no-install-recommends \
Expand Down
37 changes: 25 additions & 12 deletions .github/workflows/containers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ name: Celix build containers
on:
push:
pull_request:
schedule:
- cron: '0 0 * * 0' # Weekly on Sunday at 00:00 UTC

jobs:
container-conan-build-ubuntu:
Expand All @@ -16,16 +14,27 @@ jobs:
- name: Build container image
run: |
docker build --tag apache/celix-conan-build:latest --target conan-build --file .devcontainer/Containerfile .
- name: Build and test Celix the conan container image
- name: Build Celix dependencies
run: |
docker run --rm -v $(pwd):/workspace apache/celix-conan-build:latest /bin/bash -c \
mkdir -p ~/.conan2 && \
docker run --rm -v ~/.conan2:/root/.conan2 -v $(pwd):/workspace apache/celix-conan-build:latest /bin/bash -c \
"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"
- name: Build Celix
run: |
docker run --rm -v ~/.conan2:/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 && \
cd build && \
--conf tools.cmake.cmaketoolchain:generator=Ninja --settings build_type=Debug"
- name: Test Celix
run: |
docker run --rm -v ~/.conan2:/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"
container-apt-build-ubuntu:
runs-on: ubuntu-22.04
Expand All @@ -36,14 +45,18 @@ jobs:
- name: Build container image
run: |
docker build --tag apache/celix-apt-build:latest --target apt-build --file .devcontainer/Containerfile .
- name: Build and test Celix the conan container image
- name: Build Celix
run: |
docker run --rm -v $(pwd):/workspace apache/celix-apt-build:latest /bin/bash -c \
"mkdir /workspace/build && cd /workspace/build && \
cmake -DCMAKE_BUILD_TYPE=Debug -DBUILD_EXPERIMENTAL=ON -DENABLE_TESTING=ON -DRSA_JSON_RPC=ON \
-DRSA_REMOTE_SERVICE_ADMIN_SHM_V2=ON -DENABLE_CCACHE=ON .. && \
make -j && \
ctest --output-on-failure"
make -j &&"
- name: Test Celix
run: |
docker run --rm -v $(pwd):/workspace apache/celix-apt-build:latest /bin/bash -c \
"cd /workspace/build && \
ctest --output-on-failure"
build-dev-container-images:
runs-on: ubuntu-22.04
Expand All @@ -53,5 +66,5 @@ jobs:
uses: actions/[email protected]
- name: Build dev container images
run: |
docker build -t apache/celix-conan-dev:latest --target conan-dev -f .devcontainer/Containerfile
docker build -t apache/celix-apt-dev:latest --target apt-dev -f .devcontainer/Containerfile
docker build --tag apache/celix-conan-dev:latest --target conan-dev --file .devcontainer/Containerfile .
docker build --tag apache/celix-apt-dev:latest --target apt-dev --file .devcontainer/Containerfile .

0 comments on commit de8b49a

Please sign in to comment.