diff --git a/.github/workflows/build_and_test_v2.yml b/.github/workflows/build_and_test_v2.yml new file mode 100644 index 0000000000..76204e794e --- /dev/null +++ b/.github/workflows/build_and_test_v2.yml @@ -0,0 +1,436 @@ +name: Build and test v2 + +on: + pull_request: + branches: + - develop2 + push: + branches: + - develop2 + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + + linux: + name: Build and test (Linux) + runs-on: ubuntu-20.04 + env: + CC: gcc-10 + CXX: g++-10 + CONAN_REVISIONS_ENABLED: 1 + PYTKET_SKIP_REGISTRATION: "true" + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: '0' + - run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* + - name: Get current time + uses: srfrnk/current-time@v1.1.0 + id: current_time + with: + format: YYYYMMDDHHmmss + - name: Cache ccache data + uses: actions/cache@v2 + with: + path: ~/.ccache + key: ${{ runner.os }}-tket-ccache-${{ steps.current_time.outputs.formattedTime }} + restore-keys: | + ${{ runner.os }}-tket-ccache- + - name: apt update + run: sudo apt update + - name: Check doxygen + if: github.event_name == 'pull_request' + run: | + sudo apt install -y doxygen graphviz + cd tket && doxygen + - name: Install conan + id: conan + run: | + pip install conan + conan_cmd=/home/runner/.local/bin/conan + ${conan_cmd} profile new tket --detect + ${conan_cmd} profile update settings.compiler.libcxx=libstdc++11 tket + ${conan_cmd} profile update options.tket:shared=True tket + echo "CONAN_CMD=${conan_cmd}" >> $GITHUB_ENV + - name: set option to run full test suite + if: github.event_name == 'schedule' + run: ${CONAN_CMD} profile update options.tket-tests:full=True tket + - name: add remote + run: ${CONAN_CMD} remote add tket-conan https://tket.jfrog.io/artifactory/api/conan/tket-conan + - name: Install ninja and ccache + run: sudo apt-get install ninja-build ccache + - name: Build tket + run: ${CONAN_CMD} create --profile=tket recipes/tket + - name: Install runtime test requirements + run: | + sudo apt-get install texlive texlive-latex-extra latexmk + mkdir -p ~/texmf/tex/latex + wget http://mirrors.ctan.org/graphics/pgf/contrib/quantikz/tikzlibraryquantikz.code.tex -P ~/texmf/tex/latex + - name: Build and run tket tests + run: ${CONAN_CMD} create --profile=tket recipes/tket-tests + - name: Build and run tket proptests + run: ${CONAN_CMD} create --profile=tket recipes/tket-proptests + - name: Install pybind11 + run: ${CONAN_CMD} create --profile=tket recipes/pybind11 + - name: Set up Python 3.8 + if: github.event_name == 'push' + uses: actions/setup-python@v2 + with: + python-version: '3.8' + - name: Build pytket (3.8) + if: github.event_name == 'push' + run: | + cd pytket + pip install -e . -v + - name: Test pytket (3.8) + if: github.event_name == 'push' + run: | + cd pytket/tests + pip install -r requirements.txt + pytest --ignore=simulator/ --doctest-modules + - name: Set up Python 3.9 + if: github.event_name == 'pull_request' + uses: actions/setup-python@v2 + with: + python-version: '3.9' + - name: Build pytket (3.9) + if: github.event_name == 'pull_request' + run: | + cd pytket + pip install -e . -v + - name: Test building docs + if: github.event_name == 'pull_request' + timeout-minutes: 20 + run: | + pip install -r pytket/docs/requirements.txt + ./.github/workflows/build-docs + - name: Test pytket (3.9) + if: github.event_name == 'pull_request' + run: | + cd pytket/tests + pip install -r requirements.txt + pytest --ignore=simulator/ --doctest-modules + - name: Set up Python 3.10 + if: github.event_name == 'schedule' + uses: actions/setup-python@v2 + with: + python-version: '3.10' + - name: Build pytket (3.10) + if: github.event_name == 'schedule' + run: | + cd pytket + pip install -e . -v + - name: Test pytket (3.10) + if: github.event_name == 'schedule' + run: | + cd pytket/tests + pip install -r requirements.txt + pytest --ignore=simulator/ --doctest-modules + + macos: + name: Build and test (MacOS) + runs-on: macos-11 + env: + CONAN_REVISIONS_ENABLED: 1 + PYTKET_SKIP_REGISTRATION: "true" + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: '0' + - run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* + - name: Check C++ code formatting + if: github.event_name == 'pull_request' + run: | + brew update + brew install clang-format@13 + git ls-files "*.cpp" "*.hpp" | xargs clang-format -style=file --dry-run --Werror + - name: Get current time + uses: srfrnk/current-time@v1.1.0 + id: current_time + with: + format: YYYYMMDDHHmmss + - name: Cache ccache data + uses: actions/cache@v2 + with: + path: ~/Library/Caches/ccache + key: ${{ runner.os }}-tket-ccache-${{ steps.current_time.outputs.formattedTime }} + restore-keys: | + ${{ runner.os }}-tket-ccache- + - name: Cache conan data + uses: actions/cache@v2 + with: + path: ~/.conan + key: ${{ runner.os }}-tket-conan-${{ steps.current_time.outputs.formattedTime }} + restore-keys: | + ${{ runner.os }}-tket-conan- + - name: Install ninja and ccache + run: brew install ninja ccache + - name: Set up Python 3.9 + uses: actions/setup-python@v2 + with: + python-version: '3.9' + - name: Install conan + id: conan + run: | + pip install conan + conan profile new tket --detect --force + conan profile update options.tket:shared=True tket + export CC=`which conan` + echo "CONAN_CMD=${CC}" >> $GITHUB_ENV + - name: set option to run full test suite + if: github.event_name == 'schedule' + run: conan profile update options.tket-tests:full=True tket + - name: add remote + run: conan remote add tket-conan https://tket.jfrog.io/artifactory/api/conan/tket-conan --force + - name: Install boost + run: conan install --profile=tket boost/1.78.0@ --build=missing + - name: Build tket + run: conan create --profile=tket recipes/tket --build=spdlog --build=tket + - name: Build and run tket tests + run: conan create --profile=tket recipes/tket-tests + - name: Build and run tket proptests + run: | + conan install --profile=tket rapidcheck/cci.20210702@ --build=missing + conan create --profile=tket recipes/tket-proptests + - name: Install pybind11 + run: conan create --profile=tket recipes/pybind11 + - name: Set up Python 3.8 + if: github.event_name == 'push' + uses: actions/setup-python@v2 + with: + python-version: '3.8' + - name: Build pytket (3.8) + if: github.event_name == 'push' + run: | + cd pytket + pip install -e . -v + - name: Test pytket (3.8) + if: github.event_name == 'push' + run: | + cd pytket/tests + pip install -r requirements.txt + pytest --ignore=simulator/ --doctest-modules + - name: Set up Python 3.9 + if: github.event_name == 'pull_request' + uses: actions/setup-python@v2 + with: + python-version: '3.9' + - name: Build pytket (3.9) + if: github.event_name == 'pull_request' + run: | + cd pytket + pip install -e . -v + - name: Test pytket (3.9) + if: github.event_name == 'pull_request' + run: | + cd pytket/tests + pip install -r requirements.txt + pytest --ignore=simulator/ --doctest-modules + - name: Run mypy + if: github.event_name == 'pull_request' + run: | + pip install -U mypy + cd pytket + mypy --config-file=mypy.ini --no-incremental -p pytket -p tests + - name: Set up Python 3.10 + if: github.event_name == 'schedule' + uses: actions/setup-python@v2 + with: + python-version: '3.10' + - name: Build pytket (3.10) + if: github.event_name == 'schedule' + run: | + cd pytket + pip install -e . -v + - name: Test pytket (3.10) + if: github.event_name == 'schedule' + run: | + cd pytket/tests + pip install -r requirements.txt + pytest --ignore=simulator/ --doctest-modules + + macos-m1: + name: Build and test (MacOS M1) + runs-on: [self-hosted, macos, M1] + if: github.event_name == 'push' || github.event_name == 'schedule' || github.event.pull_request.head.repo.full_name == github.repository + defaults: + run: + shell: "/usr/bin/arch -arch arm64e /bin/bash {0}" + env: + CONAN_REVISIONS_ENABLED: 1 + PYTKET_SKIP_REGISTRATION: "true" + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: '0' + - run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* + - name: Set up conan + id: conan + run: | + conan profile new tket --detect --force + conan profile update options.tket:shared=True tket + export CC=`which conan` + echo "CONAN_CMD=${CC}" >> $GITHUB_ENV + - name: set option to run full test suite + if: github.event_name == 'schedule' + run: conan profile update options.tket-tests:full=True tket + - name: add remote + run: conan remote add tket-conan https://tket.jfrog.io/artifactory/api/conan/tket-conan --force + - name: Install boost + run: conan install --profile=tket boost/1.78.0@ --build=missing + - name: Build tket + run: conan create --profile=tket recipes/tket --build=spdlog --build=tket + - name: Build and run tket tests + run: conan create --profile=tket recipes/tket-tests + - name: Build and run tket proptests + run: conan create --profile=tket recipes/tket-proptests + - name: Install pybind11 + run: conan create --profile=tket recipes/pybind11 + - name: Build pytket (3.8) + if: github.event_name == 'push' + run: | + eval "$(pyenv init -)" + pyenv shell tket-3.8 + OPENBLAS="$(brew --prefix openblas)" pip install -U scipy + cd pytket + pip install -e . -v + - name: Test pytket (3.8) + if: github.event_name == 'push' + run: | + eval "$(pyenv init -)" + pyenv shell tket-3.8 + cd pytket/tests + pip install -r requirements.txt + pytest --ignore=simulator/ --doctest-modules + - name: Build pytket (3.9) + if: github.event_name == 'pull_request' + run: | + eval "$(pyenv init -)" + pyenv shell tket-3.9 + OPENBLAS="$(brew --prefix openblas)" pip install -U scipy + cd pytket + pip install -e . -v + - name: Test pytket (3.9) + if: github.event_name == 'pull_request' + run: | + eval "$(pyenv init -)" + pyenv shell tket-3.9 + cd pytket/tests + pip install -r requirements.txt + pytest --ignore=simulator/ --doctest-modules + - name: Build pytket (3.10) + if: github.event_name == 'schedule' + run: | + eval "$(pyenv init -)" + pyenv shell tket-3.10 + OPENBLAS="$(brew --prefix openblas)" pip install -U scipy + cd pytket + pip install -e . -v + - name: Test pytket (3.10) + if: github.event_name == 'schedule' + run: | + eval "$(pyenv init -)" + pyenv shell tket-3.10 + cd pytket/tests + pip install -r requirements.txt + pytest --ignore=simulator/ --doctest-modules + + windows: + name: Build and test (Windows) + runs-on: windows-2019 + env: + CONAN_REVISIONS_ENABLED: 1 + PYTKET_SKIP_REGISTRATION: "true" + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: '0' + - name: Hash tket source + id: hash_tket_source + run: | + Function Get-FolderHash + { + param ($folder) + $files = dir $folder -Recurse |? { -not $_.psiscontainer } + $allBytes = new-object System.Collections.Generic.List[byte] + foreach ($file in $files) + { + $allBytes.AddRange([System.IO.File]::ReadAllBytes($file.FullName)) + $allBytes.AddRange([System.Text.Encoding]::UTF8.GetBytes($file.Name)) + } + $hasher = [System.Security.Cryptography.MD5]::Create() + $ret = [string]::Join("",$($hasher.ComputeHash($allBytes.ToArray()) | %{"{0:x2}" -f $_})) + return $ret + } + $tket_hash = Get-FolderHash tket + echo "::set-output name=tket_hash::${tket_hash}" + - run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* + - name: Install conan + run: | + pip install conan + conan profile new tket --detect + conan profile update options.tket:shared=True tket + $conan_cmd = (gcm conan).Path + echo "CONAN_CMD=${conan_cmd}" >> $GITHUB_ENV + - name: set option to run full test suite + if: github.event_name == 'schedule' + run: conan profile update options.tket-tests:full=True tket + - name: add remote + run: conan remote add tket-conan https://tket.jfrog.io/artifactory/api/conan/tket-conan + - name: Cache tket build + id: cache-tket + uses: actions/cache@v2 + with: + path: C:\Users\runneradmin\.conan\data\tket + key: ${{ runner.os }}-tket-tket-${{ steps.hash_tket_source.outputs.tket_hash }}-v2-1 + - name: Build tket + if: steps.cache-tket.outputs.cache-hit != 'true' + run: conan create --profile=tket recipes/tket + - name: Build and run tket tests + run: conan create --profile=tket recipes/tket-tests + - name: Build and run tket proptests + run: conan create --profile=tket recipes/tket-proptests + - name: Install pybind11 + run: conan create --profile=tket recipes/pybind11 + - name: Set up Python 3.8 + if: github.event_name == 'push' + uses: actions/setup-python@v2 + with: + python-version: '3.8' + - name: Build and test pytket (3.8) + if: github.event_name == 'push' + run: | + cd pytket + pip install -e . -v + cd tests + pip install -r requirements.txt + pytest --ignore=simulator/ --doctest-modules + - name: Set up Python 3.9 + if: github.event_name == 'pull_request' + uses: actions/setup-python@v2 + with: + python-version: '3.9' + - name: Build and test pytket (3.9) + if: github.event_name == 'pull_request' + run: | + cd pytket + pip install -e . -v + cd tests + pip install -r requirements.txt + pytest --ignore=simulator/ --doctest-modules + - name: Set up Python 3.10 + if: github.event_name == 'schedule' + uses: actions/setup-python@v2 + with: + python-version: '3.10' + - name: Build and test pytket (3.10) + if: github.event_name == 'schedule' + run: | + cd pytket + pip install -e . -v + cd tests + pip install -r requirements.txt + pytest --ignore=simulator/ --doctest-modules diff --git a/.github/workflows/build_and_test_v2_nightly.yml b/.github/workflows/build_and_test_v2_nightly.yml new file mode 100644 index 0000000000..81da829f77 --- /dev/null +++ b/.github/workflows/build_and_test_v2_nightly.yml @@ -0,0 +1,437 @@ +name: Build and test v2 nightly + +on: + schedule: + # 03:00 every Saturday morning + - cron: '0 3 * * 6' + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + + linux: + name: Build and test (Linux) + runs-on: ubuntu-20.04 + env: + CC: gcc-10 + CXX: g++-10 + CONAN_REVISIONS_ENABLED: 1 + PYTKET_SKIP_REGISTRATION: "true" + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: '0' + ref: develop2 + - run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* + - name: Get current time + uses: srfrnk/current-time@v1.1.0 + id: current_time + with: + format: YYYYMMDDHHmmss + - name: Cache ccache data + uses: actions/cache@v2 + with: + path: ~/.ccache + key: ${{ runner.os }}-tket-ccache-${{ steps.current_time.outputs.formattedTime }} + restore-keys: | + ${{ runner.os }}-tket-ccache- + - name: apt update + run: sudo apt update + - name: Check doxygen + if: github.event_name == 'pull_request' + run: | + sudo apt install -y doxygen graphviz + cd tket && doxygen + - name: Install conan + id: conan + run: | + pip install conan + conan_cmd=/home/runner/.local/bin/conan + ${conan_cmd} profile new tket --detect + ${conan_cmd} profile update settings.compiler.libcxx=libstdc++11 tket + ${conan_cmd} profile update options.tket:shared=True tket + echo "CONAN_CMD=${conan_cmd}" >> $GITHUB_ENV + - name: set option to run full test suite + if: github.event_name == 'schedule' + run: ${CONAN_CMD} profile update options.tket-tests:full=True tket + - name: add remote + run: ${CONAN_CMD} remote add tket-conan https://tket.jfrog.io/artifactory/api/conan/tket-conan + - name: Install ninja and ccache + run: sudo apt-get install ninja-build ccache + - name: Build tket + run: ${CONAN_CMD} create --profile=tket recipes/tket + - name: Install runtime test requirements + run: | + sudo apt-get install texlive texlive-latex-extra latexmk + mkdir -p ~/texmf/tex/latex + wget http://mirrors.ctan.org/graphics/pgf/contrib/quantikz/tikzlibraryquantikz.code.tex -P ~/texmf/tex/latex + - name: Build and run tket tests + run: ${CONAN_CMD} create --profile=tket recipes/tket-tests + - name: Build and run tket proptests + run: ${CONAN_CMD} create --profile=tket recipes/tket-proptests + - name: Install pybind11 + run: ${CONAN_CMD} create --profile=tket recipes/pybind11 + - name: Set up Python 3.8 + if: github.event_name == 'push' + uses: actions/setup-python@v2 + with: + python-version: '3.8' + - name: Build pytket (3.8) + if: github.event_name == 'push' + run: | + cd pytket + pip install -e . -v + - name: Test pytket (3.8) + if: github.event_name == 'push' + run: | + cd pytket/tests + pip install -r requirements.txt + pytest --ignore=simulator/ --doctest-modules + - name: Set up Python 3.9 + if: github.event_name == 'pull_request' + uses: actions/setup-python@v2 + with: + python-version: '3.9' + - name: Build pytket (3.9) + if: github.event_name == 'pull_request' + run: | + cd pytket + pip install -e . -v + - name: Test building docs + if: github.event_name == 'pull_request' + timeout-minutes: 20 + run: | + pip install -r pytket/docs/requirements.txt + ./.github/workflows/build-docs + - name: Test pytket (3.9) + if: github.event_name == 'pull_request' + run: | + cd pytket/tests + pip install -r requirements.txt + pytest --ignore=simulator/ --doctest-modules + - name: Set up Python 3.10 + if: github.event_name == 'schedule' + uses: actions/setup-python@v2 + with: + python-version: '3.10' + - name: Build pytket (3.10) + if: github.event_name == 'schedule' + run: | + cd pytket + pip install -e . -v + - name: Test pytket (3.10) + if: github.event_name == 'schedule' + run: | + cd pytket/tests + pip install -r requirements.txt + pytest --ignore=simulator/ --doctest-modules + + macos: + name: Build and test (MacOS) + runs-on: macos-11 + env: + CONAN_REVISIONS_ENABLED: 1 + PYTKET_SKIP_REGISTRATION: "true" + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: '0' + ref: develop2 + - run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* + - name: Check C++ code formatting + if: github.event_name == 'pull_request' + run: | + brew update + brew install clang-format@13 + git ls-files "*.cpp" "*.hpp" | xargs clang-format -style=file --dry-run --Werror + - name: Get current time + uses: srfrnk/current-time@v1.1.0 + id: current_time + with: + format: YYYYMMDDHHmmss + - name: Cache ccache data + uses: actions/cache@v2 + with: + path: ~/Library/Caches/ccache + key: ${{ runner.os }}-tket-ccache-${{ steps.current_time.outputs.formattedTime }} + restore-keys: | + ${{ runner.os }}-tket-ccache- + - name: Cache conan data + uses: actions/cache@v2 + with: + path: ~/.conan + key: ${{ runner.os }}-tket-conan-${{ steps.current_time.outputs.formattedTime }} + restore-keys: | + ${{ runner.os }}-tket-conan- + - name: Install ninja and ccache + run: brew install ninja ccache + - name: Set up Python 3.9 + uses: actions/setup-python@v2 + with: + python-version: '3.9' + - name: Install conan + id: conan + run: | + pip install conan + conan profile new tket --detect --force + conan profile update options.tket:shared=True tket + export CC=`which conan` + echo "CONAN_CMD=${CC}" >> $GITHUB_ENV + - name: set option to run full test suite + if: github.event_name == 'schedule' + run: conan profile update options.tket-tests:full=True tket + - name: add remote + run: conan remote add tket-conan https://tket.jfrog.io/artifactory/api/conan/tket-conan --force + - name: Install boost + run: conan install --profile=tket boost/1.78.0@ --build=missing + - name: Build tket + run: conan create --profile=tket recipes/tket --build=spdlog --build=tket + - name: Build and run tket tests + run: conan create --profile=tket recipes/tket-tests + - name: Build and run tket proptests + run: | + conan install --profile=tket rapidcheck/cci.20210702@ --build=missing + conan create --profile=tket recipes/tket-proptests + - name: Install pybind11 + run: conan create --profile=tket recipes/pybind11 + - name: Set up Python 3.8 + if: github.event_name == 'push' + uses: actions/setup-python@v2 + with: + python-version: '3.8' + - name: Build pytket (3.8) + if: github.event_name == 'push' + run: | + cd pytket + pip install -e . -v + - name: Test pytket (3.8) + if: github.event_name == 'push' + run: | + cd pytket/tests + pip install -r requirements.txt + pytest --ignore=simulator/ --doctest-modules + - name: Set up Python 3.9 + if: github.event_name == 'pull_request' + uses: actions/setup-python@v2 + with: + python-version: '3.9' + - name: Build pytket (3.9) + if: github.event_name == 'pull_request' + run: | + cd pytket + pip install -e . -v + - name: Test pytket (3.9) + if: github.event_name == 'pull_request' + run: | + cd pytket/tests + pip install -r requirements.txt + pytest --ignore=simulator/ --doctest-modules + - name: Run mypy + if: github.event_name == 'pull_request' + run: | + pip install -U mypy + cd pytket + mypy --config-file=mypy.ini --no-incremental -p pytket -p tests + - name: Set up Python 3.10 + if: github.event_name == 'schedule' + uses: actions/setup-python@v2 + with: + python-version: '3.10' + - name: Build pytket (3.10) + if: github.event_name == 'schedule' + run: | + cd pytket + pip install -e . -v + - name: Test pytket (3.10) + if: github.event_name == 'schedule' + run: | + cd pytket/tests + pip install -r requirements.txt + pytest --ignore=simulator/ --doctest-modules + + macos-m1: + name: Build and test (MacOS M1) + runs-on: [self-hosted, macos, M1] + if: github.event_name == 'push' || github.event_name == 'schedule' || github.event.pull_request.head.repo.full_name == github.repository + defaults: + run: + shell: "/usr/bin/arch -arch arm64e /bin/bash {0}" + env: + CONAN_REVISIONS_ENABLED: 1 + PYTKET_SKIP_REGISTRATION: "true" + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: '0' + ref: develop2 + - run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* + - name: Set up conan + id: conan + run: | + conan profile new tket --detect --force + conan profile update options.tket:shared=True tket + export CC=`which conan` + echo "CONAN_CMD=${CC}" >> $GITHUB_ENV + - name: set option to run full test suite + if: github.event_name == 'schedule' + run: conan profile update options.tket-tests:full=True tket + - name: add remote + run: conan remote add tket-conan https://tket.jfrog.io/artifactory/api/conan/tket-conan --force + - name: Install boost + run: conan install --profile=tket boost/1.78.0@ --build=missing + - name: Build tket + run: conan create --profile=tket recipes/tket --build=spdlog --build=tket + - name: Build and run tket tests + run: conan create --profile=tket recipes/tket-tests + - name: Build and run tket proptests + run: conan create --profile=tket recipes/tket-proptests + - name: Install pybind11 + run: conan create --profile=tket recipes/pybind11 + - name: Build pytket (3.8) + if: github.event_name == 'push' + run: | + eval "$(pyenv init -)" + pyenv shell tket-3.8 + OPENBLAS="$(brew --prefix openblas)" pip install -U scipy + cd pytket + pip install -e . -v + - name: Test pytket (3.8) + if: github.event_name == 'push' + run: | + eval "$(pyenv init -)" + pyenv shell tket-3.8 + cd pytket/tests + pip install -r requirements.txt + pytest --ignore=simulator/ --doctest-modules + - name: Build pytket (3.9) + if: github.event_name == 'pull_request' + run: | + eval "$(pyenv init -)" + pyenv shell tket-3.9 + OPENBLAS="$(brew --prefix openblas)" pip install -U scipy + cd pytket + pip install -e . -v + - name: Test pytket (3.9) + if: github.event_name == 'pull_request' + run: | + eval "$(pyenv init -)" + pyenv shell tket-3.9 + cd pytket/tests + pip install -r requirements.txt + pytest --ignore=simulator/ --doctest-modules + - name: Build pytket (3.10) + if: github.event_name == 'schedule' + run: | + eval "$(pyenv init -)" + pyenv shell tket-3.10 + OPENBLAS="$(brew --prefix openblas)" pip install -U scipy + cd pytket + pip install -e . -v + - name: Test pytket (3.10) + if: github.event_name == 'schedule' + run: | + eval "$(pyenv init -)" + pyenv shell tket-3.10 + cd pytket/tests + pip install -r requirements.txt + pytest --ignore=simulator/ --doctest-modules + + windows: + name: Build and test (Windows) + runs-on: windows-2019 + env: + CONAN_REVISIONS_ENABLED: 1 + PYTKET_SKIP_REGISTRATION: "true" + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: '0' + ref: develop2 + - name: Hash tket source + id: hash_tket_source + run: | + Function Get-FolderHash + { + param ($folder) + $files = dir $folder -Recurse |? { -not $_.psiscontainer } + $allBytes = new-object System.Collections.Generic.List[byte] + foreach ($file in $files) + { + $allBytes.AddRange([System.IO.File]::ReadAllBytes($file.FullName)) + $allBytes.AddRange([System.Text.Encoding]::UTF8.GetBytes($file.Name)) + } + $hasher = [System.Security.Cryptography.MD5]::Create() + $ret = [string]::Join("",$($hasher.ComputeHash($allBytes.ToArray()) | %{"{0:x2}" -f $_})) + return $ret + } + $tket_hash = Get-FolderHash tket + echo "::set-output name=tket_hash::${tket_hash}" + - run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* + - name: Install conan + run: | + pip install conan + conan profile new tket --detect + conan profile update options.tket:shared=True tket + $conan_cmd = (gcm conan).Path + echo "CONAN_CMD=${conan_cmd}" >> $GITHUB_ENV + - name: set option to run full test suite + if: github.event_name == 'schedule' + run: conan profile update options.tket-tests:full=True tket + - name: add remote + run: conan remote add tket-conan https://tket.jfrog.io/artifactory/api/conan/tket-conan + - name: Cache tket build + id: cache-tket + uses: actions/cache@v2 + with: + path: C:\Users\runneradmin\.conan\data\tket + key: ${{ runner.os }}-tket-tket-${{ steps.hash_tket_source.outputs.tket_hash }}-v2-1 + - name: Build tket + if: steps.cache-tket.outputs.cache-hit != 'true' + run: conan create --profile=tket recipes/tket + - name: Build and run tket tests + run: conan create --profile=tket recipes/tket-tests + - name: Build and run tket proptests + run: conan create --profile=tket recipes/tket-proptests + - name: Install pybind11 + run: conan create --profile=tket recipes/pybind11 + - name: Set up Python 3.8 + if: github.event_name == 'push' + uses: actions/setup-python@v2 + with: + python-version: '3.8' + - name: Build and test pytket (3.8) + if: github.event_name == 'push' + run: | + cd pytket + pip install -e . -v + cd tests + pip install -r requirements.txt + pytest --ignore=simulator/ --doctest-modules + - name: Set up Python 3.9 + if: github.event_name == 'pull_request' + uses: actions/setup-python@v2 + with: + python-version: '3.9' + - name: Build and test pytket (3.9) + if: github.event_name == 'pull_request' + run: | + cd pytket + pip install -e . -v + cd tests + pip install -r requirements.txt + pytest --ignore=simulator/ --doctest-modules + - name: Set up Python 3.10 + if: github.event_name == 'schedule' + uses: actions/setup-python@v2 + with: + python-version: '3.10' + - name: Build and test pytket (3.10) + if: github.event_name == 'schedule' + run: | + cd pytket + pip install -e . -v + cd tests + pip install -r requirements.txt + pytest --ignore=simulator/ --doctest-modules diff --git a/.github/workflows/coverage_v2.yml b/.github/workflows/coverage_v2.yml new file mode 100644 index 0000000000..708cdd9959 --- /dev/null +++ b/.github/workflows/coverage_v2.yml @@ -0,0 +1,147 @@ +name: Analyse tket C++ test coverage v2 + +on: + pull_request: + branches: + - develop2 + push: + branches: + - develop2 + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + + changes: + runs-on: ubuntu-20.04 + outputs: + tket: ${{ steps.filter.outputs.tket }} + steps: + - uses: actions/checkout@v2 + - uses: dorny/paths-filter@v2 + id: filter + with: + base: ${{ github.ref }} + filters: | + tket: + - 'tket/**' + + generate_coverage: + name: Generate coverage report + needs: changes + if: needs.changes.outputs.tket == 'true' + runs-on: ubuntu-20.04 + env: + CC: gcc-10 + CXX: g++-10 + CONAN_REVISIONS_ENABLED: 1 + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: '0' + - run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* + - name: Get current time + uses: srfrnk/current-time@v1.1.0 + id: current_time + with: + format: YYYYMMDDHHmmss + - name: Cache ccache data + uses: actions/cache@v2 + with: + path: ~/.ccache + key: ${{ runner.os }}-tket-ccache-${{ steps.current_time.outputs.formattedTime }} + restore-keys: | + ${{ runner.os }}-tket-ccache- + - name: Install conan + id: conan + run: | + pip install conan + conan_cmd=/home/runner/.local/bin/conan + ${conan_cmd} profile new tket --detect + ${conan_cmd} profile update settings.compiler.libcxx=libstdc++11 tket + ${conan_cmd} profile update options.tket:shared=True tket + ${conan_cmd} profile update settings.build_type=Debug tket + echo "CONAN_CMD=${conan_cmd}" >> $GITHUB_ENV + - name: add remote + run: ${CONAN_CMD} remote add tket-conan https://tket.jfrog.io/artifactory/api/conan/tket-conan + - name: Install ninja and ccache + run: | + sudo apt-get update + sudo apt-get install ninja-build ccache + - name: Build tket + run: | + ${CONAN_CMD} install recipes/tket --install-folder=build/tket --profile=tket -o tket:profile_coverage=True + ${CONAN_CMD} build recipes/tket --configure --build-folder=build/tket --source-folder=tket/src + ${CONAN_CMD} build recipes/tket --build --build-folder=build/tket + ${CONAN_CMD} export-pkg recipes/tket -f --build-folder=build/tket --source-folder=tket/src + - name: Build tket tests + run: | + ${CONAN_CMD} install recipes/tket-tests --install-folder=build/tket-tests --profile=tket -o tket-tests:with_coverage=True + ${CONAN_CMD} build recipes/tket-tests --configure --build-folder=build/tket-tests --source-folder=tket/tests + ${CONAN_CMD} build recipes/tket-tests --build --build-folder=build/tket-tests + - name: Install runtime test requirements + run: | + sudo apt-get install texlive texlive-latex-extra latexmk + mkdir -p ~/texmf/tex/latex + wget http://mirrors.ctan.org/graphics/pgf/contrib/quantikz/tikzlibraryquantikz.code.tex -P ~/texmf/tex/latex + - name: Run tket tests + run: ./build/tket-tests/bin/test_tket + - name: Install gcovr + run: pip install gcovr + - name: Build coverage report + run: | + mkdir test-coverage + gcovr --print-summary --html --html-details -r ./tket/src/ --exclude-lines-by-pattern '.*\bTKET_ASSERT\(.*\);' --object-directory ${PWD}/build/tket/ -o test-coverage/index.html > test-coverage/summary.txt + - name: Upload artefact + uses: actions/upload-artifact@v2 + with: + name: test_coverage + path: test-coverage/ + + publish_coverage: + name: Publish coverage + needs: generate_coverage + concurrency: gh_pages + if: github.event_name == 'push' && needs.changes.outputs.tket == 'true' + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v2 + with: + ref: gh-pages + - name: Download artefact + uses: actions/download-artifact@v2 + with: + name: test_coverage + path: test-coverage/ + - name: Configure git + run: | + git config --global user.email "tket-bot@cambridgequantum.com" + git config --global user.name "«$GITHUB_WORKFLOW» github action" + - name: Remove old report + run: git rm -r docs/tket-v2/test-coverage + - name: Add report to repository + run: | + mv test-coverage/ docs/tket-v2/ + git add -f docs/tket-v2/test-coverage + git commit --allow-empty -m "Add generated coverage report." + - name: Publish report + run: git push origin gh-pages:gh-pages + + check_coverage: + name: Check coverage + needs: generate_coverage + if: github.event_name == 'pull_request' && needs.changes.outputs.tket == 'true' + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v2 + - name: Download artefact + uses: actions/download-artifact@v2 + with: + name: test_coverage + path: test-coverage/ + - name: Compare with latest report from develop + run: | + wget https://cqcl.github.io/tket/tket-v2/test-coverage/summary.txt + ./.github/workflows/compare-coverage summary.txt test-coverage/summary.txt diff --git a/.github/workflows/docs_v2.yml b/.github/workflows/docs_v2.yml new file mode 100644 index 0000000000..108e861a42 --- /dev/null +++ b/.github/workflows/docs_v2.yml @@ -0,0 +1,26 @@ +name: Build tket C++ documentation v2 + +on: + push: + branches: + - develop2 + paths: + - 'tket/src/**' + +jobs: + build_docs: + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: '0' + - run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* + - name: Install Doxygen + run: sudo apt update && sudo apt install -y doxygen graphviz + - name: Build Doxygen docs + run: cd tket && doxygen + - name: Upload artefact + uses: actions/upload-artifact@v2 + with: + name: tket_docs + path: tket/doc/html/ \ No newline at end of file diff --git a/.github/workflows/valgrind.yml b/.github/workflows/valgrind.yml index 8ff0bae88d..6197c60688 100644 --- a/.github/workflows/valgrind.yml +++ b/.github/workflows/valgrind.yml @@ -3,6 +3,7 @@ on: pull_request: branches: - develop + schedule: # 03:00 every Monday morning - cron: '0 3 * * 1' diff --git a/.github/workflows/valgrind_v2.yml b/.github/workflows/valgrind_v2.yml new file mode 100644 index 0000000000..f49684f0f5 --- /dev/null +++ b/.github/workflows/valgrind_v2.yml @@ -0,0 +1,76 @@ +name: valgrind check v2 +on: + pull_request: + branches: + - develop2 + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true +jobs: + changes: + runs-on: ubuntu-20.04 + outputs: + tket: ${{ steps.filter.outputs.tket }} + steps: + - uses: actions/checkout@v2 + - uses: dorny/paths-filter@v2 + id: filter + with: + base: ${{ github.ref }} + filters: | + tket: + - 'tket/**' + check: + runs-on: ubuntu-20.04 + needs: changes + if: needs.changes.outputs.tket == 'true' + env: + CC: gcc-10 + CXX: g++-10 + CONAN_REVISIONS_ENABLED: 1 + steps: + - uses: actions/checkout@v2 + - name: cache ccache data + uses: actions/cache@v2 + with: + path: ~/.ccache + key: ${{ runner.os }}-tket-ccache-${{ steps.current_time.outputs.formattedTime }} + restore-keys: | + ${{ runner.os }}-tket-ccache- + - name: apt update + run: sudo apt update + - name: Install conan + id: conan + run: | + pip install conan + conan profile new tket --detect + conan profile update settings.compiler.libcxx=libstdc++11 tket + conan profile update options.tket:shared=True tket + - name: set option to run full test suite + if: github.event_name == 'schedule' + run: conan profile update options.tket-tests:full=True tket + - name: add remote + run: conan remote add tket-conan https://tket.jfrog.io/artifactory/api/conan/tket-conan + - name: install tex components + run: | + sudo apt install texlive texlive-latex-extra latexmk + mkdir -p ~/texmf/tex/latex + wget http://mirrors.ctan.org/graphics/pgf/contrib/quantikz/tikzlibraryquantikz.code.tex -P ~/texmf/tex/latex + - name: install valgrind + run: sudo apt install valgrind + - name: install ninja and ccache + run: sudo apt-get install ninja-build ccache + - name: build tket + run: | + conan install recipes/tket --install-folder=build/tket --profile=tket + conan build recipes/tket --configure --build-folder=build/tket --source-folder=tket/src + conan build recipes/tket --build --build-folder=build/tket + conan export-pkg recipes/tket -f --build-folder=build/tket --source-folder=tket/src + - name: build tket tests + run: | + conan install recipes/tket-tests --install-folder=build/tket-tests --profile=tket + conan build recipes/tket-tests --configure --build-folder=build/tket-tests --source-folder=tket/tests + conan build recipes/tket-tests --build --build-folder=build/tket-tests + - name: run tests under valgrind + run: valgrind --error-exitcode=1 ./build/tket-tests/bin/test_tket diff --git a/.github/workflows/valgrind_v2_nightly.yml b/.github/workflows/valgrind_v2_nightly.yml new file mode 100644 index 0000000000..bd6aefc811 --- /dev/null +++ b/.github/workflows/valgrind_v2_nightly.yml @@ -0,0 +1,82 @@ +name: valgrind check v2 nightly +on: + schedule: + # 03:00 every Monday morning + - cron: '0 3 * * 1' + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true +jobs: + changes: + runs-on: ubuntu-20.04 + outputs: + tket: ${{ steps.filter.outputs.tket }} + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: '0' + ref: develop2 + - uses: dorny/paths-filter@v2 + id: filter + with: + base: ${{ github.ref }} + filters: | + tket: + - 'tket/**' + check: + runs-on: ubuntu-20.04 + needs: changes + if: needs.changes.outputs.tket == 'true' + env: + CC: gcc-10 + CXX: g++-10 + CONAN_REVISIONS_ENABLED: 1 + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: '0' + ref: develop2 + - name: cache ccache data + uses: actions/cache@v2 + with: + path: ~/.ccache + key: ${{ runner.os }}-tket-ccache-${{ steps.current_time.outputs.formattedTime }} + restore-keys: | + ${{ runner.os }}-tket-ccache- + - name: apt update + run: sudo apt update + - name: Install conan + id: conan + run: | + pip install conan + conan profile new tket --detect + conan profile update settings.compiler.libcxx=libstdc++11 tket + conan profile update options.tket:shared=True tket + - name: set option to run full test suite + if: github.event_name == 'schedule' + run: conan profile update options.tket-tests:full=True tket + - name: add remote + run: conan remote add tket-conan https://tket.jfrog.io/artifactory/api/conan/tket-conan + - name: install tex components + run: | + sudo apt install texlive texlive-latex-extra latexmk + mkdir -p ~/texmf/tex/latex + wget http://mirrors.ctan.org/graphics/pgf/contrib/quantikz/tikzlibraryquantikz.code.tex -P ~/texmf/tex/latex + - name: install valgrind + run: sudo apt install valgrind + - name: install ninja and ccache + run: sudo apt-get install ninja-build ccache + - name: build tket + run: | + conan install recipes/tket --install-folder=build/tket --profile=tket + conan build recipes/tket --configure --build-folder=build/tket --source-folder=tket/src + conan build recipes/tket --build --build-folder=build/tket + conan export-pkg recipes/tket -f --build-folder=build/tket --source-folder=tket/src + - name: build tket tests + run: | + conan install recipes/tket-tests --install-folder=build/tket-tests --profile=tket + conan build recipes/tket-tests --configure --build-folder=build/tket-tests --source-folder=tket/tests + conan build recipes/tket-tests --build --build-folder=build/tket-tests + - name: run tests under valgrind + run: valgrind --error-exitcode=1 ./build/tket-tests/bin/test_tket