Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix code coverage for LQ/LK CPU Python #1053

Merged
merged 43 commits into from
Feb 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
8a9ab4d
debug codecov path
josephleekl Jan 27, 2025
a300e55
Auto update version from '0.41.0-dev8' to '0.41.0-dev9'
ringo-but-quantum Jan 27, 2025
025079c
Merge branch 'master' into fix-codecov-path
josephleekl Jan 27, 2025
93666a1
use python -m pytest
josephleekl Jan 27, 2025
dd06223
Auto update version from '0.41.0-dev9' to '0.41.0-dev10'
ringo-but-quantum Jan 27, 2025
e03ec1a
remove source
josephleekl Jan 28, 2025
d3f0bad
delete source earlier
josephleekl Jan 28, 2025
3bccc40
install wheel before combine
josephleekl Jan 28, 2025
a9510cc
Auto update version from '0.41.0-dev10' to '0.41.0-dev11'
ringo-but-quantum Jan 28, 2025
5f99770
Merge branch 'master' into fix-codecov-path
josephleekl Jan 28, 2025
1e1dcab
get python
josephleekl Jan 28, 2025
0addba5
remove unnecessary dependencies
josephleekl Jan 28, 2025
4bb0e08
add comment
josephleekl Jan 28, 2025
483b01a
update changelog
josephleekl Jan 28, 2025
077a61c
remove openblas dep
josephleekl Jan 28, 2025
24fea5a
fix oepnblas
josephleekl Jan 28, 2025
585ac72
fix space
josephleekl Jan 28, 2025
e839cae
trigger CI
josephleekl Jan 28, 2025
9a72e9e
remove install requirements-dev.txt
josephleekl Jan 28, 2025
7ff9c47
Merge branch 'master' into fix-codecov-path
josephleekl Jan 29, 2025
6290071
Auto update version from '0.41.0-dev11' to '0.41.0-dev12'
ringo-but-quantum Jan 29, 2025
3be31c3
Merge branch 'master' into fix-codecov-path
josephleekl Jan 29, 2025
e754d90
Auto update version from '0.41.0-dev12' to '0.41.0-dev13'
ringo-but-quantum Jan 29, 2025
53a15f6
Merge branch 'master' into fix-codecov-path
josephleekl Jan 29, 2025
25d41ce
Auto update version from '0.41.0-dev14' to '0.41.0-dev15'
ringo-but-quantum Jan 29, 2025
b074ae7
update lkcpu as well
josephleekl Jan 31, 2025
115ced8
rename, don't remove
josephleekl Jan 31, 2025
c5ae43a
add needs
josephleekl Jan 31, 2025
208b92d
get toml
josephleekl Jan 31, 2025
f1b9b93
update coveragerc
josephleekl Jan 31, 2025
e2f1849
debug pathmap
josephleekl Jan 31, 2025
f07ba46
change paths
josephleekl Jan 31, 2025
a7943fe
change lk
josephleekl Feb 3, 2025
3fbc52d
remove editable coverage
josephleekl Feb 3, 2025
9046142
fix path
josephleekl Feb 3, 2025
1f2b7e4
don't install wheel
josephleekl Feb 4, 2025
f70c6ad
Auto update version from '0.41.0-dev15' to '0.41.0-dev17'
ringo-but-quantum Feb 4, 2025
94dfb65
trigger CI
josephleekl Feb 4, 2025
cf25ffc
Merge branch 'master' into fix-codecov-path
josephleekl Feb 4, 2025
4ee08dc
use ROOT_DIR
josephleekl Feb 4, 2025
5d34107
update lq path
josephleekl Feb 4, 2025
96a39d5
remove lk dependency
josephleekl Feb 4, 2025
1ec9e85
ali comments
josephleekl Feb 5, 2025
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
3 changes: 3 additions & 0 deletions .github/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@

### Bug fixes

