Skip to content

Commit

Permalink
Add repo setup (#1)
Browse files Browse the repository at this point in the history
Co-authored-by: Steve Wood <40241007+woodsp-ibm@users.noreply.github.com>
Co-authored-by: Eric Arellano <14852634+Eric-Arellano@users.noreply.github.com>
  • Loading branch information
3 people authored Jul 20, 2023
1 parent 5053a6e commit 785e66c
Show file tree
Hide file tree
Showing 23 changed files with 1,106 additions and 8 deletions.
7 changes: 7 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
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
* @Cryoris @woodsp-ibm @ElePT

50 changes: 50 additions & 0 deletions .github/ISSUE_TEMPLATE/BUG_REPORT.yaml
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 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.
# 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 Algorithms 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
14 changes: 14 additions & 0 deletions .github/ISSUE_TEMPLATE/FEATURE_REQUEST.yaml
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
18 changes: 18 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!--
⚠️ 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.
⚠️ Also, please add it in the CHANGELOG file under Unreleased section.
⚠️ If your pull request fixes an open issue, please link to the issue.
✅ I have added the tests to cover my changes.
✅ I have updated the documentation accordingly.
✅ I have read the CONTRIBUTING document.
-->

### Summary



### Details and comments


22 changes: 22 additions & 0 deletions .github/actions/install-algorithms/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# This code is part of Qiskit.
#
# (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 Qiskit Algorithms'
description: 'Installs Qiskit Algorithms'

runs:
using: "composite"
steps:
- run : |
pip install -e .
pip install -U -c constraints.txt -r requirements-dev.txt
shell: bash
78 changes: 78 additions & 0 deletions .github/actions/install-main-dependencies/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# This code is part of Qiskit.
#
# (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 Qiskit Algorithms Main Dependencies'
description: 'Installs Python dependencies from Main'
inputs:
os:
description: 'OS'
required: true
python-version:
description: 'Python version'
required: true
terra-main:
description: 'Use Terra main'
required: true
runs:
using: "composite"
steps:
- name: Get main last commit ids
run: |
echo "TERRA_HASH=$(git ls-remote --heads https://github.com/Qiskit/qiskit-terra.git refs/heads/main | awk '{print $1}')" >> $GITHUB_ENV
shell: bash
- name: Terra Cache
env:
CACHE_VERSION: v1
id: terra-cache
uses: actions/cache@v3
with:
path: terra-cache
key: terra-cache-${{ inputs.os }}-${{ inputs.python-version }}-${{ env.TERRA_HASH }}-${{ env.CACHE_VERSION }}
- name: Install Terra from Main
env:
MACOSX_DEPLOYMENT_TARGET: 10.15
run: |
if [ "${{ inputs.terra-main }}" == "true" ]; then
echo 'Install Terra from Main'
BASE_DIR=terra-cache
build_from_main=true
cache_hit=${{ steps.terra-cache.outputs.cache-hit }}
echo "cache hit: ${cache_hit}"
if [ "$cache_hit" == "true" ]; then
pip_result=0
pushd "${BASE_DIR}"
python -m pip install *.whl && pip_result=$? || pip_result=$?
popd
if [ $pip_result == 0 ]; then
build_from_main=false
fi
else
mkdir -p ${BASE_DIR}
fi
if [ "$build_from_main" == "true" ]; then
echo 'Create wheel file from main'
pip install -U wheel setuptools_rust
git clone --depth 1 --branch main https://github.com/Qiskit/qiskit-terra.git /tmp/qiskit-terra
pushd /tmp/qiskit-terra
python setup.py bdist_wheel
popd
cp -rf /tmp/qiskit-terra/dist/*.whl "${BASE_DIR}"
pushd "${BASE_DIR}"
python -m pip install *.whl
popd
pip uninstall -y setuptools_rust
fi
else
echo 'Install Terra from Stable'
pip install -U qiskit-terra
fi
shell: bash
43 changes: 43 additions & 0 deletions .github/actions/run-tests/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# This code is part of Qiskit.
#
# (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: '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.event-name }}" == "schedule" ] || [ "${{ inputs.run-slow }}" == "true" ]; then
export QISKIT_TESTS="run_slow"
fi
if [ "${{ inputs.os }}" == "ubuntu-latest" ] && [ "${{ inputs.python-version }}" == "3.8" ]; then
export PYTHON="coverage3 run --source qiskit_algorithms --parallel-mode"
fi
stestr --test-path test run 2> >(tee /dev/stderr out.txt > /dev/null)
shell: bash
39 changes: 39 additions & 0 deletions .github/workflows/deploy-code.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# This code is part of Qiskit.
#
# (C) Copyright IBM 2021, 2022.
#
# 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: Deploy Code

on:
push:
tags:
- '*'

jobs:
code_publish:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Deploy to Pypi
env:
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
TWINE_USERNAME: qiskit
run : |
pip install -U twine pip setuptools virtualenv wheel
python3 setup.py sdist bdist_wheel
twine upload dist/qiskit*
shell: bash
Loading

0 comments on commit 785e66c

Please sign in to comment.