Skip to content

Commit 785e66c

Browse files
ElePTwoodsp-ibmEric-Arellano
authored
Add repo setup (#1)
Co-authored-by: Steve Wood <[email protected]> Co-authored-by: Eric Arellano <[email protected]>
1 parent 5053a6e commit 785e66c

23 files changed

+1106
-8
lines changed

.github/CODEOWNERS

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# This file defines the persons who will be assigned as reviewers for PRs that
2+
# modify particular files in the repo. The PR can be merged when approved by at
3+
# least one codeowner. However, all Qiskit team members can (and should!) review the PRs.
4+
5+
# Global rule, unless specialized by a later one
6+
* @Cryoris @woodsp-ibm @ElePT
7+
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: 🐛 Bug report
2+
description: Create a report to help us improve 🤔.
3+
labels: ["bug"]
4+
5+
body:
6+
- type: markdown
7+
attributes:
8+
value: Thank you for reporting! Please also use the search to see if there are any other relevant issues or pull requests.
9+
10+
- type: textarea
11+
attributes:
12+
label: Environment
13+
description: For the version of Algorithms, 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.
14+
# The trailing spaces on the following lines are to make filling the form
15+
# in easier. The type is 'textarea' rather than three separate 'input's
16+
# to make the resulting issue body less noisy with headings.
17+
value: |
18+
- **Qiskit Algorithms version**:
19+
- **Python version**:
20+
- **Operating system**:
21+
validations:
22+
required: true
23+
24+
- type: textarea
25+
attributes:
26+
label: What is happening?
27+
description: A short description of what is going wrong, in words.
28+
validations:
29+
required: true
30+
31+
- type: textarea
32+
attributes:
33+
label: How can we reproduce the issue?
34+
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).
35+
validations:
36+
required: true
37+
38+
- type: textarea
39+
attributes:
40+
label: What should happen?
41+
description: A short description, including about the expected output of any code in the previous section.
42+
validations:
43+
required: true
44+
45+
- type: textarea
46+
attributes:
47+
label: Any suggestions?
48+
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.
49+
validations:
50+
required: false
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: 🚀 Feature request
2+
description: Suggest an idea for this project 💡!
3+
labels: ["type: feature request"]
4+
5+
body:
6+
- type: markdown
7+
attributes:
8+
value: Please make sure to browse the opened and closed issues to make sure that this idea has not previously been discussed.
9+
10+
- type: textarea
11+
attributes:
12+
label: What should we add?
13+
validations:
14+
required: true

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<!--
2+
⚠️ If you do not respect this template, your pull request will be closed.
3+
⚠️ Your pull request title should be short detailed and understandable for all.
4+
⚠️ Also, please add it in the CHANGELOG file under Unreleased section.
5+
⚠️ If your pull request fixes an open issue, please link to the issue.
6+
7+
✅ I have added the tests to cover my changes.
8+
✅ I have updated the documentation accordingly.
9+
✅ I have read the CONTRIBUTING document.
10+
-->
11+
12+
### Summary
13+
14+
15+
16+
### Details and comments
17+
18+
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# This code is part of Qiskit.
2+
#
3+
# (C) Copyright IBM 2021.
4+
#
5+
# This code is licensed under the Apache License, Version 2.0. You may
6+
# obtain a copy of this license in the LICENSE.txt file in the root directory
7+
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
8+
#
9+
# Any modifications or derivative works of this code must retain this
10+
# copyright notice, and modified files need to carry a notice indicating
11+
# that they have been altered from the originals.
12+
13+
name: 'Install Qiskit Algorithms'
14+
description: 'Installs Qiskit Algorithms'
15+
16+
runs:
17+
using: "composite"
18+
steps:
19+
- run : |
20+
pip install -e .
21+
pip install -U -c constraints.txt -r requirements-dev.txt
22+
shell: bash
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# This code is part of Qiskit.
2+
#
3+
# (C) Copyright IBM 2021, 2023.
4+
#
5+
# This code is licensed under the Apache License, Version 2.0. You may
6+
# obtain a copy of this license in the LICENSE.txt file in the root directory
7+
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
8+
#
9+
# Any modifications or derivative works of this code must retain this
10+
# copyright notice, and modified files need to carry a notice indicating
11+
# that they have been altered from the originals.
12+
13+
name: 'Install Qiskit Algorithms Main Dependencies'
14+
description: 'Installs Python dependencies from Main'
15+
inputs:
16+
os:
17+
description: 'OS'
18+
required: true
19+
python-version:
20+
description: 'Python version'
21+
required: true
22+
terra-main:
23+
description: 'Use Terra main'
24+
required: true
25+
runs:
26+
using: "composite"
27+
steps:
28+
- name: Get main last commit ids
29+
run: |
30+
echo "TERRA_HASH=$(git ls-remote --heads https://github.com/Qiskit/qiskit-terra.git refs/heads/main | awk '{print $1}')" >> $GITHUB_ENV
31+
shell: bash
32+
- name: Terra Cache
33+
env:
34+
CACHE_VERSION: v1
35+
id: terra-cache
36+
uses: actions/cache@v3
37+
with:
38+
path: terra-cache
39+
key: terra-cache-${{ inputs.os }}-${{ inputs.python-version }}-${{ env.TERRA_HASH }}-${{ env.CACHE_VERSION }}
40+
- name: Install Terra from Main
41+
env:
42+
MACOSX_DEPLOYMENT_TARGET: 10.15
43+
run: |
44+
if [ "${{ inputs.terra-main }}" == "true" ]; then
45+
echo 'Install Terra from Main'
46+
BASE_DIR=terra-cache
47+
build_from_main=true
48+
cache_hit=${{ steps.terra-cache.outputs.cache-hit }}
49+
echo "cache hit: ${cache_hit}"
50+
if [ "$cache_hit" == "true" ]; then
51+
pip_result=0
52+
pushd "${BASE_DIR}"
53+
python -m pip install *.whl && pip_result=$? || pip_result=$?
54+
popd
55+
if [ $pip_result == 0 ]; then
56+
build_from_main=false
57+
fi
58+
else
59+
mkdir -p ${BASE_DIR}
60+
fi
61+
if [ "$build_from_main" == "true" ]; then
62+
echo 'Create wheel file from main'
63+
pip install -U wheel setuptools_rust
64+
git clone --depth 1 --branch main https://github.com/Qiskit/qiskit-terra.git /tmp/qiskit-terra
65+
pushd /tmp/qiskit-terra
66+
python setup.py bdist_wheel
67+
popd
68+
cp -rf /tmp/qiskit-terra/dist/*.whl "${BASE_DIR}"
69+
pushd "${BASE_DIR}"
70+
python -m pip install *.whl
71+
popd
72+
pip uninstall -y setuptools_rust
73+
fi
74+
else
75+
echo 'Install Terra from Stable'
76+
pip install -U qiskit-terra
77+
fi
78+
shell: bash

.github/actions/run-tests/action.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# This code is part of Qiskit.
2+
#
3+
# (C) Copyright IBM 2021.
4+
#
5+
# This code is licensed under the Apache License, Version 2.0. You may
6+
# obtain a copy of this license in the LICENSE.txt file in the root directory
7+
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
8+
#
9+
# Any modifications or derivative works of this code must retain this
10+
# copyright notice, and modified files need to carry a notice indicating
11+
# that they have been altered from the originals.
12+
13+
name: 'Run Unit Tests'
14+
description: 'Run Unit Tests'
15+
inputs:
16+
os:
17+
description: 'OS'
18+
required: true
19+
event-name:
20+
description: 'Actions event'
21+
required: true
22+
run-slow:
23+
description: 'Run slow tests or not'
24+
required: true
25+
python-version:
26+
description: 'Python version'
27+
required: true
28+
runs:
29+
using: "composite"
30+
steps:
31+
- name: Run Unit Tests
32+
env:
33+
PYTHONWARNINGS: default
34+
run: |
35+
# run slow tests only on scheduled event or if input flag is set
36+
if [ "${{ inputs.event-name }}" == "schedule" ] || [ "${{ inputs.run-slow }}" == "true" ]; then
37+
export QISKIT_TESTS="run_slow"
38+
fi
39+
if [ "${{ inputs.os }}" == "ubuntu-latest" ] && [ "${{ inputs.python-version }}" == "3.8" ]; then
40+
export PYTHON="coverage3 run --source qiskit_algorithms --parallel-mode"
41+
fi
42+
stestr --test-path test run 2> >(tee /dev/stderr out.txt > /dev/null)
43+
shell: bash

.github/workflows/deploy-code.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# This code is part of Qiskit.
2+
#
3+
# (C) Copyright IBM 2021, 2022.
4+
#
5+
# This code is licensed under the Apache License, Version 2.0. You may
6+
# obtain a copy of this license in the LICENSE.txt file in the root directory
7+
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
8+
#
9+
# Any modifications or derivative works of this code must retain this
10+
# copyright notice, and modified files need to carry a notice indicating
11+
# that they have been altered from the originals.
12+
13+
name: Deploy Code
14+
15+
on:
16+
push:
17+
tags:
18+
- '*'
19+
20+
jobs:
21+
code_publish:
22+
runs-on: ubuntu-latest
23+
strategy:
24+
matrix:
25+
python-version: [3.8]
26+
steps:
27+
- uses: actions/checkout@v3
28+
- uses: actions/setup-python@v4
29+
with:
30+
python-version: ${{ matrix.python-version }}
31+
- name: Deploy to Pypi
32+
env:
33+
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
34+
TWINE_USERNAME: qiskit
35+
run : |
36+
pip install -U twine pip setuptools virtualenv wheel
37+
python3 setup.py sdist bdist_wheel
38+
twine upload dist/qiskit*
39+
shell: bash

0 commit comments

Comments
 (0)