mit-han-lab / torchquantum

A PyTorch-based framework for Quantum Classical Simulation, Quantum Machine Learning, Quantum Neural Networks, Parameterized Quantum Circuits with support for easy deployments on real quantum computers.
https://torchquantum.org
MIT License
1.3k stars 197 forks source link

Authenticate IBM Quantum account with GH actions to run unit tests #268

Closed SaashaJoshi closed 3 months ago

SaashaJoshi commented 4 months ago

This PR builds a GH actions workflow that runs unit tests while authenticating the IBM Quantum account with the help of an IBM_API_TOKEN stored as a GH secret. It partially addresses #261.

The changes aim to run the tests/plugin/test_qiskit_plugins.py file with GH actions.

GenericP3rson commented 4 months ago

Hi, just wanted to let you know that you don’t need to worry about getting the lint + pre-commit passing.

SaashaJoshi commented 4 months ago

Thanks for letting me know. I was indeed worried about the linting.

SaashaJoshi commented 4 months ago

Hey @GenericP3rson, the latest GH workflow gives the following error,

FAILED test/plugin/test_qiskit_plugins.py::test_expval_observable - qiskit_ibm_runtime.accounts.exceptions.AccountNotFoundError: 'Unable to find account.'

Just wanted to make sure that we use the same keyword for the GH secret, which is `IBM_API_TOKEN'. Let me know if this is different and I will reflect those changes in the code. If this is not causing the error, I will brainstorm more.

SaashaJoshi commented 4 months ago

@GenericP3rson, Could you approve the workflow for the latest commit? Since the GH secret is sorted, I think this should work!

SaashaJoshi commented 4 months ago

Okay, the AccountNotFound error persists. I am not sure what is going wrong here. I am able to run the tests successfully on my local machine though. I even have a PR on my fork of torchquantum and the tests pass there. For reference, check this

PS: I am using this API token from my IBM quantum platform.

Screenshot 2024-05-30 at 14 32 40
GenericP3rson commented 4 months ago

Hi, so sorry, I have not yet added the secret yet; I don’t have the permissions to add secrets to this repo at the moment but will get it added ASAP!

While I’m getting that sorted, to fully complete the task, if you want to add a set of tests for some function (either as a separate PR or with this), that would be great!

SaashaJoshi commented 4 months ago

No problem! Absolutely, I will add a few test classes to increase the coverage.

GenericP3rson commented 3 months ago

Merging the PR, congrats!