chore: silence warning #44
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 | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| build: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: macos-latest | |
| name: macos-arm64 | |
| artifact: cyaml-macos-arm64 | |
| - os: macos-latest | |
| name: macos-x64 | |
| artifact: cyaml-macos-x64 | |
| cmake_arch: x86_64 | |
| - os: ubuntu-latest | |
| name: linux-x64 | |
| artifact: cyaml-linux-x64 | |
| - os: ubuntu-24.04-arm | |
| name: linux-arm64 | |
| artifact: cyaml-linux-arm64 | |
| - os: windows-latest | |
| name: windows-x64 | |
| artifact: cyaml-windows-x64 | |
| arch: x64 | |
| - os: windows-11-arm | |
| name: windows-arm64 | |
| artifact: cyaml-windows-arm64 | |
| arch: ARM64 | |
| runs-on: ${{ matrix.os }} | |
| name: ${{ matrix.name }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Setup test suite (Unix) | |
| if: "!startsWith(matrix.os, 'windows')" | |
| run: | | |
| cd refs/yaml-test-suite | |
| git fetch origin data:data | |
| make data | |
| - name: Setup test suite (Windows) | |
| if: startsWith(matrix.os, 'windows') | |
| run: | | |
| cd refs/yaml-test-suite | |
| git fetch origin data:data | |
| make data | |
| shell: bash | |
| - name: Restore test results cache | |
| if: matrix.name == 'linux-x64' | |
| uses: actions/cache/restore@v4 | |
| with: | |
| path: build/.cyaml_suite_results | |
| key: test-results-${{ github.sha }} | |
| restore-keys: | | |
| test-results- | |
| - name: Build (Unix) | |
| if: "!startsWith(matrix.os, 'windows')" | |
| run: | | |
| CMAKE_ARGS="-DCMAKE_BUILD_TYPE=Debug" | |
| if [ -n "${{ matrix.cmake_arch }}" ]; then | |
| CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_OSX_ARCHITECTURES=${{ matrix.cmake_arch }}" | |
| elif [[ "$OSTYPE" == darwin* ]]; then | |
| CMAKE_ARGS="$CMAKE_ARGS -DCYAML_ENABLE_ASAN=ON -DCYAML_ENABLE_UBSAN=ON" | |
| fi | |
| cmake -B build $CMAKE_ARGS | |
| cmake --build build -j$(nproc 2>/dev/null || sysctl -n hw.ncpu) | |
| - name: Build (Windows) | |
| if: startsWith(matrix.os, 'windows') | |
| run: | | |
| cmake -S . -B build -A ${{ matrix.arch }} | |
| cmake --build build --config Debug | |
| - name: Test (Unix) | |
| if: "!startsWith(matrix.os, 'windows')" | |
| run: | | |
| cd build | |
| ./cyaml_suite ../refs/yaml-test-suite/data | |
| ./ypath_test ../refs/ypath/tests.yml | |
| ./test_api | |
| - name: Test (Windows) | |
| if: startsWith(matrix.os, 'windows') | |
| working-directory: build | |
| run: | | |
| .\Debug\cyaml_suite.exe ..\refs\yaml-test-suite\data | |
| .\Debug\ypath_test.exe ..\refs\ypath\tests.yml | |
| .\Debug\test_api.exe | |
| - name: Generate summary (Unix) | |
| if: "!startsWith(matrix.os, 'windows') && always()" | |
| run: cd build && ./summary_gen >> $GITHUB_STEP_SUMMARY | |
| - name: Generate summary (Windows) | |
| if: startsWith(matrix.os, 'windows') && always() | |
| working-directory: build | |
| run: .\Debug\summary_gen.exe >> $env:GITHUB_STEP_SUMMARY | |
| shell: pwsh | |
| - name: Save test results cache | |
| if: matrix.name == 'linux-x64' && github.ref == 'refs/heads/main' | |
| uses: actions/cache/save@v4 | |
| with: | |
| path: build/.cyaml_suite_results | |
| key: test-results-${{ github.sha }} | |
| - name: Package (macOS) | |
| if: startsWith(matrix.os, 'macos') | |
| run: | | |
| mkdir -p dist/lib dist/include | |
| cp src/cyaml.h dist/include/ | |
| cp build/libcyaml.a dist/lib/ | |
| cp build/libcyaml.dylib dist/lib/ 2>/dev/null || true | |
| - name: Package (Linux) | |
| if: startsWith(matrix.os, 'ubuntu') | |
| run: | | |
| mkdir -p dist/lib dist/include | |
| cp src/cyaml.h dist/include/ | |
| cp build/libcyaml.a dist/lib/ | |
| cp build/libcyaml.so* dist/lib/ 2>/dev/null || true | |
| - name: Package (Windows) | |
| if: startsWith(matrix.os, 'windows') | |
| run: | | |
| New-Item -ItemType Directory -Force -Path dist\lib | |
| New-Item -ItemType Directory -Force -Path dist\include | |
| Copy-Item src\cyaml.h dist\include\ | |
| Copy-Item build\Debug\cyaml.lib dist\lib\ -ErrorAction SilentlyContinue | |
| Copy-Item build\Debug\cyaml.dll dist\lib\ -ErrorAction SilentlyContinue | |
| Copy-Item build\Debug\cyaml.pdb dist\lib\ -ErrorAction SilentlyContinue | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.artifact }} | |
| path: dist/ |