Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update workflow optimize #4

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 23 additions & 32 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,45 +74,40 @@ jobs:
uses: andstor/file-existence-action@v3
with:
allow_failure: true
files: "${{ github.workspace }}/../../_temp/windows/src/${{ steps.build_type.outputs.BUILD_TYPE }}/simple.dll, ${{ github.workspace }}/../../_temp/windows/cppjieba/src/cppjieba/dict/jieba.dict.utf8"
files: "${{ github.workspace }}/build/src/${{ steps.build_type.outputs.BUILD_TYPE }}/simple.dll, ${{ github.workspace }}/build/cppjieba/src/cppjieba/dict/jieba.dict.utf8"

# can't build
# npm run
# - uses: actions/setup-node@v2
# - uses: actions/setup-node@v4
# with:
# node-version: '16'
# node-version: '20'
# - name: run node example
# working-directory: ./examples/node/
# run: |
# npm install
# npm run p -- --ext_path="${{ github.workspace }}/../../_temp/windows/src/${{ steps.build_type.outputs.BUILD_TYPE }}/" --dict_path="${{ github.workspace }}/../../_temp/windows/cppjieba/src/cppjieba/dict/"

# - name: 'Run CTest'
# run: ctest -C ${{ env.BUILD_TYPE }}
# working-directory: "${{ github.workspace }}/../../_temp/windows"
# npm run p -- --ext_path="${{ github.workspace }}/build/src/" --dict_path="${{ github.workspace }}/build/test/dict/"

# python run
# - uses: actions/setup-python@v4
# with:
# python-version: '3.x' # Version range or exact version of a Python version to use, using SemVer's version range syntax
# - name: run python example
# working-directory: ./examples/python3/
# run: python db_connector.py "${{ github.workspace }}/../../_temp/windows/src/${{ steps.build_type.outputs.BUILD_TYPE }}/simple"
- uses: actions/setup-python@v5
with:
python-version: '3.10.8' # Version need < 3.11 https://github.com/actions/setup-python/issues/540
- name: run python example
working-directory: ./examples/python3/
run: python db_connector.py "${{ github.workspace }}/build/src/${{ steps.build_type.outputs.BUILD_TYPE }}/simple.dll"

- name: Package
if: startsWith(github.ref, 'refs/tags/')
run: |
mkdir libsimple-windows-${{ matrix.arch }}
Copy-Item -Path src/${{ steps.build_type.outputs.BUILD_TYPE }}/simple.dll,cppjieba/src/cppjieba/dict/ -Destination libsimple-windows-${{ matrix.arch }}/ -Recurse
Compress-Archive -Path libsimple-windows-${{ matrix.arch }} -DestinationPath libsimple-windows-${{ matrix.arch }}.zip
working-directory: "${{ github.workspace }}/../../_temp/windows/"
working-directory: "${{ github.workspace }}/build/"
- name: Release
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v1
with:
draft: true
files: "D:/a/_temp/windows/libsimple-windows-${{ matrix.arch }}.zip"
# files: "${{ github.workspace }}/../../_temp/windows/libsimple-windows-${{ matrix.arch }}.zip"
files: "D:/a/build/libsimple-windows-${{ matrix.arch }}.zip"
# files: "${{ github.workspace }}/build/libsimple-windows-${{ matrix.arch }}.zip"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand Down Expand Up @@ -298,36 +293,32 @@ jobs:

- name: 'Run CTest'
run: ctest -C ${{ env.BUILD_TYPE }}
working-directory: "${{ github.workspace }}/../../_temp/macos"
working-directory: "${{ github.workspace }}/build"

- name: "Check file existence"
uses: andstor/file-existence-action@v3
with:
allow_failure: true
files: "${{ github.workspace }}/../../_temp/macos/src/libsimple.dylib, ${{ github.workspace }}/../../_temp/macos/test/dict/jieba.dict.utf8"
files: "${{ github.workspace }}/build/src/libsimple.dylib, ${{ github.workspace }}/build/test/dict/jieba.dict.utf8"

# npm run
- uses: actions/setup-node@v4
with:
node-version: '20'

# - uses: actions/setup-python@v5
# with:
# python-version: '3.12' # Version range or exact version of a Python version to use, using SemVer's version range syntax
# npm run
- name: run node example
working-directory: ./examples/node/
run: |
brew install python-setuptools
npm install
npm run p -- --ext_path="${{ github.workspace }}/../../_temp/macos/src/" --dict_path="${{ github.workspace }}/../../_temp/macos/test/dict/"
# don't run this as it's toooo slow
# npm run b -- --ext_path="${{ github.workspace }}/../../_temp/macos/src/" --dict_path="${{ github.workspace }}/../../_temp/macos/test/dict/"
npm run p -- --ext_path="${{ github.workspace }}/build/src/" --dict_path="${{ github.workspace }}/build/test/dict/"

# python run
# - uses: actions/setup-python@v5
# with:
# python-version: '3.10.8' # Version need < 3.11 https://github.com/actions/setup-python/issues/540
# - name: run python example
# working-directory: ./examples/python3/
# run: |
# python db_connector.py "${{ github.workspace }}/../../_temp/macos/src/libsimple"
# run: python db_connector.py "${{ github.workspace }}/build/src/libsimple"

- name: Package
if: startsWith(github.ref, 'refs/tags/')
Expand All @@ -336,14 +327,14 @@ jobs:
sudo xattr -r -d com.apple.quarantine src/libsimple.dylib
cp -r src/libsimple.dylib test/dict libsimple-osx-x64/
zip -r libsimple-osx-x64.zip libsimple-osx-x64
working-directory: "${{ github.workspace }}/../../_temp/macos"
working-directory: "${{ github.workspace }}/build"

- name: Release
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v1
with:
draft: true
files: "${{ github.workspace }}/../../_temp/macos/libsimple-osx-x64.zip"
files: "${{ github.workspace }}/build/libsimple-osx-x64.zip"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand Down
7 changes: 3 additions & 4 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@
"displayName": "macOS Ninja",
"description": "Configure for macOS build",
"generator": "Ninja",
"binaryDir": "${sourceDir}/../../_temp/macos",
"binaryDir": "${sourceDir}/build",
"cacheVariables": {
"CMAKE_INSTALL_PREFIX": {
"type": "PATH",
"value": "${sourceDir}/../../_temp/macos/install"
"value": "${sourceDir}/build/install"
}
}
},
Expand All @@ -74,8 +74,7 @@
"description": "Configure with VS17 and vcpkg toolchain",
"generator": "Visual Studio 17 2022",
"architecture": "x64",
"toolset": "v143",
"binaryDir": "${sourceDir}/../../_temp/windows",
"binaryDir": "${sourceDir}/build",
"cacheVariables": {
"CMAKE_TOOLCHAIN_FILE": {
"type": "FILEPATH",
Expand Down
Loading