diff --git a/.github/workflows/common-build.yml b/.github/workflows/common-build.yml index 196bff7..fd56660 100644 --- a/.github/workflows/common-build.yml +++ b/.github/workflows/common-build.yml @@ -8,7 +8,17 @@ on: jobs: build: - runs-on: ${{ inputs.os }} + strategy: + matrix: + include: + - os: windows-latest + exec_ext: .exe + - os: ubuntu-latest + exec_ext: '' + - os: macos-latest + exec_ext: '' + + runs-on: ${{ matrix.os }} steps: - name: Checkout cpp-oasvalidator uses: actions/checkout@v4 @@ -22,22 +32,13 @@ jobs: uses: lukka/run-cmake@v10 id: runcmake with: - workflowPreset: 'build-test-and-example' - testPresets: 'run-oasvalidator-unittests' + workflowPreset: 'build-example-and-run-unittests' - - name: Run Example - run: | - if ($env:RUNNER_OS -eq "Windows") { - build/release/example/oasvalidator-example.exe - } else { - build/release/example/oasvalidator-example - } + - name: Run Unit Tests + run: build/release/test/unittest/oasvalidator-unittests${{ matrix.exec_ext }} + - name: Run Example + run: build/release/example/oasvalidator-example${{ matrix.exec_ext }} - name: Run Performance Tests - run: | - if [ "${{ runner.os }}" == "Windows" ]; then - build/release/test/perftest/oasvalidator-perftests.exe - else - build/release/test/perftest/oasvalidator-perftests - fi \ No newline at end of file + run: build/release/test/perftest/oasvalidator-perftests${{ matrix.exec_ext }} diff --git a/CMakePresets.json b/CMakePresets.json index 879dcdf..93b4dc0 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -104,8 +104,8 @@ ] }, { - "name": "build-test-and-example", - "displayName": "Build oasvalidator, unittest, perftests and example in Release mode", + "name": "build-example-and-run-unittests", + "displayName": "Build oasvalidator, unittest, perftests and example in Release mode and run unittests", "steps": [ { "type": "configure", @@ -122,6 +122,10 @@ { "type": "build", "name": "tests-build" + }, + { + "type": "test", + "name": "run-oasvalidator-unittests" } ] }