Add additional cache mechanisms for container ci builds #1333
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: Conan Create | |
on: | |
push: | |
pull_request: | |
schedule: | |
- cron: '0 0 * * *' | |
env: | |
CONAN_USER_HOME: "${{ github.workspace }}/release/" | |
CONAN_USER_HOME_SHORT: "${{ github.workspace }}/release/short" | |
CONAN_HOME: "${{ github.workspace }}/release/" | |
CCACHE_DIR: "${{ github.workspace }}/.ccache" | |
CCACHE_SLOPPINESS: include_file_ctime,include_file_mtime | |
jobs: | |
ubuntu-build: | |
runs-on: ubuntu-22.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
compiler: [ [gcc,g++], [clang,clang++] ] | |
type: [ Release ] | |
timeout-minutes: 120 | |
steps: | |
- name: Checkout source code | |
uses: actions/[email protected] | |
- name: Install build dependencies | |
run: | | |
sudo pip install -U conan | |
sudo apt-get install -yq --no-install-recommends ninja-build | |
- name: Setup Conan Profile | |
env: | |
CC: ${{ matrix.compiler[0] }} | |
CXX: ${{ matrix.compiler[1] }} | |
run: | | |
# build profile | |
conan profile detect -f | |
sed -i 's/compiler.cppstd=gnu14/compiler.cppstd=gnu17/g' `conan profile path default` | |
- name: Conan Cache | |
id: cache-conan | |
uses: actions/cache@v3 | |
env: | |
cache-name: cache-conan2-modules | |
with: | |
path: ${{ env.CONAN_HOME }} | |
key: ${{ runner.os }}-builder-${{ env.cache-name }}-${{ matrix.compiler[0] }}-${{ matrix.type }}-${{ hashFiles('conanfile.py') }} | |
restore-keys: ${{ runner.os }}-builder-${{ env.cache-name }}-${{ matrix.compiler[0] }}-${{ matrix.type }}- | |
- name: Prepare ccache timestamp | |
id: ccache_cache_timestamp | |
run: | | |
echo timestamp=`date +"%Y-%m-%d-%H;%M;%S"` >> $GITHUB_OUTPUT | |
- name: ccache Cache | |
uses: actions/cache@v3 | |
with: | |
path: ${{ env.CCACHE_DIR }} | |
key: ${{ runner.os }}-ccache-${{ matrix.compiler[0] }}-${{ matrix.type }}-${{ steps.ccache_cache_timestamp.outputs.timestamp }} | |
restore-keys: | | |
${{ runner.os }}-ccache-${{ matrix.compiler[0] }}-${{ matrix.type }}- | |
- name: Create Celix | |
env: | |
CC: ${{ matrix.compiler[0] }} | |
CXX: ${{ matrix.compiler[1] }} | |
run: | | |
conan create . -c tools.cmake.cmaketoolchain:generator=Ninja -b missing -o celix/*:build_all=True -o celix/*:enable_ccache=True -pr:b default -pr:h default -s:h build_type=${{ matrix.type }} -tf examples/conan_test_package_v2 -o celix/*:celix_cxx17=True -o celix/*:celix_install_deprecated_api=True | |
- name: Dependency Deduction Test | |
env: | |
CC: ${{ matrix.compiler[0] }} | |
CXX: ${{ matrix.compiler[1] }} | |
run: | | |
conan inspect . | awk 'BEGIN { FS="[\t:]+"; output=0 } /build/ && !/build_all/ { if(output) print $1} /^options/ {output=1} /^options_definitions/ {output=0}' | while read option; do conan build . -c tools.cmake.cmaketoolchain:generator=Ninja -b missing -o celix/*:${option}=True -pr:b default -pr:h default -s:h build_type=${{ matrix.type }} -of ${option}_dir -o celix/*:celix_cxx17=True -o celix/*:enable_ccache=True -o celix/*:celix_install_deprecated_api=True || exit 1; done | |
- name: Remove Celix | |
run: | | |
conan remove -c celix/* | |
mac-build: | |
runs-on: macOS-11 | |
timeout-minutes: 120 | |
steps: | |
- name: Checkout source code | |
uses: actions/[email protected] | |
- name: Install build dependencies | |
run: | | |
brew install python ninja | |
pip3 install -U conan | |
- name: Setup Conan Profile | |
run: | | |
conan profile detect -f | |
- name: Conan Cache | |
id: cache-conan | |
uses: actions/cache@v3 | |
env: | |
cache-name: cache-conan2-modules | |
with: | |
path: ${{ env.CONAN_HOME }} | |
key: ${{ runner.os }}-builder-${{ env.cache-name }}-Release-${{ hashFiles('conanfile.py') }} | |
restore-keys: ${{ runner.os }}-builder-${{ env.cache-name }}-Release- | |
- name: Prepare ccache timestamp | |
id: ccache_cache_timestamp | |
run: | | |
echo timestamp=`date +"%Y-%m-%d-%H;%M;%S"` >> $GITHUB_OUTPUT | |
- name: ccache Cache | |
uses: actions/cache@v3 | |
with: | |
path: ${{ env.CCACHE_DIR }} | |
key: ${{ runner.os }}-ccache-Release-${{ steps.ccache_cache_timestamp.outputs.timestamp }} | |
restore-keys: | | |
${{ runner.os }}-ccache-Release- | |
- name: Create Celix | |
run: | | |
conan create . -c tools.cmake.cmaketoolchain:generator=Ninja -b missing -o celix/*:build_all=True -o celix/*:enable_ccache=True -pr:b default -pr:h default -s:b build_type=Release -s:h build_type=Release -tf examples/conan_test_package_v2 -o celix/*:celix_cxx17=True -o celix/*:celix_install_deprecated_api=True | |
- name: Dependency Deduction Test | |
run: | | |
conan inspect . | awk 'BEGIN { FS="[\t:]+"; output=0 } /build/ && !/build_all/ && !/build_rsa_remote_service_admin_shm_v2/ && !/build_rsa_discovery_zeroconf/ { if(output) print $1} /^options/ {output=1} /^options_definitions/ {output=0}' | while read option; do conan build . -c tools.cmake.cmaketoolchain:generator=Ninja -b missing -o celix/*:${option}=True -pr:b default -pr:h default -s:b build_type=Release -s:h build_type=Release -of ${option}_dir -o celix/*:celix_cxx17=True -o celix/*:enable_ccache=True -o celix/*:celix_install_deprecated_api=True || exit 1; done | |
- name: Remove Celix | |
run: | | |
conan remove -c celix/* |