Some cleanup and improvements, added benchmarks. #120
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: CMake | |
| on: | |
| push: | |
| branches: ["main"] | |
| pull_request: | |
| branches: ["main"] | |
| env: | |
| BUILD_TYPE: Release | |
| jobs: | |
| format-check: | |
| name: Format Check | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: jidicula/clang-format-action@v4.13.0 | |
| with: | |
| clang-format-version: "17" | |
| exclude-regex: "(third_party)" | |
| build: | |
| strategy: | |
| matrix: | |
| os: [ ubuntu-latest, macos-latest, windows-latest ] | |
| runs-on: ${{ matrix.os }} | |
| continue-on-error: true | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Install Packages (Ubuntu) | |
| if: matrix.os == 'ubuntu-latest' | |
| run: sudo apt-get install -y uuid-dev | |
| - name: Configure CMake | |
| run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -Dflow-core_BUILD_TESTS=ON -Dflow-core_BUILD_BENCHMARKS=ON | |
| - name: Build | |
| run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --parallel 10 | |
| - name: Upload Artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: Test Module (${{matrix.os}}) | |
| path: ${{github.workspace}}/build/tests/test_module.fmod | |
| - name: Cache Build Output | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{github.workspace}}/build | |
| key: ${{matrix.os}}-build-${{github.sha}} | |
| test: | |
| needs: build | |
| strategy: | |
| matrix: | |
| os: [ ubuntu-latest, macos-latest, windows-latest ] | |
| runs-on: ${{ matrix.os }} | |
| continue-on-error: true | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Restore build output cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{github.workspace}}/build | |
| key: ${{matrix.os}}-build-${{github.sha}} | |
| - name: Test | |
| working-directory: ${{github.workspace}}/build | |
| run: ctest -C ${{env.BUILD_TYPE}} --output-on-failure | |
| benchmark: | |
| needs: build | |
| strategy: | |
| matrix: | |
| os: [ ubuntu-latest, macos-latest, windows-latest ] | |
| runs-on: ${{ matrix.os }} | |
| continue-on-error: true | |
| timeout-minutes: 10 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Restore build output cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{github.workspace}}/build | |
| key: ${{matrix.os}}-build-${{github.sha}} | |
| - name: Benchmark | |
| run: | | |
| ls -al ${{github.workspace}}/build | |
| ${{github.workspace}}/build/benchmarks/flow_core_bench | |
| cleanup_cache: | |
| needs: [test, benchmark] | |
| strategy: | |
| matrix: | |
| os: [ ubuntu-latest, macos-latest, windows-latest ] | |
| runs-on: ${{ matrix.os }} | |
| continue-on-error: true | |
| timeout-minutes: 10 | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| GH_REPO: ${{ github.repository }} | |
| if: always() # Run even if previous jobs failed | |
| steps: | |
| - name: Delete Cache | |
| run: | | |
| gh cache delete ${{matrix.os}}-build-${{github.sha}} |