ci: add multi-platform (Windows, Mac, ARM64) support for GHA #8
This file contains hidden or 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: Build and Test | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| pull_request: | |
| branches: [ "main" ] | |
| jobs: | |
| generate-data: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| with: | |
| submodules: recursive | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.10' | |
| - name: Install dependencies | |
| run: | | |
| pip install modelscope transformers | |
| - name: Generate Tests Data | |
| run: | | |
| cd tests | |
| python generate_assets.py | |
| - name: Upload models | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: models | |
| path: tests/models/ | |
| build-and-test: | |
| needs: generate-data | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest, ubuntu-24.04-arm64] | |
| ujson_use_rapidjson: ["OFF", "ON"] | |
| runs-on: ${{ matrix.os }} | |
| name: build-test (${{ matrix.os }}, RapidJSON=${{ matrix.ujson_use_rapidjson }}) | |
| steps: | |
| - uses: actions/checkout@v3 | |
| with: | |
| submodules: recursive | |
| - name: Download models | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: models | |
| path: tests/models/ | |
| - name: Install build dependencies (Linux) | |
| if: runner.os == 'Linux' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y cmake g++ | |
| - name: Configure | |
| run: | | |
| cmake -B build -DCMAKE_BUILD_TYPE=Release -DUJSON_USE_RAPIDJSON=${{ matrix.ujson_use_rapidjson }} | |
| - name: Build | |
| run: | | |
| cmake --build build --config Release -j 4 | |
| - name: Run Tests | |
| shell: bash | |
| run: | | |
| cd build | |
| if [[ "${{ runner.os }}" == "Windows" ]]; then | |
| ./Release/test_main | |
| else | |
| ./test_main | |
| fi |