Skip to content

Commit

Permalink
Merge pull request #1127 from CQCL/release/1.22.0
Browse files Browse the repository at this point in the history
Release/1.22.0
  • Loading branch information
cqc-alec authored Nov 22, 2023
2 parents 0e4564c + 3839ad6 commit 39453bf
Show file tree
Hide file tree
Showing 189 changed files with 8,797 additions and 5,425 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build-external-packages
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ PACKAGES="\
gmp/6.2.1@ \
symengine/0.9.0@ \
tklog/0.3.3@tket/stable \
tkassert/0.3.3@tket/stable \
tkassert/0.3.4@tket/stable \
tkrng/0.3.3@tket/stable \
tktokenswap/0.3.3@tket/stable \
tkwsm/0.3.3@tket/stable \
tktokenswap/0.3.6@tket/stable \
tkwsm/0.3.6@tket/stable \
"

for PACKAGE in ${PACKAGES}
Expand Down
20 changes: 20 additions & 0 deletions .github/workflows/build-with-nix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: build with nix
on:
schedule:
# 01:00 every Sunday morning
- cron: '0 1 * * 0'
workflow_dispatch: {}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build_and_test:
strategy:
matrix:
os: ['ubuntu-22.04', 'macos-13-xlarge']
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v23
- name: Build and test tket
run: nix flake check -L
51 changes: 38 additions & 13 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -219,17 +219,6 @@ jobs:
ccache -s #show stats
ccache -z #show stats
build_test_tket_not_required:
name: Build and test (tket)
needs: check_changes
if: needs.check_changes.outputs.tket_or_workflow_changed != 'true'
strategy:
matrix:
os: ['ubuntu-22.04', 'macos-12', 'windows-2022', 'macos-13-xlarge']
runs-on: ${{ matrix.os }}
steps:
- run: echo "no changes to tket"

