Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -251,11 +251,11 @@ jobs:
gen_code_coverage:
name: Gen code coverage
needs: [metadata, config_devdeps]
if: false
if: github.event_name != 'merge_group'
strategy:
matrix:
platform: [amd64]
fail-fast: ${{ github.event_name == 'merge_group' }}
fail-fast: false
uses: ./.github/workflows/generate_cc.yml
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
Expand All @@ -265,6 +265,7 @@ jobs:
devdeps_cache: ${{ fromJson(needs.config_devdeps.outputs.json).cache_key[format('{0}-llvm', matrix.platform)] }}
devdeps_archive: ${{ fromJson(needs.config_devdeps.outputs.json).tar_archive[format('{0}-llvm', matrix.platform)] }}
export_environment: ${{ github.event_name == 'workflow_dispatch' && inputs.export_environment }}
pull_request_number: ${{ needs.metadata.outputs.pull_request_number }}

# Docker images are packaging, not correctness — only built on merge_group/dispatch.
docker_image:
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/generate_cc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ on:
export_environment:
required: false
type: boolean
pull_request_number:
required: false
type: string
default: ''
secrets:
CODECOV_TOKEN:
required: false
Expand All @@ -25,7 +29,7 @@ name: Show Code Coverage Diff

jobs:
gen_code_coverage:
runs-on: ${{ (contains(inputs.platform, 'arm') && 'linux-arm64-cpu8') || 'linux-amd64-cpu8' }}
runs-on: ${{ (contains(inputs.platform, 'arm') && 'linux-arm64-cpu16') || 'linux-amd64-cpu16' }}
permissions:
contents: read
packages: write
Expand Down Expand Up @@ -147,6 +151,7 @@ jobs:
fail_ci_if_error: false
files: ${{ github.workspace }}/shared/coverage.txt,${{ github.workspace }}/shared/coverage.xml
token: ${{ secrets.CODECOV_TOKEN }}
override_pr: ${{ inputs.pull_request_number }}
verbose: true

- name: Save environment
Expand Down
9 changes: 6 additions & 3 deletions scripts/generate_cc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ OPTIND=$__optind__
this_file_dir=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")
repo_root=$(cd "$this_file_dir" && git rev-parse --show-toplevel)

pytest_workers="${PYTEST_WORKERS:-4}"
python3 -m pip install pytest-xdist --break-system-packages 2>/dev/null || true

# Set envs
if $gen_cpp_coverage; then
export CUDAQ_ENABLE_CC=ON
Expand Down Expand Up @@ -115,7 +118,7 @@ if $gen_cpp_coverage; then
# Run tests (Python tests)
rm -rf ${repo_root}/_skbuild
pip install ${repo_root} --user -vvv
python3 -m pytest -v ${repo_root}/python/tests/ --ignore ${repo_root}/python/tests/backends
python3 -m pytest -v -n "$pytest_workers" ${repo_root}/python/tests/ --ignore ${repo_root}/python/tests/backends
for backendTest in ${repo_root}/python/tests/backends/*.py; do
python3 -m pytest -v $backendTest
pytest_status=$?
Expand Down Expand Up @@ -198,9 +201,9 @@ if $gen_py_coverage; then
pip install . -vvv
mkdir -p ${repo_root}/build/pycoverage
if $is_codecov_format; then
python -m pytest -v python/tests/ --ignore python/tests/backends --cov=cudaq --cov-report=xml:${repo_root}/build/pycoverage/coverage.xml --cov-append
python -m pytest -v -n "$pytest_workers" python/tests/ --ignore python/tests/backends --cov=cudaq --cov-report=xml:${repo_root}/build/pycoverage/coverage.xml --cov-append
else
python -m pytest -v python/tests/ --ignore python/tests/backends --cov=cudaq --cov-report=html:${repo_root}/build/pycoverage --cov-append
python -m pytest -v -n "$pytest_workers" python/tests/ --ignore python/tests/backends --cov=cudaq --cov-report=html:${repo_root}/build/pycoverage --cov-append
fi
for backendTest in python/tests/backends/*.py; do
if $is_codecov_format; then
Expand Down
Loading