added: CI via Github Actions
This commit is contained in:
95
.github/workflows/release.yml
vendored
Normal file
95
.github/workflows/release.yml
vendored
Normal file
@@ -0,0 +1,95 @@
|
|||||||
|
name: release
|
||||||
|
|
||||||
|
on: workflow_dispatch
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
create-new-release:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
outputs:
|
||||||
|
assets_url: ${{ steps.create-release.outputs.upload_url }}
|
||||||
|
steps:
|
||||||
|
- name: Create release
|
||||||
|
id: create-release
|
||||||
|
uses: actions/create-release@v1
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
with:
|
||||||
|
tag_name: ${{ github.run_number }}
|
||||||
|
release_name: Release 1
|
||||||
|
draft: true
|
||||||
|
release-win64:
|
||||||
|
runs-on: windows-latest
|
||||||
|
needs: create-new-release
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
outputs:
|
||||||
|
assets_url: ${{ steps.create-release.outputs.upload_url }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Install MSVC
|
||||||
|
uses: ilammy/msvc-dev-cmd@v1
|
||||||
|
- name: Install Python
|
||||||
|
uses: actions/setup-python@v5
|
||||||
|
with:
|
||||||
|
python-version: '3.12'
|
||||||
|
- name: Install CMake
|
||||||
|
uses: lukka/get-cmake@latest
|
||||||
|
- name: Init submodules
|
||||||
|
run: git submodule update --init --recursive
|
||||||
|
- name: Build CPython libraries
|
||||||
|
run: dependencies/cpython/PCbuild/build.bat
|
||||||
|
- name: CMake - Configure
|
||||||
|
run: cmake . --preset Windows-x64-Release -DCMAKE_BUILD_TYPE="Release" -DCOUT_FILE_SUFFIX="x64"
|
||||||
|
- name: CMake - Build
|
||||||
|
run: cmake --build --preset Windows-x64-Release
|
||||||
|
- name: Archive output files
|
||||||
|
run: Compress-Archive -Path "out/build/Windows-x64-Release/lib", "g2o", "out/build/Windows-x64-Release/PyG2O.x64.dll", "out/build/Windows-x64-Release/python312.dll" -Destination Windows-x64-Release.zip
|
||||||
|
- name: Upload release
|
||||||
|
uses: actions/upload-release-asset@v1
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
with:
|
||||||
|
upload_url: ${{ needs.create-new-release.outputs.assets_url }}
|
||||||
|
asset_path: ./Windows-x64-Release.zip
|
||||||
|
asset_name: Windows-x64-Release.zip
|
||||||
|
asset_content_type: application/zip
|
||||||
|
release-arm64:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: create-new-release
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Install Python
|
||||||
|
uses: actions/setup-python@v5
|
||||||
|
with:
|
||||||
|
python-version: '3.12-dev'
|
||||||
|
- name: Install CMake
|
||||||
|
uses: lukka/get-cmake@latest
|
||||||
|
- name: Init submodules
|
||||||
|
run: git submodule update --init --recursive
|
||||||
|
- name: CMake - Configure
|
||||||
|
run: cmake . --preset Linux-x64-Release -DCMAKE_BUILD_TYPE="Release" -DCOUT_FILE_SUFFIX="x64"
|
||||||
|
- name: CMake - Build
|
||||||
|
run: cmake --build --preset Linux-x64-Release
|
||||||
|
- name: Move release files
|
||||||
|
run: |
|
||||||
|
mv out/build/Linux-x64-Release/lib ./
|
||||||
|
mv out/build/Linux-x64-Release/PyG2O.x64.so ./
|
||||||
|
- name: Archive files
|
||||||
|
uses: montudor/action-zip@v1
|
||||||
|
with:
|
||||||
|
args: zip -r Linux-x64-Release.zip g2o lib PyG2O.x64.so
|
||||||
|
- name: Upload release
|
||||||
|
uses: actions/upload-release-asset@v1
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
with:
|
||||||
|
upload_url: ${{ needs.create-new-release.outputs.assets_url }}
|
||||||
|
asset_path: ./Linux-x64-Release.zip
|
||||||
|
asset_name: Linux-x64-Release.zip
|
||||||
|
asset_content_type: application/zip
|
||||||
@@ -57,8 +57,8 @@ if(MSVC)
|
|||||||
else()
|
else()
|
||||||
set(CPYTHON_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/dependencies/cpython/Include ${CMAKE_SOURCE_DIR}/dependencies/cpython)
|
set(CPYTHON_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/dependencies/cpython/Include ${CMAKE_SOURCE_DIR}/dependencies/cpython)
|
||||||
set(CPYTHON_LIBRARY_DIR ${CMAKE_SOURCE_DIR}/dependencies/cpython)
|
set(CPYTHON_LIBRARY_DIR ${CMAKE_SOURCE_DIR}/dependencies/cpython)
|
||||||
set(CPYTHON_LIBRARY python3.12m)
|
set(CPYTHON_LIBRARY python3.12)
|
||||||
set(CPYTHON_BIN ${CMAKE_SOURCE_DIR}/dependencies/dependencies/libpython3.12m.so)
|
set(CPYTHON_BIN /opt/hostedtoolcache/Python/3.12.7/x64/lib/libpython3.12.so)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
file(GLOB_RECURSE SOURCE
|
file(GLOB_RECURSE SOURCE
|
||||||
@@ -111,7 +111,7 @@ if(DEFINED OUT_FILE_SUFFIX)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_subdirectory(dependencies)
|
add_subdirectory(dependencies)
|
||||||
target_link_libraries(${PROJECT_NAME} ${CPYTHON_LIBRARY})
|
target_link_libraries(${PROJECT_NAME} PRIVATE ${CPYTHON_LIBRARY})
|
||||||
target_link_libraries(${PROJECT_NAME} PRIVATE pybind11::embed)
|
target_link_libraries(${PROJECT_NAME} PRIVATE pybind11::embed)
|
||||||
|
|
||||||
# Copy Python DLL to the build folder if different
|
# Copy Python DLL to the build folder if different
|
||||||
|
|||||||
Reference in New Issue
Block a user