build_test_pytket_ubuntu:
name: Build and test pytket (ubuntu)
needs: check_changes
Expand Down Expand Up @@ -404,10 +393,10 @@ jobs:
python${{ matrix.python-version }} -m pip install -r requirements.txt
python${{ matrix.python-version }} -m pytest --ignore=simulator/
- name: Check type stubs are up-to-date and run mypy
if: matrix.os == 'macos-12' && (github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch')
if: matrix.os == 'macos-13-xlarge' && (github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch')
run: |
python${{ matrix.python-version }} -m pip install -U mypy
python${{ matrix.python-version }} -m pip install -U pybind11-stubgen
python${{ matrix.python-version }} -m pip install pybind11-stubgen==2.3.6 # https://github.com/CQCL/tket/issues/1135
cd pytket
./stub_generation/regenerate_stubs
git diff --quiet pytket/_tket && echo "Stubs are up-to-date" || exit 1 # fail if stubs change after regeneration
Expand Down Expand Up @@ -577,3 +566,39 @@ jobs:
run: |
wget https://cqcl.github.io/tket/pytket/test-coverage/cov.xml -O oldcov.xml
./.github/workflows/compare-pytket-coverage oldcov.xml pytket-test-coverage/cov.xml
check_all_build_and_test_jobs_successful:
name: All build and test jobs successful (or skipped)
needs:
- check_changes
- check_docs_tket
- check_format_tket
- build_test_tket
- build_test_tket_windows
- publish_pytket_coverage
- build_test_pytket_macos
- build_test_pytket_ubuntu
- build_test_pytket_windows
- publish_pytket_coverage
- check_pytket_coverage
if: always()
runs-on: ubuntu-22.04
steps:
- shell: python
name: Check job results
run: |
results = [
"${{ needs.check_changes.result }}",
"${{ needs.check_docs_tket.result }}",
"${{ needs.check_format_tket.result }}",
"${{ needs.build_test_tket.result }}",
"${{ needs.build_test_tket_windows.result }}",
"${{ needs.publish_pytket_coverage.result }}",
"${{ needs.build_test_pytket_macos.result }}",
"${{ needs.build_test_pytket_ubuntu.result }}",
"${{ needs.build_test_pytket_windows.result }}"
"${{ needs.publish_pytket_coverage.result }}",
"${{ needs.check_pytket_coverage.result }}",
]
if "failure" in results or "cancelled" in results:
raise Exception
6 changes: 3 additions & 3 deletions .github/workflows/linuxbuildpackages
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ PACKAGES="boost/1.81.0@ \
gmp/6.2.1@ \
symengine/0.9.0@ \
tklog/0.3.3@tket/stable \
tkassert/0.3.3@tket/stable \
tkassert/0.3.4@tket/stable \
tkrng/0.3.3@tket/stable \
tktokenswap/0.3.3@tket/stable \
tkwsm/0.3.3@tket/stable"
tktokenswap/0.3.6@tket/stable \
tkwsm/0.3.6@tket/stable"

for PACKAGE in ${PACKAGES}
do
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ jobs:

build_macos_wheels:
name: Build macos wheels
runs-on: macos-11
runs-on: macos-12
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11']
Expand All @@ -92,7 +92,7 @@ jobs:
run: |
conan profile detect
DEFAULT_PROFILE_PATH=`conan profile path default`
PROFILE_PATH=./conan-profiles/macos-11
PROFILE_PATH=./conan-profiles/macos-12
diff ${DEFAULT_PROFILE_PATH} ${PROFILE_PATH} || true
cp ${PROFILE_PATH} ${DEFAULT_PROFILE_PATH}
conan remote add tket-libs https://quantinuumsw.jfrog.io/artifactory/api/conan/tket1-libs --index 0
Expand All @@ -103,8 +103,8 @@ jobs:
conan create recipes/pybind11
conan create recipes/pybind11_json/all --version 0.2.13
cd pytket
# Ensure wheels are compatible with MacOS 10.14 and later:
export WHEEL_PLAT_NAME=macosx_10_14_x86_64
# Ensure wheels are compatible with MacOS 12.0 and later:
export WHEEL_PLAT_NAME=macosx_12_0_x86_64
pip install -U pip build delocate
python -m build
delocate-wheel -v -w "$GITHUB_WORKSPACE/wheelhouse/" "dist/pytket-"*".whl"
Expand Down Expand Up @@ -149,8 +149,8 @@ jobs:
conan create recipes/pybind11
conan create recipes/pybind11_json/all --version 0.2.13
cd pytket
# Ensure wheels are compatible with MacOS 11.0 and later:
export WHEEL_PLAT_NAME=macosx_11_0_arm64
# Ensure wheels are compatible with MacOS 12.0 and later:
export WHEEL_PLAT_NAME=macosx_12_0_arm64
python${{ matrix.python-version }} -m pip install -U pip build delocate
python${{ matrix.python-version }} -m build
delocate-wheel -v -w "$GITHUB_WORKSPACE/wheelhouse/" "dist/pytket-"*".whl"
Expand Down Expand Up @@ -268,7 +268,7 @@ jobs:
needs: build_macos_wheels
strategy:
matrix:
os: ['macos-11', 'macos-12']
os: ['macos-12', 'macos-13']
python-version: ['3.9', '3.10', '3.11']
runs-on: ${{ matrix.os }}
steps:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*.egg-info
*.o
*.so
*.swp
.cache
.eggs
.hypothesis
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,12 @@ building and testing tket as a standalone C++ library.
See the [README](pytket/README.md) in the `pytket` directory for instructions on
building and testing pytket.

### Nix Support

Tket and pytket are available as a Nix flake, with support for Linux and Apple Silicon systems.
See the [README](nix-support/README.md) in the `nix-support` directory for instructions
on building and testing tket and pytket through Nix, and on how to use it within a Nix project.

## API documentation

The `tket` (C++) API documentation (generated with `doxygen`, and still rather
Expand Down
8 changes: 0 additions & 8 deletions conan-profiles/macos-11

This file was deleted.

60 changes: 60 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 31 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
description = "Tket Quantum SDK";
inputs.nixpkgs.url = "github:nixos/nixpkgs";
inputs.flake-utils.url = "github:numtide/flake-utils";
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [
(import ./nix-support/libs.nix)
(import ./nix-support/symengine.nix)
(import ./nix-support/tket.nix)
(import ./nix-support/third-party-python-packages.nix)
(import ./nix-support/pytket.nix)
];
};
in {
packages = {
tket = pkgs.tket;
pytket = pkgs.pytket;
};
devShells = {
default = pkgs.mkShell { buildInputs = [ pkgs.tket pkgs.pytket ]; };
};
checks = {
tket-tests = pkgs.run-tket-tests;
pytket-tests = pkgs.pytket;
};
});
}
9 changes: 7 additions & 2 deletions libs/tkassert/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ find_package(tklog CONFIG REQUIRED)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_EXTENSIONS OFF)

