Skip to content

Commit

Permalink
🔧 switch to reusable workflows from mqt-core
Browse files Browse the repository at this point in the history
  • Loading branch information
burgholzer committed Dec 12, 2023
1 parent e62ee22 commit 17abc6c
Show file tree
Hide file tree
Showing 5 changed files with 88 additions and 228 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: CD
on:
release:
types: [published]
workflow_dispatch:

jobs:
python-packaging:
name: 🐍 Packaging
uses: cda-tum/mqt-core/.github/workflows/[email protected]
with:
setup-z3: 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.qusat
permissions:
id-token: write
needs: [python-packaging]
steps:
- uses: actions/download-artifact@v3
with:
name: artifact
path: dist
- uses: pypa/gh-action-pypi-publish@release/v1
112 changes: 57 additions & 55 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,69 +1,71 @@
name: C++

name: CI
on:
pull_request:
push:
branches:
- main
pull_request:
merge_group:
workflow_dispatch:

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

defaults:
run:
shell: bash

env:
CMAKE_BUILD_PARALLEL_LEVEL: 3
Z3_VERSION: 4.11.2

jobs:
change-detection:
name: 🔍 Change
uses: cda-tum/mqt-core/.github/workflows/[email protected]

cpp-tests:
name: Tests ${{ matrix.config.os }}
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- { os: ubuntu-latest, test-dir: build/test, toolchain: "" }
- { os: macos-latest, test-dir: build/test, toolchain: "" }
- {
os: windows-latest,
test-dir: build\test\Release,
toolchain: "-T ClangCl",
}
name: 🇨‌ Test
needs: change-detection
if: fromJSON(needs.change-detection.outputs.run-cpp-tests)
uses: cda-tum/mqt-core/.github/workflows/[email protected]
secrets:
token: ${{ secrets.CODECOV_TOKEN }}
with:
setup-z3: true

cpp-linter:
name: 🇨‌ Lint
needs: change-detection
if: fromJSON(needs.change-detection.outputs.run-cpp-linter)
uses: cda-tum/mqt-core/.github/workflows/[email protected]
with:
setup-z3: true

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@main
with:
setup-z3: true

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
- code-ql
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Z3
uses: cda-tum/setup-z3@v1
with:
version: ${{ env.Z3_VERSION }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Configure CMake
run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DBUILD_QUSAT_TESTS=ON ${{ matrix.config.toolchain }}
- name: Build
run: cmake --build build --config Release
- name: Test
working-directory: ${{ matrix.config.test-dir }}
run: ctest -C Release --output-on-failure
- if: runner.os == 'Linux'
name: Coverage
run: |
cmake -S . -B buildCov -DCMAKE_BUILD_TYPE=Debug -DBUILD_QUSAT_TESTS=ON -DENABLE_COVERAGE=ON
cmake --build buildCov --config Debug
cd buildCov/test
ctest -C Debug --output-on-failure
- if: runner.os == 'Linux'
name: Upload coverage to Codecov
uses: codecov/[email protected]
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
with:
fail_ci_if_error: true
flags: cpp
gcov: true
gcov_ignore: "extern/**/*"
token: ${{ secrets.CODECOV_TOKEN }}
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-code-ql)
&& '' || 'code-ql,'
}}
jobs: ${{ toJSON(needs) }}
77 changes: 0 additions & 77 deletions .github/workflows/codeql-analysis.yml

This file was deleted.

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

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: 📝 • Release Drafter
name: Release Drafter

on:
push:
Expand All @@ -20,4 +20,4 @@ jobs:
steps:
- uses: release-drafter/release-drafter@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ github.token }}

0 comments on commit 17abc6c

Please sign in to comment.