Skip to content

Commit

Permalink
Split build into two actions
Browse files Browse the repository at this point in the history
  • Loading branch information
kuznetsss committed Dec 6, 2023
1 parent 3e43285 commit ba82005
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 16 deletions.
20 changes: 6 additions & 14 deletions .github/actions/build_clio/action.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
name: Build clio
description: Build clio in build directory
inputs:
conan_profile:
description: Conan profile name
required: true
conan_cache_hit:
description: Whether conan cache has been downloaded
required: true
runs:
using: composite
steps:
Expand All @@ -16,13 +9,12 @@ runs:

- name: Build Clio
shell: bash
env:
BUILD_OPTION: "${{ inputs.conan_cache_hit == 'true' && 'missing' || '' }}"
run: |
mkdir -p build
cd build
threads_num=${{ steps.number_of_threads.outputs.threads_number }}
conan install .. -of . -b $BUILD_OPTION -s build_type=Release -o clio:tests=True -o clio:lint=False --profile ${{ inputs.conan_profile }}
cmake -DCMAKE_TOOLCHAIN_FILE:FILEPATH=build/generators/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release .. -G Ninja
cmake --build . --parallel $threads_num
cmake --build . --parallel ${{ steps.number_of_threads.outputs.threads_number }}
- name: Print ccache statistics
if: ${{ env.CCACHE_DISABLED != '1' }}
shell: bash
run: |
ccache -s
36 changes: 36 additions & 0 deletions .github/actions/generate/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Run conan and cmake
description: Run conan and cmake
inputs:
conan_profile:
description: Conan profile name
required: true
conan_cache_hit:
description: Whether conan cache has been downloaded
required: true
default: 'false'
build_type:
description: Build type for third-party libraries and clio. Could be 'Release', 'Debug'
required: true
default: 'Release'
runs:
using: composite
steps:
- name: Create build directory
shell: bash
run: mkdir -p build

- name: Run conan
shell: bash
env:
BUILD_OPTION: "${{ inputs.conan_cache_hit == 'true' && 'missing' || '' }}"
run: |
cd build
conan install .. -of . -b $BUILD_OPTION -s build_type=${{ inputs.build_type }} -o clio:tests=True -o clio:lint=False --profile ${{ inputs.conan_profile }}
- name: Run cmake
shell: bash
env:
BUILD_TYPE: "${{ inputs.build_type }}"
run: |
cd build
cmake -DCMAKE_TOOLCHAIN_FILE:FILEPATH=build/generators/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=${{ inputs.build_type }} .. -G Ninja
12 changes: 10 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,19 @@ jobs:
conan_dir: ${{ env.CONAN_USER_HOME }}/.conan
ccache_dir: ${{ env.CCACHE_DIR }}

- name: Build Clio
uses: ./.github/actions/build_clio
- name: Run conan and cmake
uses: ./.github/actions/generate
with:
conan_profile: ${{ steps.conan.outputs.conan_profile }}
conan_cache_hit: ${{ steps.restore_cache.outputs.conan_cache_hit }}
build_type: 'Release'


- name: Build Clio
uses: ./.github/actions/build_clio

- name: Show ccache's statistics
run: ccache -s

- name: Strip tests
run: strip build/clio_tests
Expand Down

0 comments on commit ba82005

Please sign in to comment.