Skip to content

Commit d68d1ca

Browse files
caleb-johnsonjrm874IceKhan13psschweiashsaki
committed
Initial commit to SQD public repository.
Co-authored-by: Javier Robledo Moreno <[email protected]> Co-authored-by: Iskandar Sitdikov <[email protected]> Co-authored-by: Paul Schweigert <[email protected]> Co-authored-by: Abdullah Ash Saki <[email protected]> Co-authored-by: Stefano Barison <[email protected]>
1 parent 719d6bd commit d68d1ca

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+7855
-0
lines changed
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 a bug! Before you do so, please ensure that you have tested on the latest released version of the code. If it does, please also use the search to see if there are any other related issues or pull requests.
9+
10+
- type: textarea
11+
attributes:
12+
label: Environment
13+
description: Please give the actual version number (_e.g._ 0.1.0) 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-addon-sqd version**:
19+
- **Python version**:
20+
- **Operating system**:
21+
validations:
22+
required: true
23+
24+
- type: textarea
25+
attributes:
26+
label: What is happening and why is it wrong?
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: Traceback
41+
description: If your code provided an error traceback, please paste it below, enclosed 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).
42+
validations:
43+
required: false
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/dependabot.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "github-actions"
4+
directory: "/"
5+
labels: ["dependencies"]
6+
schedule:
7+
interval: "weekly"
8+
- package-ecosystem: "pip"
9+
directory: "/"
10+
labels: ["dependencies"]
11+
versioning-strategy: increase
12+
schedule:
13+
interval: "monthly"

