Skip to content

Commit

Permalink
fix: 完善构建安装逻辑
Browse files Browse the repository at this point in the history
  • Loading branch information
liufang-robot committed Jun 16, 2024
1 parent ac60f1a commit f0af5bc
Show file tree
Hide file tree
Showing 13 changed files with 134 additions and 27 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/linux_cpp_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
- name: Configure
run: cmake -S. -Bbuild -DBUILD_DEB=ON -DCLANG_FORMAT_CHECK=ON

- name: Build
- name: Build and pack
run: |
cmake --build build
cd build && cpack && cd ..
Expand Down
24 changes: 11 additions & 13 deletions .github/workflows/linux_cpp_release.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
name: Linux cpp release
run-name: ${{ github.actor }} Linux cpp release
on:
workflow_dispatch:
workflow_dispatch:
workflow_call:
push:
tags:
- v1.*.*
Expand Down Expand Up @@ -56,20 +57,17 @@ jobs:
id: deployment
uses: actions/deploy-pages@v1

# - name: upload .whl
# uses: actions/upload-artifact@v3
# with:
# name: WheelForPython
# path: ./build/python/dist/*.whl

- name: build deb pack
run: cpack --config ./build/CPackConfig.cmake

- name: upload .deb
- name: Build and pack
run: |
cmake --build build
cd build && cpack && cd ..
- name: Upload artifact
uses: actions/upload-artifact@v4
id: artifact
with:
name: DebForCPP
path: ./*.deb
name: lebai-linux-x64-deb
path: build/*.deb

# - name: release
# uses: ncipollo/release-action@v1
# with:
Expand Down
10 changes: 9 additions & 1 deletion .github/workflows/linux_dotnet_release.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
name: Linux dotnet release
run-name: ${{ github.actor }} Linux dotnet release
on:
workflow_dispatch:
workflow_dispatch:
workflow_call:
push:
tags:
- v1.*.*
Expand Down Expand Up @@ -34,3 +35,10 @@ jobs:
cd ./build/dotnet/packages;
dotnet nuget push lebai.runtime.linux-x64.1.*.*.nupkg --api-key ${{ secrets.NUGET_KEY }} --source https://api.nuget.org/v3/index.json;
dotnet nuget push lebai.1.*.*.nupkg --api-key ${{ secrets.NUGET_KEY }} --source https://api.nuget.org/v3/index.json;

- name: Upload artifact
uses: actions/upload-artifact@v4
id: artifact
with:
name: lebai-linux-x64-nupkg
path: build/dotnet/packages/*.nupkg
2 changes: 1 addition & 1 deletion .github/workflows/linux_python_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
run: ls wheelhouse/*

- name: Upload artifact
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v3
id: artifact
with:
name: lebai-linux-x64-whl
Expand Down
20 changes: 14 additions & 6 deletions .github/workflows/linux_python_release.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
name: Linux python release
run-name: ${{ github.actor }} Linux python release
on:
workflow_dispatch:
workflow_dispatch:
workflow_call:
push:
tags:
- v1.*.*
Expand All @@ -21,11 +22,11 @@ jobs:
uses: actions/checkout@v1
- run: for PYBIN in /opt/python/*/bin;do "${PYBIN}/pip" install -r requirements.txt; done;
- run: /opt/python/cp310-cp310/bin/pip install twine==2.0 urllib3==1.24. markdown
- name: configure
- name: Configure
run: cmake -S. -Bbuild -DBUILD_PYTHON=ON
- name: build
- name: Build
run: cmake --build build
- name: create-whl-dir
- name: Create-whl-dir
run: mkdir -p whl
- name: build with python
run: for PY in /opt/python/*;do
Expand All @@ -35,10 +36,17 @@ jobs:
cp build/python/dist/*.whl whl/;
done;

- name: repair
- name: Repair
run: for PYWHL in whl/*.whl;do
auditwheel repair ${PYWHL};
done;

- name: upload Pypi
- name: Upload Pypi
run: /opt/python/cp310-cp310/bin/twine upload --verbose --skip-existing -u __token__ -p ${{ secrets.PYLEBAI }} wheelhouse/*.whl

- name: Upload artifact
uses: actions/upload-artifact@v3
id: artifact
with:
name: lebai-linux-x64-whl
path: wheelhouse/*.whl
52 changes: 52 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Release lebai sdk
on:
push:
branches:
- master

jobs:
linux-cpp-x64:
uses: ./.github/workflows/linux_cpp_release.yml
linux-python-x64:
uses: ./.github/workflows/linux_python_release.yml
linux-dotnet-x64:
uses: ./.github/workflows/linux_dotnet_release.yml
release:
needs:
- linux-cpp-x64
- linux-python-x64
- linux-dotnet-x64
runs-on: ubuntu-latest
permissions:
contents: write
packages: write

steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: lebai-linux-x64-deb
- uses: actions/download-artifact@v4
with:
name: lebai-linux-x64-nupkg
- uses: actions/download-artifact@v4
with:
name: lebai-linux-x64-whl
- name: Display structure of downloaded files
run: ls -l
- name: Extract Project Version
id: extract_version
run: |
# Extract the project version from CMakeLists.txt
version=$(awk '/project\s*\(/,/)/' CMakeLists.txt | grep -Po 'VERSION\s*\K[0-9]+\.[0-9]+\.[0-9]+')
echo "version_tag=v$version" >> $GITHUB_ENV
- name: Create release
id: create_release
uses: ncipollo/release-action@v1
with:
tag: ${{ steps.extract_version.outputs.version_tag }}
allowUpdates: true
artifacts: |
*.exe,
*.deb
36 changes: 36 additions & 0 deletions .github/workflows/windows_cpp_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Windows cpp build
run-name: ${{ github.actor }} Windows cpp build
on:
workflow_dispatch:
workflow_call:
push:
tags:
- v1.*.*
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
pull-requests: read

jobs:
windows_cpp_build:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Check cmake
run: cmake --version
- name: Configure
run: cmake -S. -Bbuild -G "Visual Studio 17 2022" -DBUILD_NSIS=ON -DBUILD_DOCUMENTATION=OFF
- name: Build
run: cmake --build build --config Release
- name: Pack
run: cd build && cpack -C Release && cd ..
- name: Upload nsis package
uses: actions/upload-artifact@v4
id: artifact
with:
name: lebai-win-x64-exe
path: |
build/*.exe
3 changes: 2 additions & 1 deletion .github/workflows/windows_dotnet_release.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
name: Windows dotnet release
run-name: ${{ github.actor }} Windows dotnet release
on:
workflow_dispatch:
workflow_dispatch:
workflow_call:
push:
tags:
- v1.*.*
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/windows_python_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@ jobs:
uses: actions/upload-artifact@v4
id: artifact
with:
name: lebai-win-x64-python-whl
name: lebai-win-x64-whl
path: build/python/dist/*.whl
3 changes: 2 additions & 1 deletion .github/workflows/windows_python_release.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
name: Windows python release
run-name: ${{ github.actor }} Windows python release
on:
workflow_dispatch:
workflow_dispatch:
workflow_call:
push:
tags:
- v1.*.*
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ endif()

project(
lebai
VERSION 1.1.26
VERSION 1.1.27
LANGUAGES CXX)

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
Expand Down
2 changes: 1 addition & 1 deletion Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ PROJECT_NAME = "lebai sdk"
# could be handy for archiving the generated documentation or if some version
# control system is used.

PROJECT_NUMBER = 1.1.26
PROJECT_NUMBER = 1.1.27

# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
Expand Down
3 changes: 3 additions & 0 deletions doc/changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# ChangeLog

## 1.1.27
调整构建。

## 1.1.25
优化代码格式和构建。

Expand Down

0 comments on commit f0af5bc

Please sign in to comment.