From d35d1b076e060d074b3ca717b37d471bfaba7a14 Mon Sep 17 00:00:00 2001 From: burgholzer Date: Fri, 19 Apr 2024 21:33:03 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=B7=20CI=20setup?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/codecov.yml | 52 +++++++++++++++++ .github/dependabot.yml | 36 ++++++++++++ .github/release-drafter.yml | 54 ++++++++++++++++++ .github/workflows/cd.yml | 26 ++++++++- .github/workflows/ci.yml | 81 ++++++++++++++++++++++++++- .github/workflows/codecov.yml | 4 -- .github/workflows/python-publish.yml | 36 ------------ .github/workflows/release-drafter.yml | 23 ++++++++ 8 files changed, 270 insertions(+), 42 deletions(-) create mode 100644 .github/codecov.yml create mode 100644 .github/dependabot.yml create mode 100644 .github/release-drafter.yml delete mode 100644 .github/workflows/codecov.yml delete mode 100644 .github/workflows/python-publish.yml create mode 100644 .github/workflows/release-drafter.yml diff --git a/.github/codecov.yml b/.github/codecov.yml new file mode 100644 index 0000000..0a91a39 --- /dev/null +++ b/.github/codecov.yml @@ -0,0 +1,52 @@ +ignore: + - "extern/**/*" + - "include/GateMatrixDefinitions.h" + - "**/python" + - "test/**/*" + +coverage: + range: 60..90 + precision: 1 + status: + project: off + patch: off + +flag_management: + default_rules: + carryforward: true + statuses: + - type: project + target: auto + threshold: 0.5% + removed_code_behavior: adjust_base + - type: patch + target: 90% + threshold: 1% + individual_flags: + - name: cpp + paths: + - "include" + - "src" + after_n_builds: 1 + - name: python + paths: + - "src/mqt/**/*.py" + after_n_builds: 12 + statuses: + - type: project + threshold: 0.5% + removed_code_behavior: adjust_base + - type: patch + target: 95% + threshold: 1% + +parsers: + gcov: + branch_detection: + conditional: no + loop: no + +comment: + layout: "reach, diff, flags, files" + require_changes: true + show_carryforward_flags: true diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..ea60e7e --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,36 @@ +version: 2 +updates: + - package-ecosystem: "gitsubmodule" + directory: "/" + groups: + submodules: + patterns: + - "*" + schedule: + interval: "monthly" + time: "06:00" + timezone: "Europe/Vienna" + + - package-ecosystem: "github-actions" + directory: "/" + groups: + github-actions: + patterns: + - "*" + schedule: + interval: "weekly" + day: "friday" + time: "06:00" + timezone: "Europe/Vienna" + + - package-ecosystem: "pip" + directory: "/" + groups: + python-dependencies: + patterns: + - "*" + schedule: + interval: "weekly" + day: "friday" + time: "06:00" + timezone: "Europe/Vienna" diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml new file mode 100644 index 0000000..8fe48a0 --- /dev/null +++ b/.github/release-drafter.yml @@ -0,0 +1,54 @@ +name-template: "MQT Qudits $RESOLVED_VERSION Release" +tag-template: "v$RESOLVED_VERSION" +categories: + - title: "๐Ÿš€ Features and Enhancements" + labels: + - "feature" + - "enhancement" + - "usability" + - title: "๐Ÿ› Bug Fixes" + labels: + - "bug" + - "fix" + - title: "๐Ÿ“„ Documentation" + labels: + - "documentation" + - title: "๐Ÿค– CI" + labels: + - "continuous integration" + - title: "๐Ÿ“ฆ Packaging" + labels: + - "packaging" + - title: "๐Ÿงน Code Quality" + labels: + - "code quality" + - title: "โฌ†๏ธ Dependencies" + collapse-after: 5 + labels: + - "dependencies" + - "submodules" + - "github_actions" +change-template: "- $TITLE @$AUTHOR (#$NUMBER)" +change-title-escapes: '\<*_&' +version-resolver: + major: + labels: + - "major" + minor: + labels: + - "minor" + patch: + labels: + - "patch" + default: patch +autolabeler: + - label: "dependencies" + title: + - "/update pre-commit hooks/i" + +template: | + ## ๐Ÿ‘€ What Changed + + $CHANGES + + **Full Changelog**: https://github.com/$OWNER/$REPOSITORY/compare/$PREVIOUS_TAG...v$RESOLVED_VERSION diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index c5a96ff..d5c82e5 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -1,4 +1,28 @@ -name: cd.yml +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.0 + + 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.qudits + 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 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c3bdb95..477341c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,83 @@ -name: ci.yml +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.0 + + cpp-tests: + name: ๐Ÿ‡จโ€Œ Test + needs: change-detection + if: fromJSON(needs.change-detection.outputs.run-cpp-tests) + uses: cda-tum/mqt-core/.github/workflows/reusable-cpp-ci.yml@v2.4.0 + secrets: + token: ${{ secrets.CODECOV_TOKEN }} + with: + cmake-args: "" + cmake-args-ubuntu: -G Ninja + cmake-args-macos: -G Ninja + cmake-args-windows: -T ClangCL + + cpp-linter: + name: ๐Ÿ‡จโ€Œ Lint + needs: change-detection + if: fromJSON(needs.change-detection.outputs.run-cpp-linter) + uses: cda-tum/mqt-core/.github/workflows/reusable-cpp-linter.yml@v2.4.0 + + 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.0 + 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.yml@v2.4.0 + + required-checks-pass: # This job does nothing and is only used for branch protection + name: ๐Ÿšฆ Check + if: always() + needs: + - change-detection + - cpp-tests + - cpp-linter + - 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-cpp-tests) + && '' || 'cpp-tests,' + }} + ${{ + fromJSON(needs.change-detection.outputs.run-cpp-linter) + && '' || 'cpp-linter,' + }} + ${{ + fromJSON(needs.change-detection.outputs.run-python-tests) + && '' || 'python-tests,' + }} + ${{ + fromJSON(needs.change-detection.outputs.run-code-ql) + && '' || 'code-ql,' + }} + jobs: ${{ toJSON(needs) }} diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml deleted file mode 100644 index e2264b4..0000000 --- a/.github/workflows/codecov.yml +++ /dev/null @@ -1,4 +0,0 @@ -name: codecov.yml -on: - -jobs: diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml deleted file mode 100644 index 6e3d4ce..0000000 --- a/.github/workflows/python-publish.yml +++ /dev/null @@ -1,36 +0,0 @@ -name: Deploy to PyPI - -on: - release: - types: [published] - push: - branches: [main] - pull_request: - branches: [main] - workflow_dispatch: - -jobs: - test_routine: - name: Test Python Routine - - runs-on: ${{ matrix.os }} - - strategy: - matrix: - os: [ubuntu-latest, windows-latest, macos-latest] - - steps: - - uses: actions/checkout@v3 - with: - submodules: recursive - - uses: actions/setup-python@v4 - name: Install Python - with: - python-version: "3.9" - - name: Install package - run: | - pip install -U pip setuptools wheel - pip3 install . - - - name: Test package - run: python -m unittest discover -s ./tests diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml new file mode 100644 index 0000000..02b6951 --- /dev/null +++ b/.github/workflows/release-drafter.yml @@ -0,0 +1,23 @@ +name: Release Drafter + +on: + push: + branches: + - main + pull_request_target: + types: [opened, reopened, synchronize] + +permissions: + contents: read + +jobs: + update_release_draft: + name: Run + permissions: + contents: write + pull-requests: write + runs-on: ubuntu-latest + steps: + - uses: release-drafter/release-drafter@v6 + env: + GITHUB_TOKEN: ${{ github.token }}