* Fix CI to collect Python code coverage for Lightning-Qubit and Lightning-Kokkos CPU.
[(#1053)](https://github.com/PennyLaneAI/pennylane-lightning/pull/1053)

* Upgrade the version of QEMU image to fix AARCH64 wheel action.
[(#1056)](https://github.com/PennyLaneAI/pennylane-lightning/pull/1056)

Expand Down
22 changes: 20 additions & 2 deletions .github/workflows/tests_lkcpu_python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,9 @@ jobs:
OMP_PROC_BIND: false
run: |
DEVICENAME=`echo ${{ matrix.pl_backend }} | sed "s/_/./g"`
# Temporarily rename source files here to ensure pytest collect source coverage from wheel package
# Rename as we want to restore them for editable install test
mv pennylane_lightning/ pennylane_lightning_src/
pl-device-test --device ${DEVICENAME} --skip-ops --shots=10000 $COVERAGE_FLAGS --cov-append
pl-device-test --device ${DEVICENAME} --shots=None --skip-ops $COVERAGE_FLAGS --cov-append

Expand All @@ -266,12 +269,14 @@ jobs:
- name: Test editable install
run: |
pip uninstall pennylane-lightning pennylane-lightning-kokkos -y
# Rename source files back to test editable installation
mv pennylane_lightning_src/ pennylane_lightning/
python scripts/configure_pyproject_toml.py
SKIP_COMPILATION=True python -m pip install -e . --config-settings editable_mode=compat
DEVICENAME=`echo ${{ matrix.pl_backend }} | sed "s/_/./g"`
PL_BACKEND=${DEVICENAME} python scripts/configure_pyproject_toml.py
python -m pip install -e . --config-settings editable_mode=compat -vv
PL_DEVICE=${DEVICENAME} python -m pytest tests/test_device.py $COVERAGE_FLAGS
PL_DEVICE=${DEVICENAME} python -m pytest tests/test_device.py $COVERAGE_FLAGS --cov-append

- name: Upload test durations
uses: actions/upload-artifact@v4
Expand Down Expand Up @@ -301,6 +306,11 @@ jobs:
name: Upload python coverage data to codecov
runs-on: ubuntu-latest
steps:
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: '3.10'

- name: Checkout
uses: actions/checkout@v4
with:
Expand All @@ -314,8 +324,16 @@ jobs:

- name: Combine coverage files
run: |
# Update .coveragerc to include sources for combining equivalent paths
wheelpath=$Python_ROOT_DIR/lib/python3.10/site-packages
echo "" >> .coveragerc
echo "[paths]" >> .coveragerc
josephleekl marked this conversation as resolved.
Show resolved Hide resolved
echo "source =" >> .coveragerc
echo " pennylane_lightning" >> .coveragerc
echo " $wheelpath/pennylane_lightning" >> .coveragerc
echo " /home/runner/work/pennylane-lightning/pennylane-lightning/pennylane_lightning" >> .coveragerc
python -m pip install coverage
python -m coverage combine .coverage-*
python -m coverage combine --debug=pathmap .coverage-*
# Added cov xml -i to ignore "No source for code" random errors
# https://stackoverflow.com/questions/2386975/no-source-for-code-message-in-coverage-py
python -m coverage xml -i -o coverage-${{ github.job }}.xml
Expand Down
17 changes: 16 additions & 1 deletion .github/workflows/tests_lqcpu_python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,8 @@ jobs:
- name: Run PennyLane-Lightning integration tests
run: |
DEVICENAME=`echo ${{ matrix.pl_backend }} | sed "s/_/./g"`
# Remove source files here to ensure pytest collect source coverage from wheel package
rm -r pennylane_lightning
pl-device-test --device ${DEVICENAME} --skip-ops --shots=10000 $COVERAGE_FLAGS --cov-append
pl-device-test --device ${DEVICENAME} --shots=None --skip-ops $COVERAGE_FLAGS --cov-append

Expand Down Expand Up @@ -250,6 +252,11 @@ jobs:
name: Upload python coverage data to codecov
runs-on: ubuntu-latest
steps:
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: '3.10'

- name: Checkout
uses: actions/checkout@v4
with:
Expand All @@ -263,8 +270,16 @@ jobs:

- name: Combine coverage files
run: |
# Update .coveragerc to include sources for combining equivalent paths
wheelpath=$Python_ROOT_DIR/lib/python3.10/site-packages
echo "" >> .coveragerc
echo "[paths]" >> .coveragerc
echo "source =" >> .coveragerc
echo " pennylane_lightning" >> .coveragerc
echo " $wheelpath/pennylane_lightning" >> .coveragerc
echo " /home/runner/work/pennylane-lightning/pennylane-lightning/pennylane_lightning" >> .coveragerc
python -m pip install coverage
python -m coverage combine .coverage-*
python -m coverage combine --debug=pathmap .coverage-*
# Added cov xml -i to ignore "No source for code" random errors
# https://stackoverflow.com/questions/2386975/no-source-for-code-message-in-coverage-py
python -m coverage xml -i -o coverage-${{ github.job }}.xml
Expand Down
2 changes: 1 addition & 1 deletion pennylane_lightning/core/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@
Version number (major.minor.patch[-label])
"""

__version__ = "0.41.0-dev16"
__version__ = "0.41.0-dev17"
Loading