diff --git a/.github/workflows/cmake-multi-platform.yml b/.github/workflows/cmake-multi-platform.yml index cbf15564..af090149 100644 --- a/.github/workflows/cmake-multi-platform.yml +++ b/.github/workflows/cmake-multi-platform.yml @@ -13,11 +13,14 @@ concurrency: cancel-in-progress: true jobs: - build: + build_and_test: + name: Build and Test ${{ matrix.os }} - ${{ matrix.build_type }} - ${{ matrix.python-version }} + runs-on: ${{ matrix.os }} strategy: - # Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable. + # Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. + # Consider changing this to true when your workflow is stable. fail-fast: false # Set up a matrix to run the following 3 configurations: @@ -28,6 +31,7 @@ jobs: # To add more build types (Release, Debug, RelWithDebInfo, etc.) customize the build_type list. matrix: os: [ubuntu-latest, macos-latest, windows-latest] + python-version: ['3.13'] build_type: [RelWithDebInfo] c_compiler: [clang, cl] include: @@ -54,6 +58,12 @@ jobs: - os: macos-latest c_compiler: cl + env: + ALLURE_RESULTS_PATH: 'build/${{ matrix.os }}_${{ matrix.python-version }}/allure-results' + ALLURE_REPORTS_PATH: 'build/${{ matrix.os }}_${{ matrix.python-version }}/allure-reports' + COVERAGE_REPORT_PATH: 'build/${{ matrix.os }}_${{ matrix.python-version }}/python-coverage-report' + PYTHONPATH: .:build/python:$PYTHONPATH + steps: - uses: actions/checkout@v4 @@ -148,104 +158,83 @@ jobs: run: build/gen_tech_pb working-directory: ${{github.workspace}} - - name: "[C++] Store Build Products" - uses: actions/upload-artifact@v4 + # - name: "[C++] Store Build Products" + # uses: actions/upload-artifact@v4 + # with: + # name: ${{ github.job }}-${{ matrix.os }} # -${{ matrix.build_type }} + # # Generated Python Protobuffer Classes + # # KPEX Tech Info Protobuffers + # path: | + # ${{github.workspace}}/build/python_kpex_protobuf/ + # ${{github.workspace}}/build/*_tech.pb.json + # if-no-files-found: error + # + # - name: "[Python] Retrieve C++ Build Artifact" + # uses: actions/download-artifact@v4 + # with: + # name: build-${{ matrix.os }} + + - name: "[Python] Setup python ${{ matrix.python-version }}" + id: setup-python + uses: actions/setup-python@v5 with: - name: ${{ github.job }}-${{ matrix.os }} # -${{ matrix.build_type }} - # Generated Python Protobuffer Classes - # KPEX Tech Info Protobuffers - path: | - ${{github.workspace}}/build/python_kpex_protobuf/ - ${{github.workspace}}/build/*_tech.pb.json - if-no-files-found: error - - test: - needs: build - - strategy: - # fail-fast: true - matrix: - os: [ubuntu-latest, macos-latest] - python-version: ['3.13'] + python-version: ${{ matrix.python-version }} - runs-on: ${{ matrix.os }} - - env: - ALLURE_RESULTS_PATH: 'build/${{ matrix.os }}_${{ matrix.python-version }}/allure-results' - ALLURE_REPORTS_PATH: 'build/${{ matrix.os }}_${{ matrix.python-version }}/allure-reports' - COVERAGE_REPORT_PATH: 'build/${{ matrix.os }}_${{ matrix.python-version }}/python-coverage-report' - PYTHONPATH: .:build/python:$PYTHONPATH - - steps: - - name: "[Python] checkout repository" - uses: actions/checkout@v4 - - - name: "[Python] Retrieve C++ Build Artifact" - uses: actions/download-artifact@v4 - with: - name: build-${{ matrix.os }} - - - name: "[Python] Setup python ${{ matrix.python-version }}" - id: setup-python - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - - #---------------------------------------------- - # ----- install & configure poetry ----- - #---------------------------------------------- - - name: "[Python] Install Poetry" - uses: snok/install-poetry@v1 - with: - virtualenvs-create: true - virtualenvs-in-project: true - virtualenvs-path: .venv - installer-parallel: true - - #---------------------------------------------- - # load cached venv if cache exists - #---------------------------------------------- - - name: "[Python] Load cached venv" - id: cached-poetry-dependencies - uses: actions/cache@v4 - with: - path: .venv - key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} - - #---------------------------------------------- - # install dependencies if cache does not exist - #---------------------------------------------- - - name: "[Python] Install dependencies" - if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' - run: poetry install --no-interaction --no-root + - name: "[Python] Install Poetry" + uses: snok/install-poetry@v1 + with: + virtualenvs-create: true + virtualenvs-in-project: true + virtualenvs-path: .venv + installer-parallel: true + + - name: "[Python] Load cached venv" + id: cached-poetry-dependencies + uses: actions/cache@v4 + with: + path: .venv + key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} - #---------------------------------------------- - # install your root project, if required - #---------------------------------------------- - - name: "[Python] Install project" - run: poetry install --no-interaction + - name: "[Python] Install dependencies" + if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' + run: poetry install --no-interaction --no-root - #---------------------------------------------- - # run test suite - #---------------------------------------------- - - name: "[Python] Run tests" - run: > - poetry run pytest - --alluredir $ALLURE_RESULTS_PATH - --color no - --cov $COVERAGE_REPORT_PATH - --cov-report html - - - name: "[Python] Create coverage report" - run: poetry run coverage report + - name: "[Python] Install project" + run: poetry install --no-interaction + + - name: "[Python] Run Unit tests" + run: > + poetry run pytest + --alluredir $ALLURE_RESULTS_PATH + --color no + --cov $COVERAGE_REPORT_PATH + --cov-report html - - name: "[Python] Store coverage results" - uses: actions/upload-artifact@v4 - with: - name: python-coverage-report - path: $COVERAGE_REPORT_PATH - retention-days: 1 + - name: "[Python] Create coverage report" + run: poetry run coverage report + - name: "[Python] Store coverage results" + uses: actions/upload-artifact@v4 + with: + name: upload-python-coverage-report + path: $COVERAGE_REPORT_PATH + retention-days: 1 + if-no-files-found: error + + - name: "[Python] Store allure test results" + uses: actions/upload-artifact@v4 + with: + name: upload-python-allure-report + path: $ALLURE_RESULTS_PATH + retention-days: 1 + + allure-report: + name: "Generate Allure Report (Aggregated Suites)" + needs: build_and_test + + runs-on: ubuntu-latest + + steps: - name: "Set up JDK (for Allure)" uses: actions/setup-java@v3 with: