Skip to content

Commit

Permalink
✨ improve CI/CD and package itself (#322)
Browse files Browse the repository at this point in the history
This PR
- improves the CI/CD workflows
- improves the mqt.bench package structure by moving mqt.benchviewer
into mqt.bench.viewer
- implements multiple small improvements revealed by the more
comprehensive tests

---------

Signed-off-by: burgholzer <burgholzer@me.com>
Co-authored-by: burgholzer <burgholzer@me.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
3 people committed Apr 24, 2024
1 parent 0aaca11 commit e1772c3
Show file tree
Hide file tree
Showing 33 changed files with 295 additions and 382 deletions.
3 changes: 3 additions & 0 deletions .github/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@ coverage:
patch:
default:
threshold: 1%
codecov:
notify:
after_n_builds: 8
60 changes: 60 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: CD
on:
release:
types: [published]
workflow_dispatch:

jobs:
python-packaging:
name: 🐍 Packaging
uses: cda-tum/mqt-core/.github/workflows/reusable-python-packaging.yml@v2.4.1
with:
pure-python: true

deploy:
if: github.event_name == 'release' && github.event.action == 'published'
name: 🚀 Deploy to PyPI
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/mqt.bench
permissions:
id-token: write
needs: [python-packaging]
steps:
- uses: actions/download-artifact@v4
with:
pattern: cibw-*
path: dist
merge-multiple: true
- uses: pypa/gh-action-pypi-publish@release/v1

upload_webserver:
if: github.event_name == 'release' && github.event.action == 'published'
name: 🚀 Deploy to Webserver
needs: deploy
runs-on: ubuntu-latest
env:
DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }}
KNOWN_HOSTS: ${{ secrets.KNOWN_HOSTS }}
CDA_HOST_NAME: tueicda-cda.srv.mwn.de
CDA_USER_NAME: web-user
CDA_TARGET_DIR: /var/www/cda/app/mqtbench/
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Create version file
run: |
echo "version = \"$(git describe --tags --always)\"" > mqtbench_version.txt
- name: Setup SSH via the stored Action Secrets
run: |
mkdir -p ~/.ssh
echo "${KNOWN_HOSTS}" >> ~/.ssh/known_hosts
echo "${DEPLOY_KEY}" > ~/.ssh/my_rsync_key
echo "IdentityFile ~/.ssh/my_rsync_key" >> ~/.ssh/config
chmod -R 700 ~/.ssh
- name: Copy version file to the webserver
working-directory: ${{ github.workspace }}
run: |
rsync -avz -e ssh mqtbench_version.txt ${CDA_USER_NAME}@${CDA_HOST_NAME}:${CDA_TARGET_DIR}/mqtbench_version.txt
54 changes: 54 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: CI
on:
push:
branches:
- main
pull_request:
merge_group:
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
change-detection:
name: 🔍 Change
uses: cda-tum/mqt-core/.github/workflows/reusable-change-detection.yml@v2.4.1

python-tests:
name: 🐍 Test
needs: change-detection
if: fromJSON(needs.change-detection.outputs.run-python-tests)
uses: cda-tum/mqt-core/.github/workflows/reusable-python-ci.yml@v2.4.1
secrets:
token: ${{ secrets.CODECOV_TOKEN }}

code-ql:
name: 📝 CodeQL
needs: change-detection
if: fromJSON(needs.change-detection.outputs.run-code-ql)
uses: cda-tum/mqt-core/.github/workflows/reusable-code-ql-python.yml@v2.4.1

required-checks-pass: # This job does nothing and is only used for branch protection
name: 🚦 Check
if: always()
needs:
- change-detection
- python-tests
- code-ql
runs-on: ubuntu-latest
steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
with:
allowed-skips: >-
${{
fromJSON(needs.change-detection.outputs.run-python-tests)
&& '' || 'python-tests,'
}}
${{
fromJSON(needs.change-detection.outputs.run-code-ql)
&& '' || 'code-ql,'
}}
jobs: ${{ toJSON(needs) }}
44 changes: 0 additions & 44 deletions .github/workflows/codeql.yml

This file was deleted.

34 changes: 0 additions & 34 deletions .github/workflows/coverage.yml

This file was deleted.

101 changes: 0 additions & 101 deletions .github/workflows/deploy.yml

This file was deleted.

25 changes: 0 additions & 25 deletions .github/workflows/mypy.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ jobs:
steps:
- uses: release-drafter/release-drafter@v6
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ github.token }}
28 changes: 0 additions & 28 deletions .github/workflows/test_pregenerated_zip.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ repos:
hooks:
- id: codespell
args: ["-L", "wille,linz,fro"]
exclude: "mqt/benchviewer/templates/legal.html"
exclude: "mqt/bench/viewer/templates/legal.html"

# Format configuration files with prettier
- repo: https://github.com/pre-commit/mirrors-prettier
Expand Down
10 changes: 1 addition & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

MQT Bench is a quantum circuit benchmark suite with cross-level support, i.e., providing the same benchmark algorithms for different abstraction levels throughout the quantum computing
software stack.
MQT Bench is part of the [_Munich Quantum Toolkit_ (_MQT_)](https://mqt.readthedocs.io) developed by the [Chair for Design Automation](https://www.cda.cit.tum.de/) at the [Technical University of Munich](https://www.tum.de/).

<p align="center">
<a href="https://mqt.readthedocs.io/projects/bench">
Expand Down Expand Up @@ -51,15 +52,6 @@ print(qc_algorithmic_level.draw())

**Detailed documentation and examples are available at [ReadTheDocs](https://mqt.readthedocs.io/projects/bench).**

# Repository Structure

- src/mqt/: main source directory
- bench: Directory for the MQT Bench package
- bench/benchmarks: Directory for the benchmarks
- benchviewer: Directory for the webpage (which can be started locally and is also hosted at
[https://www.cda.cit.tum.de/mqtbench/](https://www.cda.cit.tum.de/mqtbench/))
- tests: Directory for the tests for MQT Bench

## Acknowledgements

The Munich Quantum Toolkit has been supported by the European
Expand Down
Loading

0 comments on commit e1772c3

Please sign in to comment.