option(INSTALL_NAME_DIR "Set the install name dir for the library to @loader_path for Apple targets" ON)

if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()
Expand All @@ -35,7 +37,7 @@ if(WIN32)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS yes)
endif()

if(APPLE)
if(APPLE AND INSTALL_NAME_DIR)
set(CMAKE_INSTALL_NAME_DIR "@loader_path")
set(CMAKE_BUILD_WITH_INSTALL_NAME_DIR ON)
endif()
Expand Down Expand Up @@ -63,7 +65,10 @@ ENDIF()
target_include_directories(tkassert PUBLIC
$<INSTALL_INTERFACE:include/tkassert>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/tkassert>)
target_link_libraries(tkassert PRIVATE tklog::tklog)
target_link_libraries(tkassert PUBLIC tklog::tklog)
IF(APPLE)
target_link_libraries(tkassert PRIVATE "-flat_namespace")
ENDIF()

target_sources(tkassert
PRIVATE src/AssertMessage.cpp
Expand Down
2 changes: 1 addition & 1 deletion libs/tkassert/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

class TkassertConan(ConanFile):
name = "tkassert"
version = "0.3.3"
version = "0.3.4"
package_type = "library"
license = "Apache 2"
url = "https://github.com/CQCL/tket"
Expand Down
4 changes: 2 additions & 2 deletions libs/tkassert/test/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

class test_tkassertRecipe(ConanFile):
name = "test-tkassert"
version = "0.3.3"
version = "0.3.4"
package_type = "application"
license = "Apache 2"
url = "https://github.com/CQCL/tket"
Expand Down Expand Up @@ -59,5 +59,5 @@ def package(self):
cmake.install()

def requirements(self):
self.requires("tkassert/0.3.3")
self.requires("tkassert/0.3.4")
self.requires("catch2/3.3.2")
8 changes: 7 additions & 1 deletion libs/tklog/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_SOURCE_DIR}/cmake)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_EXTENSIONS OFF)

option(INSTALL_NAME_DIR "Set the install name dir for the library to @loader_path for Apple targets" ON)

if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()
Expand All @@ -33,7 +35,7 @@ if(WIN32)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS yes)
endif()

if(APPLE)
if(APPLE AND INSTALL_NAME_DIR)
set(CMAKE_INSTALL_NAME_DIR "@loader_path")
set(CMAKE_BUILD_WITH_INSTALL_NAME_DIR ON)
endif()
Expand Down Expand Up @@ -62,6 +64,10 @@ target_include_directories(tklog PUBLIC
$<INSTALL_INTERFACE:include/tklog>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/tklog>)

IF(APPLE)
target_link_libraries(tklog PRIVATE "-flat_namespace")
ENDIF()

target_sources(tklog
PRIVATE src/TketLog.cpp
PUBLIC FILE_SET HEADERS
Expand Down
Loading

0 comments on commit 39453bf

Please sign in to comment.