-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
33 changed files
with
600 additions
and
111 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# This file defines the persons who will be assigned as reviewers for PRs that | ||
# modify particular files in the repo. The PR can be merged when approved by at | ||
# least one codeowner. However, all Qiskit team members can (and should!) review the PRs. | ||
|
||
# Global rule, unless specialized by a later one | ||
* @eggerdj @ElePT | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
name: 🐛 Bug report | ||
description: Create a report to help us improve 🤔. | ||
labels: ["bug"] | ||
|
||
body: | ||
- type: markdown | ||
attributes: | ||
value: Thank you for reporting! Please also use the search to see if there are any other relevant issues or pull requests. | ||
|
||
- type: textarea | ||
attributes: | ||
label: Environment | ||
description: For the version of Qiskit, please give the actual version number (_e.g._ 0.18.3) if you are using a release version, or the first 7-8 characters of the commit hash if you have installed from `git`. If anything else is relevant, you can add it to the list. | ||
# The trailing spaces on the following lines are to make filling the form | ||
# in easier. The type is 'textarea' rather than three separate 'input's | ||
# to make the resulting issue body less noisy with headings. | ||
value: | | ||
- **Qiskit version**: | ||
- **Python version**: | ||
- **Operating system**: | ||
validations: | ||
required: true | ||
|
||
- type: textarea | ||
attributes: | ||
label: What is happening? | ||
description: A short description of what is going wrong, in words. | ||
validations: | ||
required: true | ||
|
||
- type: textarea | ||
attributes: | ||
label: How can we reproduce the issue? | ||
description: Give some steps that show the bug. A [minimal working example](https://stackoverflow.com/help/minimal-reproducible-example) of code with output is best. If you are copying in code, please remember to enclose it in triple backticks (` ``` [multiline code goes here] ``` `) so that it [displays correctly](https://docs.github.com/en/github/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax). | ||
validations: | ||
required: true | ||
|
||
- type: textarea | ||
attributes: | ||
label: What should happen? | ||
description: A short description, including about the expected output of any code in the previous section. | ||
validations: | ||
required: true | ||
|
||
- type: textarea | ||
attributes: | ||
label: Any suggestions? | ||
description: Not required, but if you have suggestions for how a contributor should fix this, or any problems we should be aware of, let us know. | ||
validations: | ||
required: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
name: 🚀 Feature request | ||
description: Suggest an idea for this project 💡! | ||
labels: ["type: feature request"] | ||
|
||
body: | ||
- type: markdown | ||
attributes: | ||
value: Please make sure to browse the opened and closed issues to make sure that this idea has not previously been discussed. | ||
|
||
- type: textarea | ||
attributes: | ||
label: What should we add? | ||
validations: | ||
required: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<!-- | ||
⚠️ If you do not respect this template, your pull request will be closed. | ||
⚠️ Your pull request title should be short detailed and understandable for all. | ||
⚠️ If your pull request fixes an open issue, please link to the issue. | ||
✅ I have added the tests to cover my changes. | ||
--> | ||
|
||
### Summary | ||
|
||
|
||
|
||
### Details and comments | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# This code is part of a Qiskit project. | ||
# | ||
# (C) Copyright IBM 2021, 2023. | ||
# | ||
# This code is licensed under the Apache License, Version 2.0. You may | ||
# obtain a copy of this license in the LICENSE.txt file in the root directory | ||
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. | ||
# | ||
# Any modifications or derivative works of this code must retain this | ||
# copyright notice, and modified files need to carry a notice indicating | ||
# that they have been altered from the originals. | ||
|
||
name: 'Install Main Dependencies' | ||
description: 'Installs Python dependencies from Main' | ||
inputs: | ||
os: | ||
description: 'OS' | ||
required: true | ||
python-version: | ||
description: 'Python version' | ||
required: true | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Get main last commit ids | ||
run: | | ||
echo "QISKIT_HASH=$(git ls-remote --heads https://github.com/Qiskit/qiskit.git refs/heads/main | awk '{print $1}')" >> $GITHUB_ENV | ||
shell: bash | ||
- name: Qiskit Cache | ||
env: | ||
CACHE_VERSION: v1 | ||
id: qiskit-cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: qiskit-cache | ||
key: qiskit-cache-${{ inputs.os }}-${{ inputs.python-version }}-${{ env.QISKIT_HASH }}-${{ env.CACHE_VERSION }} | ||
- name: Install Qiskit from Main | ||
env: | ||
MACOSX_DEPLOYMENT_TARGET: 10.15 | ||
run: | | ||
echo 'Install Qiskit from Stable' | ||
pip install -U qiskit | ||
shell: bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# This code is part of a Qiskit project. | ||
# | ||
# (C) Copyright IBM 2021. | ||
# | ||
# This code is licensed under the Apache License, Version 2.0. You may | ||
# obtain a copy of this license in the LICENSE.txt file in the root directory | ||
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. | ||
# | ||
# Any modifications or derivative works of this code must retain this | ||
# copyright notice, and modified files need to carry a notice indicating | ||
# that they have been altered from the originals. | ||
|
||
name: 'Install qopt_best_practices' | ||
description: 'Installs qopt_best_practices' | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- run : | | ||
pip install -e . | ||
pip install -U -c constraints.txt -r requirements-dev.txt | ||
shell: bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# This code is part of a Qiskit project. | ||
# | ||
# (C) Copyright IBM 2021, 2023. | ||
# | ||
# This code is licensed under the Apache License, Version 2.0. You may | ||
# obtain a copy of this license in the LICENSE.txt file in the root directory | ||
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. | ||
# | ||
# Any modifications or derivative works of this code must retain this | ||
# copyright notice, and modified files need to carry a notice indicating | ||
# that they have been altered from the originals. | ||
|
||
name: 'Run Unit Tests' | ||
description: 'Run Unit Tests' | ||
inputs: | ||
os: | ||
description: 'OS' | ||
required: true | ||
event-name: | ||
description: 'Actions event' | ||
required: true | ||
run-slow: | ||
description: 'Run slow tests or not' | ||
required: true | ||
python-version: | ||
description: 'Python version' | ||
required: true | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Run Unit Tests | ||
env: | ||
PYTHONWARNINGS: default | ||
run: | | ||
# run slow tests only on scheduled event or if input flag is set | ||
if [ "${{ inputs.os }}" == "ubuntu-latest" ] && [ "${{ inputs.python-version }}" == "3.8" ]; then | ||
export PYTHON="coverage3 run --source qopt_best_practices --parallel-mode" | ||
fi | ||
stestr --test-path test run 2> >(tee /dev/stderr out.txt > /dev/null) | ||
shell: bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
# This code is part of a Qiskit project. | ||
# | ||
# (C) Copyright IBM 2021, 2023. | ||
# | ||
# This code is licensed under the Apache License, Version 2.0. You may | ||
# obtain a copy of this license in the LICENSE.txt file in the root directory | ||
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. | ||
# | ||
# Any modifications or derivative works of this code must retain this | ||
# copyright notice, and modified files need to carry a notice indicating | ||
# that they have been altered from the originals. | ||
|
||
name: qopt-best-practices Unit Tests | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- 'stable/**' | ||
pull_request: | ||
branches: | ||
- main | ||
- 'stable/**' | ||
|
||
concurrency: | ||
group: ${{ github.repository }}-${{ github.ref }}-${{ github.head_ref }}-${{ github.workflow }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
Checks: | ||
if: github.repository_owner == 'qiskit-community' | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest] | ||
python-version: [3.8] | ||
steps: | ||
- name: Print Concurrency Group | ||
env: | ||
CONCURRENCY_GROUP: ${{ github.repository }}-${{ github.ref }}-${{ github.head_ref }}-${{ github.workflow }} | ||
run: | | ||
echo -e "\033[31;1;4mConcurrency Group\033[0m" | ||
echo -e "$CONCURRENCY_GROUP\n" | ||
shell: bash | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
cache: 'pip' | ||
cache-dependency-path: | | ||
setup.py | ||
requirements.txt | ||
requirements-dev.txt | ||
- uses: ./.github/actions/install-main-dependencies | ||
with: | ||
os: ${{ matrix.os }} | ||
python-version: ${{ matrix.python-version }} | ||
qiskit-main: "false" | ||
if: ${{ !startsWith(github.ref, 'refs/heads/stable') && !startsWith(github.base_ref, 'stable/') }} | ||
- uses: ./.github/actions/install-qopt | ||
- run: pip check | ||
if: ${{ !cancelled() }} | ||
shell: bash | ||
- name: Style Check | ||
run: | | ||
make style | ||
if: ${{ !cancelled() }} | ||
shell: bash | ||
qopt: | ||
if: github.repository_owner == 'qiskit-community' | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest] | ||
python-version: [3.8, 3.11] | ||
include: | ||
- os: macos-latest | ||
python-version: 3.8 | ||
- os: macos-latest | ||
python-version: 3.11 | ||
- os: windows-latest | ||
python-version: 3.8 | ||
- os: windows-latest | ||
python-version: 3.11 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
cache: 'pip' | ||
cache-dependency-path: | | ||
setup.py | ||
requirements.txt | ||
requirements-dev.txt | ||
- uses: ./.github/actions/install-main-dependencies | ||
with: | ||
os: ${{ matrix.os }} | ||
python-version: ${{ matrix.python-version }} | ||
qiskit-main: "false" | ||
if: ${{ !startsWith(github.ref, 'refs/heads/stable') && !startsWith(github.base_ref, 'stable/') }} | ||
- uses: ./.github/actions/install-qopt | ||
- run: make lint | ||
shell: bash | ||
- name: qopt Unit Tests under Python ${{ matrix.python-version }} | ||
uses: ./.github/actions/run-tests | ||
with: | ||
os: ${{ matrix.os }} | ||
event-name: ${{ github.event_name }} | ||
run-slow: ${{ contains(github.event.pull_request.labels.*.name, 'run_slow') }} | ||
python-version: ${{ matrix.python-version }} | ||
if: ${{ !cancelled() }} | ||
- name: Coverage combine | ||
run: | | ||
mkdir ./ci-artifact-data | ||
coverage3 combine | ||
mv .coverage ./ci-artifact-data/qopt.dat | ||
if: ${{ matrix.os == 'ubuntu-latest' && matrix.python-version == 3.8 }} | ||
shell: bash | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: ${{ matrix.os }}-${{ matrix.python-version }} | ||
path: ./ci-artifact-data/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
OS := $(shell uname -s) | ||
|
||
ifeq ($(OS), Linux) | ||
NPROCS := $(shell grep -c ^processor /proc/cpuinfo) | ||
else ifeq ($(OS), Darwin) | ||
NPROCS := 2 | ||
else | ||
NPROCS := 0 | ||
endif # $(OS) | ||
|
||
ifeq ($(NPROCS), 2) | ||
CONCURRENCY := 2 | ||
else ifeq ($(NPROCS), 1) | ||
CONCURRENCY := 1 | ||
else ifeq ($(NPROCS), 3) | ||
CONCURRENCY := 3 | ||
else ifeq ($(NPROCS), 0) | ||
CONCURRENCY := 0 | ||
else | ||
CONCURRENCY := $(shell echo "$(NPROCS) 2" | awk '{printf "%.0f", $$1 / $$2}') | ||
endif | ||
|
||
.PHONY: lint style black test test_ci coverage clean | ||
|
||
all_check: style lint | ||
|
||
lint: | ||
pylint -rn qopt_best_practices test | ||
|
||
black: | ||
python -m black qopt_best_practices test | ||
|
||
style: | ||
python -m black --check qopt_best_practices test | ||
|
||
test: | ||
python -m unittest discover -v test | ||
|
||
test_ci: | ||
echo "Detected $(NPROCS) CPUs running with $(CONCURRENCY) workers" | ||
python -m stestr run --concurrency $(CONCURRENCY) | ||
|
||
coverage: | ||
python -m coverage3 run --source qopt_best_practices -m unittest discover -s test -q | ||
python -m coverage3 report | ||
|
||
coverage_erase: | ||
python -m coverage erase | ||
|
||
clean: coverage_erase; |
Empty file.
Oops, something went wrong.