修复 #3 ,添加 M芯片 iOS 模拟器 集成 ,修正 README.md 错误 #8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 编译 Simple 原生库 | |
on: | |
push: | |
branches: [ "simple-native" ] | |
pull_request: | |
branches: [ "simple-native" ] | |
workflow_dispatch: | |
env: | |
BUILD_TYPE: Release | |
BUILD_DIR: ${{ github.workspace }}/build | |
jobs: | |
Windows: | |
runs-on: windows-latest | |
env: | |
BUILD_ARCH: X64 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: 'CMake 编译,通过 VS16 生成器' | |
uses: lukka/run-cmake@v3 | |
with: | |
cmakeListsOrSettingsJson: CMakeListsTxtAdvanced | |
cmakeListsTxtPath: "${{ github.workspace }}/CMakeLists.txt" | |
buildDirectory: ${{ env.BUILD_DIR }} | |
useVcpkgToolchainFile: true | |
cmakeBuildType: ${{ env.BUILD_TYPE }} | |
buildWithCMake: true | |
cmakeGenerator: VS16Win64 | |
cmakeAppendedArgs: -A ${{ env.BUILD_ARCH }} | |
buildWithCMakeArgs: --config ${{ env.BUILD_TYPE }} | |
- name: '上传编译产物' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: windows | |
path: "${{ env.BUILD_DIR }}/_deps/simple-build/src/${{ env.BUILD_TYPE }}/simple.dll" | |
if-no-files-found: error | |
retention-days: 90 | |
compression-level: 0 | |
overwrite: true | |
MacOS: | |
runs-on: macos-latest | |
env: | |
BUILD_FILE_PATH: _deps/simple-build/src/libsimple.dylib | |
steps: | |
- uses: actions/checkout@v4 | |
- name: '[MacOS] CMake 编译' | |
uses: lukka/run-cmake@v3 | |
with: | |
cmakeListsOrSettingsJson: CMakeListsTxtAdvanced | |
cmakeListsTxtPath: '${{ github.workspace }}/CMakeLists.txt' | |
buildDirectory: ${{ env.BUILD_DIR }} | |
cmakeBuildType: ${{ env.BUILD_TYPE }} | |
buildWithCMake: true | |
buildWithCMakeArgs: --config ${{ env.BUILD_TYPE }} | |
- name: '[MacOS] 查看架构' | |
run: file ${{ env.BUILD_FILE_PATH }} | |
working-directory: ${{ env.BUILD_DIR }} | |
- name: '[MacOS] 上传编译产物' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: macos | |
if-no-files-found: error | |
path: "${{ env.BUILD_DIR }}/${{ env.BUILD_FILE_PATH }}" | |
retention-days: 90 | |
compression-level: 0 | |
overwrite: true | |
iOS: | |
runs-on: macos-latest | |
env: | |
BUILD_NAME: ios | |
BUILD_FILE_PATH: libsimple.a | |
strategy: | |
matrix: | |
cfg: | |
- { label: "iOS", simulator: "" } | |
- { label: "iOS 模拟器", simulator: "-simulator" } | |
steps: | |
- uses: actions/checkout@v4 | |
- name: '[${{ matrix.cfg.label }}] CMake 编译' | |
run: | | |
./build-ios.sh ${{ matrix.cfg.simulator }} | |
echo "BUILD_NAME=ios${{ matrix.cfg.simulator }}" >> $GITHUB_ENV | |
echo "BUILD_FILE_PATH=libsimple${{ matrix.cfg.simulator }}.a" >> $GITHUB_ENV | |
working-directory: ${{ github.workspace }} | |
- name: '[${{ matrix.cfg.label }}] 查看架构' | |
run: | | |
mv ${{ env.BUILD_NAME }}-output/bin/libsimple.a ${{ env.BUILD_FILE_PATH }} | |
file ${{ env.BUILD_FILE_PATH }} | |
working-directory: ${{ github.workspace }} | |
- name: '[${{ matrix.cfg.label }}] 上传编译产物' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.BUILD_NAME }} | |
if-no-files-found: error | |
path: ${{ github.workspace }}/${{ env.BUILD_FILE_PATH }} | |
retention-days: 90 | |
compression-level: 0 | |
overwrite: true |