Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
labels: ["dependencies"]
schedule:
interval: "weekly"
- package-ecosystem: "pip"
directory: "/"
labels: ["dependencies"]
versioning-strategy: increase
schedule:
interval: "monthly"
23 changes: 23 additions & 0 deletions .github/workflows/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# GitHub Actions workflows

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/).

## Lint check (`lint.yml`)

This workflow checks that the code is formatted properly and follows the style guide (`clang-format` and `clang-tidy`).

## Latest version tests (`test_latest_versions.yml`)

This workflow installs the latest version of tox and runs the current repository's tests.

## Documentation (`docs.yml`)

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`).

## Citation preview (`citation.yml`)

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).

## Release (`release.yml`)

This workflow is triggered by a maintainer pushing a tag that represents a release. It publishes the release to github.com.
72 changes: 72 additions & 0 deletions .github/workflows/citation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Citation preview

on:
push:
branches:
- main
- 'stable/**'
paths: ['CITATION.bib', '.github/workflows/citation.yml']
pull_request:
branches:
- main
- 'stable/**'
paths: ['CITATION.bib', '.github/workflows/citation.yml']

jobs:
build-preview:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- name: Check for non-ASCII characters
run: |
# Fail immediately if there are any non-ASCII characters in
# the BibTeX source. We prefer "escaped codes" rather than
# UTF-8 characters in order to ensure the bibliography will
# display correctly even in documents that do not contain
# \usepackage[utf8]{inputenc}.
if [ -f "CITATION.bib" ]; then
python3 -c 'open("CITATION.bib", encoding="ascii").read()'
fi
- name: Install LaTeX
run: |
if [ -f "CITATION.bib" ]; then
sudo apt-get update
sudo apt-get install -y texlive-latex-base texlive-publishers
fi
- name: Run LaTeX
run: |
if [ -f "CITATION.bib" ]; then
arr=(${GITHUB_REPOSITORY//\// })
export REPO=${arr[1]}
cat <<- EOF > citation-preview.tex
\documentclass[preprint,aps,physrev,notitlepage]{revtex4-2}
\usepackage{hyperref}
\begin{document}
\title{\texttt{$REPO} BibTeX test}
\maketitle
\noindent
\texttt{$REPO}
\cite{$REPO}
\bibliography{CITATION}
\end{document}
EOF
pdflatex citation-preview
fi
- name: Run BibTeX
run: |
if [ -f "CITATION.bib" ]; then
bibtex citation-preview
fi
- name: Re-run LaTeX
run: |
if [ -f "CITATION.bib" ]; then
pdflatex citation-preview
pdflatex citation-preview
fi
- name: Upload PDF
if: always()
uses: actions/upload-artifact@v4
with:
name: citation-preview.pdf
path: citation-preview.pdf
76 changes: 76 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Sphinx

on:
workflow_dispatch:
push:
tags:
- "[0-9]+.[0-9]+.[0-9]+*"
branches:
- main
- 'stable/**'
pull_request:
branches:
- main
- 'stable/**'

jobs:
build:
name: build docs
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: '3.13'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox
sudo apt-get update
sudo apt-get install -y pandoc doxygen
- name: Tell reno to name the upcoming release after the branch we are on
shell: bash
run: |
sed -i.bak -e '/unreleased_version_title:*/d' releasenotes/config.yaml
echo unreleased_version_title: \"Upcoming release \(\`\`${GITHUB_REF_NAME}\`\`\)\" >> releasenotes/config.yaml
- name: Build docs
run: |
tox -e docs
- name: Upload docs artifact for GitHub Pages
uses: actions/upload-pages-artifact@v3
with:
path: docs/_build/html

# Provide a nicely named artifact that extracts into an
# identically named subdirectory.
- name: Prepare nice docs artifact for humans
if: always()
shell: bash
run: |
mkdir artifact
cp -a docs/_build/html artifact/qiskit-addon-utils-htmldocs
- name: Upload nice docs artifact
if: always()
uses: actions/upload-artifact@v4
with:
name: qiskit-addon-utils-htmldocs
path: ./artifact

deploy:
name: deploy docs
if: ${{ github.ref == 'refs/heads/main' }}
needs: build
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
48 changes: 48 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Lint

on:
push:
branches:
- main
- 'stable/**'
pull_request:
branches:
- main
- 'stable/**'

jobs:
lint:
name: lint check
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
- name: Set up Python 3.13
uses: actions/setup-python@v5
with:
python-version: '3.13'
- name: Enable LLVM ppa
shell: bash
run: |
wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc
cat <<EOF | sudo tee -a /etc/apt/sources.list
deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-21 main
deb-src http://apt.llvm.org/jammy/ llvm-toolchain-jammy-21 main
EOF
- name: Install via apt-get
run: |
sudo apt-get update
sudo apt-get install -y fd-find clang-tidy-21 clang-format-21
sudo ln -fs clang-format-21 /usr/bin/clang-format
sudo ln -fs clang-tidy-21 /usr/bin/clang-tidy
sudo ln -fs /usr/bin/fdfind /usr/local/bin/fd
- name: Install tox
run: |
python -m pip install --upgrade pip
pip install tox
- name: Run lint check
run: |
tox -e lintcpp
25 changes: 25 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Publish release

on:
workflow_dispatch:
push:
tags:
- "[0-9]+.[0-9]+.[0-9]+"

jobs:

github:
name: github
runs-on: ubuntu-latest
steps:
- name: Checkout tag
uses: actions/checkout@v4
with:
ref: ${{ github.ref_name }}
- name: Publish release
uses: ghalactic/github-release-from-tag@v5
if: github.ref_type == 'tag'
with:
prerelease: false
token: ${{ secrets.GITHUB_TOKEN }}
generateReleaseNotes: "true"
65 changes: 65 additions & 0 deletions .github/workflows/test_latest_versions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Tests

on:
push:
branches:
- main
- 'stable/**'
pull_request:
branches:
- main
- 'stable/**'
schedule:
- cron: '0 1 * * *'

jobs:
tests:
name: latest version tests (${{ matrix.os }}, ${{ matrix.compiler }})
runs-on: ${{ matrix.os }}
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
include:
# Linux x86_64
- os: ubuntu-22.04
compiler: g++
- os: ubuntu-22.04
compiler: clang++
- os: ubuntu-latest
compiler: g++
- os: ubuntu-latest
compiler: clang++
# Linux ARM
- os: ubuntu-22.04-arm
compiler: g++
- os: ubuntu-22.04-arm
compiler: clang++
# macOS x86_64
- os: macos-13
compiler: clang++
# macOS ARM
- os: macos-latest
compiler: clang++
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y g++ clang cmake ninja-build
- name: Build
shell: bash
run: |
cmake -S . -B build -G Ninja -DCMAKE_CXX_COMPILER=${{ matrix.compiler }} -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON
cmake --build build -j4
- name: Run tests
shell: bash
run: |
./build/sqd_tests
- name: Run benchmarks
shell: bash
run: |
./build/sqd_benchmarks
5 changes: 5 additions & 0 deletions releasenotes/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
encoding: utf8
default_branch: main
unreleased_version_title: "Upcoming release"
earliest_version: 0.1.0
Loading