.github/workflows/README.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# GitHub Actions workflows
2+
3+
This directory contains a number of workflows for use with [GitHub Actions](https://docs.github.com/actions). They specify what standards should be expected for development of this software, including pull requests. These workflows are designed to work out of the box for any research software prototype, especially those based on [Qiskit](https://qiskit.org/).
4+
5+
## Lint check (`lint.yml`)
6+
7+
This workflow checks that the code is formatted properly and follows the style guide by installing tox and running the [lint environment](/tests/#lint-environment) (`tox -e lint`).
8+
9+
## Latest version tests (`test_latest_versions.yml`)
10+
11+
This workflow installs the latest version of tox and runs [the current repository's tests](/tests/#test-py-environments) under each supported Python version on Linux and under a single Python version on macOS and Windows. This is the primary testing workflow. It runs for all code changes and additionally once per day, to ensure tests continue to pass as new versions of dependencies are released.
12+
13+
## Development version tests (`test_development_versions.yml`)
14+
15+
This workflow installs tox and modifies `pyproject.toml` to use the _development_ versions of certain Qiskit packages, using [extremal-python-dependencies](https://github.com/IBM/extremal-python-dependencies). For all other packages, the latest version is installed. This workflow runs on two versions of Python: the minimum supported version and the maximum supported version. Its purpose is to identify as soon as possible (i.e., before a Qiskit release) when changes in Qiskit will break the current repository. This workflow runs for all code changes, as well as on a timer once per day.
16+
17+
## Minimum version tests (`test_minimum_versions.yml`)
18+
19+
This workflow first installs the minimum supported tox version (the `minversion` specified in [`tox.ini`](/tox.ini)) and then installs the _minimum_ compatible version of each package listed in `pyproject.toml`, using [extremal-python-dependencies](https://github.com/IBM/extremal-python-dependencies). The purpose of this workflow is to make sure the minimum version specifiers in these files are accurate, i.e., that the tests actually pass with these versions. This workflow uses a single Python version, typically the oldest supported version, as the minimum supported versions of each package may not be compatible with the most recent Python release.
20+
21+
Under the hood, this workflow uses a regular expression to change each `>=` and `~=` specifier in the dependencies to instead be `==`, as pip [does not support](https://github.com/pypa/pip/issues/8085) resolving the minimum versions of packages directly. Unfortunately, this means that the workflow will only install the minimum version of a package if it is _explicitly_ listed in one of the requirements files with a minimum version. For instance, if the only listed dependency is `qiskit>=1.0`, this workflow will install `qiskit==1.0` along with the latest version of each transitive dependency, such as `rustworkx`.
22+
23+
## Code coverage (`coverage.yml`)
24+
25+
This workflow tests the [coverage environment](/tests/#coverage-environment) on a single version of Python by installing tox and running `tox -e coverage`.
26+
27+
## Documentation (`docs.yml`)
28+
29+
This workflow ensures that the [Sphinx](https://www.sphinx-doc.org/) documentation builds successfully. It also publishes the resulting build to [GitHub Pages](https://pages.github.com/) if it is from the appropriate branch (e.g., `main`).
30+
31+
## Citation preview (`citation.yml`)
32+
33+
This workflow is only triggered when the `CITATION.bib` file is changed. It ensures that the file contains only ASCII characters ([escaped codes](https://en.wikibooks.org/wiki/LaTeX/Special_Characters#Escaped_codes) are preferred, as then the `bib` file will work even when `inputenc` is not used). It also compiles a sample LaTeX document which includes the citation in its bibliography and uploads the resulting PDF as an artifact so it can be previewed (e.g., before merging a pull request).
34+
35+
## Release (`release.yml`)
36+
37+
This workflow is triggered by a maintainer pushing a tag that represents a release. It publishes the release to github.com and to [PyPI](https://pypi.org/).

.github/workflows/citation.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Citation preview
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
paths: ['CITATION.bib', '.github/workflows/citation.yml']
7+
pull_request:
8+
branches: [ main ]
9+
paths: ['CITATION.bib', '.github/workflows/citation.yml']
10+
11+
jobs:
12+
build-preview:
13+
runs-on: ubuntu-latest
14+
timeout-minutes: 30
15+
steps:
16+
- uses: actions/checkout@v4
17+
- name: Check for non-ASCII characters
18+
run: |
19+
# Fail immediately if there are any non-ASCII characters in
20+
# the BibTeX source. We prefer "escaped codes" rather than
21+
# UTF-8 characters in order to ensure the bibliography will
22+
# display correctly even in documents that do not contain
23+
# \usepackage[utf8]{inputenc}.
24+
if [ -f "CITATION.bib" ]; then
25+
python3 -c 'open("CITATION.bib", encoding="ascii").read()'
26+
fi
27+
- name: Install LaTeX
28+
run: |
29+
if [ -f "CITATION.bib" ]; then
30+
sudo apt-get update
31+
sudo apt-get install -y texlive-latex-base texlive-publishers
32+
fi
33+
- name: Run LaTeX
34+
run: |
35+
if [ -f "CITATION.bib" ]; then
36+
arr=(${GITHUB_REPOSITORY//\// })
37+
export REPO=${arr[1]}
38+
cat <<- EOF > citation-preview.tex
39+
\documentclass[preprint,aps,physrev,notitlepage]{revtex4-2}
40+
\usepackage{hyperref}
41+
\begin{document}
42+
\title{\texttt{$REPO} BibTeX test}
43+
\maketitle
44+
\noindent
45+
\texttt{$REPO}
46+
\cite{$REPO}
47+
\bibliography{CITATION}
48+
\end{document}
49+
EOF
50+
pdflatex citation-preview
51+
fi
52+
- name: Run BibTeX
53+
run: |
54+
if [ -f "CITATION.bib" ]; then
55+
bibtex citation-preview
56+
fi
57+
- name: Re-run LaTeX
58+
run: |
59+
if [ -f "CITATION.bib" ]; then
60+
pdflatex citation-preview
61+
pdflatex citation-preview
62+
fi
63+
- name: Upload PDF
64+
if: always()
65+
uses: actions/upload-artifact@v4
66+
with:
67+
name: citation-preview.pdf
68+
path: citation-preview.pdf

.github/workflows/coverage.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Code coverage
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- 'stable/**'
8+
pull_request:
9+
branches:
10+
- main
11+
- 'stable/**'
12+
13+
jobs:
14+
coverage:
15+
name: coverage (${{ matrix.os }}, ${{ matrix.python-version }})
16+
runs-on: ${{ matrix.os }}
17+
timeout-minutes: 30
18+
strategy:
19+
max-parallel: 4
20+
matrix:
21+
os: [ubuntu-latest]
22+
python-version: ["3.10"]
23+
steps:
24+
- uses: actions/checkout@v4
25+
- name: Set up Python ${{ matrix.python-version }}
26+
uses: actions/setup-python@v5
27+
with:
28+
python-version: ${{ matrix.python-version }}
29+
- name: Install tox
30+
run: |
31+
python -m pip install --upgrade pip
32+
pip install tox coverage
33+
- name: Run coverage
34+
run: |
35+
tox -e coverage
36+
- name: Convert to lcov
37+
run: coverage3 lcov -o coveralls.lcov
38+
- name: Upload report to Coveralls
39+
uses: coverallsapp/github-action@v2
40+
with:
41+
github-token: ${{ secrets.GITHUB_TOKEN }}
42+
file: coveralls.lcov
43+
format: lcov

.github/workflows/docs.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Build Sphinx docs
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
tags:
7+
- "[0-9]+.[0-9]+.[0-9]+*"
8+
branches:
9+
- main
10+
- 'stable/**'
11+
pull_request:
12+
branches:
13+
- main
14+
- 'stable/**'
15+
16+
jobs:
17+
build_and_deploy_docs:
18+
runs-on: ubuntu-latest
19+
timeout-minutes: 20
20+
steps:
21+
- uses: actions/checkout@v4
22+
with:
23+
fetch-depth: 0
24+
- uses: actions/setup-python@v5
25+
with:
26+
python-version: '3.9'
27+
- name: Install dependencies
28+
run: |
29+
python -m pip install --upgrade pip
30+
pip install tox
31+
sudo apt-get update
32+
sudo apt-get install -y pandoc
33+
- name: Tell reno to name the upcoming release after the branch we are on
34+
shell: bash
35+
run: |
36+
sed -i.bak -e '/unreleased_version_title:*/d' releasenotes/config.yaml
37+
echo unreleased_version_title: \"Upcoming release \(\`\`${GITHUB_REF_NAME}\`\`\)\" >> releasenotes/config.yaml
38+
- name: Build docs
39+
shell: bash
40+
run: |
41+
tox -edocs
42+
- name: Prepare docs artifact
43+
if: always()
44+
shell: bash
45+
run: |
46+
mkdir artifact
47+
cp -a docs/_build/html artifact/addon_sqd_html_docs
48+
- name: Upload docs artifact
49+
if: always()
50+
uses: actions/upload-artifact@v4
51+
with:
52+
name: addon_sqd_html_docs
53+
path: ./artifact
54+
- name: Deploy docs
55+
if: ${{ github.ref == 'refs/heads/stable/0.3' }}
56+
uses: peaceiris/actions-gh-pages@v4
57+
with:
58+
github_token: ${{ secrets.GITHUB_TOKEN }}
59+
publish_dir: ./docs/_build/html/

.github/workflows/lint.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Lint check
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- 'stable/**'
8+
pull_request:
9+
branches:
10+
- main
11+
- 'stable/**'
12+
13+
jobs:
14+
lint:
15+
runs-on: ubuntu-latest
16+
timeout-minutes: 30
17+
steps:
18+
- uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
21+
- name: Set up Python 3.10
22+
uses: actions/setup-python@v5
23+
with:
24+
python-version: '3.10'
25+
- name: Install tox
26+
run: |
27+
python -m pip install --upgrade pip
28+
pip install tox
29+
- name: Run lint check
30+
shell: bash
31+
run: |
32+
tox -elint

.github/workflows/release.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Publish release
2+
3+
on:
4+
push:
5+
tags:
6+
- "[0-9]+.[0-9]+.[0-9]+*"
7+
8+
jobs:
9+
10+
github:
11+
name: github
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout tag
15+
uses: actions/checkout@v4
16+
with:
17+
ref: ${{ github.ref_name }}
18+
- name: Publish release
19+
uses: ghalactic/github-release-from-tag@v5
20+
if: github.ref_type == 'tag'
21+
with:
22+
token: ${{ secrets.GITHUB_TOKEN }}
23+
generateReleaseNotes: "true"
24+
25+
pypi:
26+
name: pypi
27+
runs-on: ubuntu-latest
28+
needs: github
29+
environment:
30+
name: pypi
31+
url: https://pypi.org/p/qiskit-addon-sqd
32+
permissions:
33+
id-token: write
34+
steps:
35+
- name: Checkout tag
36+
uses: actions/checkout@v4
37+
with:
38+
ref: ${{ github.ref_name }}
39+
- name: Install `build` tool
40+
run: |
41+
python -m pip install --upgrade pip
42+
pip install build
43+
- name: Build distribution
44+
run: |
45+
python -m build
46+
- name: Publish release to PyPI
47+
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)