# Copyright Advanced Micro Devices, Inc. # SPDX-License-Identifier: MIT name: Unit Tests on: push: branches: - main - release/therock-* pull_request: workflow_dispatch: permissions: contents: read jobs: unit_tests: name: "Unit Tests :: ${{ matrix.runs-on}}" strategy: fail-fast: false matrix: runs-on: [ubuntu-24.04, windows-2022] runs-on: ${{ matrix.runs-on }} defaults: run: shell: bash env: GITHUB_TOKEN: ${{ github.token }} steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 with: python-version: 3.12 - name: Install python deps run: pip install -r requirements-test.txt # Note: build_tools/github_actions/ contains complicated tests in some # subdirectories that do not support pytest: # build_tools/github_actions/benchmarks/scripts/ # build_tools/github_actions/test_executable_scripts/ # We could move them if we want a simple `pytest build_tools/` to work. - name: Test build_tools working-directory: build_tools run: | python -m pytest -vv \ --cov --cov-report=term-missing --cov-report=html - name: Test scan_tools working-directory: build_tools/scan_tools run: python -m pytest -vv # TODO: upload to AWS S3 instead (so reports are hosted and don't require # a download step to view). # We could also use https://about.codecov.io/ instead of custom infra. - name: Upload coverage report if: always() uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 with: name: coverage-report-${{ matrix.runs-on }} path: build/coverage-html/ unit_tests_summary: name: Unit Tests Summary if: always() needs: - unit_tests runs-on: ubuntu-24.04 steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - name: Evaluate workflow results env: GITHUB_TOKEN: ${{ github.token }} run: | python build_tools/github_actions/workflow_summary.py \ --needs-json '${{ toJSON(needs) }}'