Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
dwarfovich committed Sep 10, 2024
1 parent 90342b6 commit 373a4d3
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 70 deletions.
24 changes: 13 additions & 11 deletions .github/workflows/HW3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,15 @@ jobs:
build-and-run-job:
env:
target_name: allocator_driver
homework_label: HW3
cmake_preset: linux-release
cmake_build_preset: linux-build-release
cmake_build_preset: build-linux-release
package_preset: deb-package-release
hw_path: ./HW3
build_folder: build
release_folder: linux-release
version_base: '1.0'
build_tests: ${{ false }}
build_tests: ${{ true }}
build_package: ${{ true }}
# Variables to populate in "Initialize variables" step
build_path:
bin_path:
Expand All @@ -41,15 +42,15 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Build package ${{ env.target_name }}
- name: Build packet ${{ env.target_name }}
working-directory: ${{env.hw_path}}
run: |
cmake -DBuildTests=${{ env.build_tests }} -DPROJECT_VERSION=${{ env.version }} --preset ${{ env.cmake_preset }}
cmake -DBUILD_TESTS=${{ env.build_tests }} -DCONFIGURE_DEB_PACKAGE=${{ env.build_package }} -DPROJECT_VERSION=${{ env.version }} --preset ${{ env.cmake_preset }}
cmake --build --preset ${{ env.cmake_build_preset }}
- name: Run tests
if: ${{ env.build_tests }}
working-directory: /home/runner/work/Otus/Otus/./HW3/build-linux-release
working-directory: ${{ env.build_path }}
run: ctest --test-dir .

- name: Check tests results
Expand All @@ -61,11 +62,12 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Run packet ${{ env.target_name }}
run: /home/runner/work/Otus/Otus/./HW3/build-linux-release/bin/allocator_driver
run: '${{ env.bin_path }}/${{ env.target_name }}'

- name: Build package
working-directory: /home/runner/work/Otus/Otus/./HW3/build-linux-release
run: cpack -G DEB
if: ${{ env.build_package }}
working-directory: ${{ env.hw_path }}
run: cpack -G DEB --preset ${{ env.package_preset }}

- name: Create Release
id: create_release
Expand All @@ -85,7 +87,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: /home/runner/work/Otus/Otus/./HW3/build-linux-release/bin/${{ env.target_name }}
asset_path: ${{ env.bin_path }}/${{ env.target_name }}
asset_name: ${{ env.target_name }}
asset_content_type: application/octet-stream

Expand All @@ -96,6 +98,6 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: /home/runner/work/Otus/Otus/./HW3/build-linux-release/deb/${{ env.target_name }}-${{ env.version }}-Linux.deb
asset_path: ${{ env.deb_path }}/${{ env.target_name }}-${{ env.version }}-Linux.deb
asset_name: ${{ env.target_name }}-${{ env.version }}-Linux.deb
asset_content_type: application/vnd.debian.binary-package
121 changes: 66 additions & 55 deletions HW3/CMakePresets.json
Original file line number Diff line number Diff line change
@@ -1,106 +1,117 @@
{
"version": 3,
"version": 6,
"configurePresets": [
{
"name": "base",
"hidden": true,
"binaryDir": "${sourceDir}/build-${presetName}",
"installDir": "${sourceDir}/install-${presetName}"
},
{
"name": "windows-base",
"name": "linux-base",
"displayName": "Linux x64 Debug",
"hidden": true,
"inherits": "base",
"generator": "Ninja",
"cacheVariables": {
"CMAKE_C_COMPILER": "cl.exe",
"CMAKE_CXX_COMPILER": "cl.exe"
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Linux"
},
"generator": "Unix Makefiles",
"binaryDir": "${sourceDir}/build/${presetName}",
"installDir": "${sourceDir}/build/install/${presetName}",
"architecture": {
"value": "x64",
"strategy": "external"
},
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Windows"
}
},
{
"name": "msvc-debug",
"displayName": "MSVC Debug",
"inherits": "windows-base",
"name": "linux-debug",
"displayName": "Linux x64 Debug",
"inherits": "linux-base",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug"
}
},
{
"name": "msvc-release",
"displayName": "MSVC Release",
"inherits": "windows-base",
"name": "linux-release",
"displayName": "Linux x64 Release",
"inherits": "linux-base",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release"
}
},
{
"name": "linux-base",
"name": "windows-base",
"hidden": true,
"inherits": "base",
"generator": "Unix Makefiles",
"cacheVariables": {
"CMAKE_C_COMPILER": "gcc",
"CMAKE_CXX_COMPILER": "g++"
},
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Linux"
"rhs": "Windows"
},
"generator": "Ninja",
"binaryDir": "${sourceDir}/build/${presetName}",
"installDir": "${sourceDir}/build/install/${presetName}",
"cacheVariables": {
"CMAKE_C_COMPILER": "cl.exe",
"CMAKE_CXX_COMPILER": "cl.exe"
},
"architecture": {
"value": "x64",
"strategy": "external"
}
},
{
"name": "linux-debug",
"displayName": "Linux Debug",
"inherits": "linux-base",
"name": "msvc-debug",
"displayName": "MSVC Debug",
"inherits": "windows-base",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug"
}
},
{
"name": "linux-release",
"displayName": "Linux Release",
"inherits": "linux-base",
"name": "msvc-release",
"displayName": "MSVC Release",
"inherits": "windows-base",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release"
}
}
],
"buildPresets": [
{
"name": "linux-build-base",
"hidden": true,
"configurePreset": "linux-release"
"name": "build-linux-base",
"hidden": true
},
{
"name": "linux-build-release",
"displayName": "Build Release",
"inherits": "linux-build-base",
"configurePreset": "linux-release"
"name": "build-linux-debug",
"displayName": "Build Linux Debug",
"inherits": "build-linux-base",
"configurePreset": "linux-debug"
},
{
"name": "build-linux-release",
"displayName": "Build Linux Release",
"inherits": "build-linux-base",
"configurePreset": "linux-release"
},
{
"name": "msvc-build-base",
"name": "build-msvc-base",
"hidden": true
},
{
"name": "msvc-build-release",
"displayName": "Build MSVC Release",
"inherits": "msvc-build-base",
"configurePreset": "msvc-release"
"name": "build-msvc-release",
"displayName": "Build MSVC Release",
"inherits": "build-msvc-base",
"configurePreset": "msvc-release"
},
{
"name": "msvc-build-debug",
"displayName": "Build MSVC Debug",
"inherits": "msvc-build-base",
"configurePreset": "msvc-debug"
"name": "build-msvc-debug",
"displayName": "Build MSVC Debug",
"inherits": "build-msvc-base",
"configurePreset": "msvc-debug"
}
]
],
"packagePresets": [
{
"name": "deb-package-release",
"configurePreset": "linux-release",
"generators": [
"DEB"
]
}
]
}
4 changes: 0 additions & 4 deletions HW3/build.bat

This file was deleted.

0 comments on commit 373a4d3

Please sign in to comment.