Add conan cache action for ci container build using conan.lock #403
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: Celix build containers | |
on: | |
push: | |
pull_request: | |
jobs: | |
container-conan-build-ubuntu: | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 120 | |
steps: | |
- name: Checkout source code | |
uses: actions/[email protected] | |
- name: Cache Conan | |
uses: actions/cache@v3 | |
with: | |
path: ~/.conan2 | |
key: cache-conan-${{ hashFiles('conan.lock') }} | |
restore-keys: | | |
cache-conan- | |
- 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" | |
- 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" | |
- 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" | |
container-apt-build-ubuntu: | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 120 | |
steps: | |
- name: Checkout source code | |
uses: actions/[email protected] | |
- name: Build container image | |
run: | | |
docker build --tag apache/celix-apt-build:latest --target apt-build --file .devcontainer/Containerfile . | |
- 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" | |
- 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 | |
timeout-minutes: 120 | |
steps: | |
- name: Checkout source code | |
uses: actions/[email protected] | |
- name: Build dev container images | |
run: | | |
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 . |