Skip to content

Commit

Permalink
Merge pull request #279 from QuTech-Delft/update-master-to-release-1.0.0
Browse files Browse the repository at this point in the history
Update `master` to release 1.0.0
  • Loading branch information
rturrado authored Jan 31, 2025
2 parents fa8ccae + 010fe38 commit 5c08166
Show file tree
Hide file tree
Showing 63 changed files with 474 additions and 459 deletions.
2 changes: 2 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ BasedOnStyle: Google
Language: Cpp
AccessModifierOffset: -4
AlignAfterOpenBracket: DontAlign
AlignArrayOfStructures: Right
AlignOperands: DontAlign
AlignTrailingComments: false
AllowAllArgumentsOnNextLine: true
Expand Down Expand Up @@ -31,6 +32,7 @@ IndentWidth: 4
LambdaBodyIndentation: Signature
PackConstructorInitializers: Never
PointerAlignment: Left
QualifierAlignment: Left
ReferenceAlignment: Left
ReflowComments: true
SpacesBeforeTrailingComments: 2
Expand Down
48 changes: 48 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
Checks: |
-*,
clang-analyzer-*,
clang-diagnostic-*,
misc-*,
-misc-const-correctness,
-misc-include-cleaner
-misc-non-private-member-variables-in-classes,
-misc-no-recursion,
-misc-unused-alias-decls,
-misc-unused-parameters,
-misc-use-anonymous-namespace,
modernize-*,
-modernize-use-trailing-return-type,
readability-identifier-naming,
CheckOptions:
- key: readability-identifier-naming.ClassCase
value: CamelCase
- key: readability-identifier-naming.ClassIgnoredRegexp
value: "bf_cp|f_cp|uf_cp"
- key: readability-identifier-naming.EnumCase
value: CamelCase
- key: readability-identifier-naming.FunctionCase
value: lower_case
- key: readability-identifier-naming.FunctionIgnoredRegexp
value: ".*_|SetUp|MOCK_METHOD|TEST|TEST_F|TestBody\
|DescribeNegationTo|DescribeTo|MatchAndExplain|ValuesEq\
|addErrorListener|copyNodeAnnotation|expandNodeAnnotation|setNodeAnnotation|syntaxError\
|visit.*"
- key: readability-identifier-naming.MemberCase
value: lower_case
- key: readability-identifier-naming.MemberIgnoredRegexp
value: ".*_"
- key: readability-identifier-naming.ParameterCase
value: lower_case
- key: readability-identifier-naming.ParameterIgnoredRegexp
value: ".*_|AnalysisResult|ParseResult"
- key: readability-identifier-naming.UnionCase
value: CamelCase
- key: readability-identifier-naming.VariableCase
value: lower_case
- key: readability-identifier-naming.IgnoreMainLikeFunctions
value: 1
- key: readability-redundant-member-init.IgnoreBaseInCopyConstructors
value: 1
- key: modernize-use-default-member-init.UseAssignment
value: 1
51 changes: 12 additions & 39 deletions .github/workflows/assets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,55 +14,29 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
# macos-13 is an x64 runner, macos-14 is an arm64 runner
os: [ubuntu-latest, windows-latest, macos-13, macos-14]
os: [
ubuntu-latest, # Linux/x64
macos-13, # MacOS/x64
windows-latest, # Windows/x64
ubuntu-24.04-arm, # Linux/ARM64
macos-14 # MacOS/ARM64
]
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-python@v5
- name: Install cibuildwheel
run: python -m pip install cibuildwheel==2.18.1
- name: Build wheels
run: python -m cibuildwheel --output-dir wheelhouse
- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}
path: ./wheelhouse/*.whl

cibw-wheels-linux-arm64:
name: Build wheels on linux-arm64
runs-on: [self-hosted, ARM64, Linux]
container:
image: python:3.12-slim
volumes:
- /var/run/docker.sock:/var/run/docker.sock
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-python@v5
- name: Install docker
run: |
apt-get update
apt-get install -y ca-certificates curl
install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
chmod a+r /etc/apt/keyrings/docker.asc
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
tee /etc/apt/sources.list.d/docker.list > /dev/null
apt-get update
apt-get install -y docker-ce-cli
- name: Install cibuildwheel and build wheels
python -m pip install cibuildwheel==2.18.1
- name: Build wheels
run: |
pip install cibuildwheel==2.18.1
cibuildwheel --output-dir wheelhouse
python -m cibuildwheel --output-dir wheelhouse
if: ${{ matrix.os == 'ubuntu-24.04-arm' }}
env:
CIBW_BEFORE_ALL_LINUX: yum install -y java-11-openjdk
- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-linux-arm64
name: cibw-wheels-${{ matrix.os }}
path: ./wheelhouse/*.whl

emscripten-wasm:
Expand Down Expand Up @@ -108,7 +82,6 @@ jobs:
name: Publish Python packages
needs:
- cibw-wheels
- cibw-wheels-linux-arm64
- emscripten-wasm
runs-on: ubuntu-latest
steps:
Expand Down
16 changes: 13 additions & 3 deletions .github/workflows/linters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,28 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build C++ tests (gcc-clang/Linux/x64)
uses: ./.github/actions/cpp-tests
with:
build_type: Release
conan_profile_host: conan/profiles/tests-release-gcc-linux-x64
shell: bash
- name: Run C++ linters
uses: cpp-linter/cpp-linter-action@v2
id: linter
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
database: '${{ github.workspace }}/build/Release'
extensions: 'cpp,hpp'
ignore: 'emscripten/emscripten_wrapper.hpp'
style: 'file' # use .clang-format config file
tidy-checks: '-*' # disable clang-tidy checks
tidy-checks: '' # use .clang-tidy config file
version: 18
- name: Fail fast
if: steps.linter.outputs.clang-format-checks-failed > 0
if: steps.linter.outputs.checks-failed > 0
run: |
echo "::notice::Try executing 'python3 ./scripts/run_cpp_linters.py .' to fix linter issues."
echo "::notice::Try running the following commands to fix and/or understand linter issues:"
echo "::notice:: conan build . -pr:a=conan/profiles/tests-release-gcc-linux-x64 -b missing"
echo "::notice:: python3 ./scripts/run_cpp_linters.py ."
exit 1
72 changes: 36 additions & 36 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,43 +23,41 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install libc++
run: |
sudo apt-get update
sudo apt-get install -y libc++-dev libc++abi-dev
- uses: ./.github/actions/cpp-tests
with:
build_type: ${{ matrix.build_type }}
conan_profile_host: conan/profiles/tests-${{ matrix.build_type }}-${{ matrix.compiler }}-linux-x64
conan_profile_build: conan/profiles/tests-${{ matrix.build_type }}-${{ matrix.compiler }}-linux-x64
shell: bash

cpp-linux-arm64:
name: "C++ tests (gcc/Linux/ARM64)"
runs-on: [self-hosted, ARM64, Linux]
container: python:3.11
# Run only when merging to develop
# (until we have a GitHub-hosted runner for Linux/ARM64)
if: github.ref == 'refs/heads/develop'
runs-on: ubuntu-24.04-arm
strategy:
fail-fast: false
matrix:
build_type:
- Debug
- Release
compiler:
- clang
- gcc
steps:
- name: Checkout
uses: actions/checkout@v4
# We are having problems when using zulu-opendjk Conan package on an armv8 architecture.
# zulu-openjdk provides the Java JRE required by the ANTLR generator.
# So, for the time being, we are installing Java manually for this platform
- name: Install dependencies
- name: Install libc++
run: |
apt-get update
apt-get install -y default-jre pipx
# Add Conan to path (even before it is installed)
- name: Add Conan to path
run: |
echo "${HOME}/.local/bin" >> $GITHUB_PATH
sudo apt-get update
sudo apt-get install -y libc++-dev libc++abi-dev
- uses: ./.github/actions/cpp-tests
with:
build_type: ${{ matrix.build_type }}
conan_profile_host: conan/profiles/tests-${{ matrix.build_type }}-gcc-linux-arm64
conan_profile_host: conan/profiles/tests-${{ matrix.build_type }}-${{ matrix.compiler }}-linux-arm64
conan_profile_build: conan/profiles/tests-${{ matrix.build_type }}-${{ matrix.compiler }}-linux-arm64
shell: bash

cpp-macos-x64:
Expand All @@ -78,11 +76,12 @@ jobs:
with:
build_type: ${{ matrix.build_type }}
conan_profile_host: conan/profiles/tests-${{ matrix.build_type }}-apple_clang-macos-x64
conan_profile_build: conan/profiles/tests-${{ matrix.build_type }}-apple_clang-macos-x64
shell: bash

cpp-macos-arm64:
name: "C++ tests (clang/macos/ARM64)"
runs-on: macos-14 # arm64
runs-on: macos-14 # ARM4
strategy:
fail-fast: false
matrix:
Expand All @@ -96,6 +95,7 @@ jobs:
with:
build_type: ${{ matrix.build_type }}
conan_profile_host: conan/profiles/tests-${{ matrix.build_type }}-apple_clang-macos-arm64
conan_profile_build: conan/profiles/tests-${{ matrix.build_type }}-apple_clang-macos-arm64
shell: bash

cpp-windows-x64:
Expand Down Expand Up @@ -133,6 +133,7 @@ jobs:
with:
build_type: ${{ matrix.build_type }}
conan_profile_host: conan/profiles/${{ matrix.build_type }}-gcc-linux-x64-shared
conan_profile_build: conan/profiles/${{ matrix.build_type }}-gcc-linux-x64-shared
shell: bash

ts-emscripten-wasm:
Expand Down Expand Up @@ -190,9 +191,19 @@ jobs:
run: |
sudo apt-get install -y swig
shell: bash
- name: Export LIBQASM_BUILD_TYPE
- uses: ./.github/actions/python-tests
with:
shell: bash

python-linux-arm64:
name: "Python tests (Linux/arm64)"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install SWIG
run: |
echo "LIBQASM_BUILD_TYPE=Debug" >> $GITHUB_ENV
sudo apt-get install -y swig
shell: bash
- uses: ./.github/actions/python-tests
with:
Expand All @@ -208,10 +219,6 @@ jobs:
run: |
brew install swig
shell: bash
- name: Export LIBQASM_BUILD_TYPE
run: |
echo "LIBQASM_BUILD_TYPE=Debug" >> $GITHUB_ENV
shell: bash
- uses: ./.github/actions/python-tests
with:
shell: bash
Expand All @@ -222,14 +229,10 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install dependencies
- name: Install SWIG
run: |
brew install swig
shell: bash
- name: Export LIBQASM_BUILD_TYPE
run: |
echo "LIBQASM_BUILD_TYPE=Debug" >> $GITHUB_ENV
shell: bash
- uses: ./.github/actions/python-tests
with:
shell: bash
Expand All @@ -240,10 +243,6 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Export LIBQASM_BUILD_TYPE
run: |
echo "LIBQASM_BUILD_TYPE=Release" >> $env:GITHUB_ENV
shell: powershell
- uses: ./.github/actions/python-tests
with:
shell: bash
Expand All @@ -266,15 +265,17 @@ jobs:
# see https://github.community/t/status-check-for-a-matrix-jobs/127354/7
name: Report status
needs:
- cpp-shared
- cpp-linux-x64
- cpp-macos-x64
- cpp-windows-x64
- cpp-linux-arm64
- cpp-macos-x64
- cpp-macos-arm64
- cpp-windows-x64
- cpp-shared
- ts-emscripten-wasm
- python-linux-x64
- python-linux-arm64
- python-macos-x64
- python-macos-arm64
- python-windows-x64
- docker
if: ${{ always() }}
Expand All @@ -290,7 +291,6 @@ jobs:
|| (
github.ref != 'refs/heads/develop'
&& contains(needs.*.result, 'skipped')
&& !contains(needs.cpp-linux-arm64.result, 'skipped')
)
||
(
Expand Down
Loading

0 comments on commit 5c08166

Please sign in to comment.