Skip to content

Start development of v1.0 #43

Start development of v1.0

Start development of v1.0 #43

Workflow file for this run

# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: ci
on:
push:
branches:
- main
tags:
- v*
pull_request:
branches:
- main
jobs:
build_dist:
runs-on: ${{ matrix.os_dist.os }}
strategy:
fail-fast: false
matrix:
os_dist: [
{os: ubuntu-latest, dist: cp310-manylinux_x86_64},
{os: ubuntu-latest, dist: cp311-manylinux_x86_64},
{os: ubuntu-latest, dist: cp312-manylinux_x86_64},
{os: macos-latest, dist: cp310-macosx_x86_64, macosarch: x86_64},
{os: macos-latest, dist: cp311-macosx_x86_64, macosarch: x86_64},
{os: macos-latest, dist: cp312-macosx_x86_64, macosarch: x86_64},
{os: macos-latest, dist: cp310-macosx_arm64, macosarch: arm64},
{os: macos-latest, dist: cp311-macosx_arm64, macosarch: arm64},
{os: macos-latest, dist: cp312-macosx_arm64, macosarch: arm64},
# Currently disabled because in CI it gives "DLL load failed" errors I don't understand when testing the wheel.
# {os: windows-latest, dist: cp310-win_amd64},
# {os: windows-latest, dist: cp311-win_amd64},
# {os: windows-latest, dist: cp312-win_amd64},
]
env:
MACOSX_DEPLOYMENT_TARGET: "10.15"
CIBW_BUILD: "${{ matrix.os_dist.dist }}"
CIBW_ARCHS_MACOS: "${{ matrix.os_dist.macosarch }}"
CIBW_TEST_REQUIRES: pytest stim sinter pygltflib
CIBW_TEST_COMMAND: pytest {project}/src
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- run: python tools/overwrite_dev_versions_with_date.py
- run: mkdir -p output/stim
- run: mkdir -p output/stimcirq
- run: mkdir -p output/sinter
- run: python -m pip install pybind11~=2.11.1 cibuildwheel~=2.16.2 setuptools
- run: python -m cibuildwheel --print-build-identifiers
- run: python -m cibuildwheel --output-dir output/chromobius
- run: python setup.py sdist
- run: mv dist/* output/chromobius
- uses: actions/upload-artifact@v3
with:
name: dist
path: |
./output/chromobius/*
check_sdist_installs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- run: python -m pip install pybind11~=2.11.1 cibuildwheel~=2.16.2 setuptools
- run: python setup.py sdist
- run: pip install dist/*.tar.gz
run_main:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- run: cmake .
- run: make chromobius -j 2
- run: out/chromobius --help
build_bazel:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: bazelbuild/setup-bazelisk@v1
- run: bazel build :all
- run: bazel test :chromobius_test
build_clang:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v1
- run: |
cd ..
git clone https://github.com/google/googletest.git -b release-1.12.1
mkdir googletest/build && cd googletest/build
cmake .. -DBUILD_GMOCK=OFF
make
sudo make install
- uses: egor-tensin/setup-clang@v1
with:
version: latest
platform: x64
- run: cmake . -DCMAKE_C_COMPILER=cc -DCMAKE_CXX_COMPILER=c++
- run: cmake --build . --target chromobius chromobius_test chromobius_perf
- run: out/chromobius --help
perf:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- run: cmake .
- run: make chromobius_perf -j 2
- run: out/chromobius_perf
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- run: |
cd ..
git clone https://github.com/google/googletest.git -b release-1.12.1
mkdir googletest/build && cd googletest/build
cmake .. -DBUILD_GMOCK=OFF
make
sudo make install
- run: cmake .
- run: make chromobius_test -j 2
- run: out/chromobius_test
test_o3:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- run: |
cd ..
git clone https://github.com/google/googletest.git -b release-1.12.1
mkdir googletest/build && cd googletest/build
cmake .. -DBUILD_GMOCK=OFF
make
sudo make install
- run: cmake . -DSIMD_WIDTH=256
- run: make chromobius_test_o3 -j 2
- run: out/chromobius_test_o3
test_generated_docs_are_fresh:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: bazelbuild/setup-bazelisk@v1
- run: bazel build :chromobius_dev_wheel
- run: pip install bazel-bin/chromobius-0.0.dev0-py3-none-any.whl
- run: diff <(python tools/gen_chromobius_api_reference.py -dev) doc/chromobius_api_reference.md
- run: diff <(python tools/gen_chromobius_stub_file.py -dev) doc/chromobius.pyi
- run: python doc/chromobius.pyi
test_generated_file_lists_are_fresh:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: tools/regen_file_lists.sh /tmp
- run: diff /tmp/perf_files file_lists/perf_files
- run: diff /tmp/pybind_files file_lists/pybind_files
- run: diff /tmp/source_files_no_main file_lists/source_files_no_main
- run: diff /tmp/test_files file_lists/test_files
test_pybind:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: bazelbuild/setup-bazelisk@v1
- run: bazel build :chromobius_dev_wheel
- run: pip install bazel-bin/chromobius-0.0.dev0-py3-none-any.whl
- run: pip install pytest stim sinter pygltflib
- run: pytest src
- run: tools/doctest_proper.py --module chromobius
upload_dev_release_to_pypi:
needs: ["build_dist"]
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v2
with:
name: dist
path: dist
- uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
packages_dir: dist/
password: ${{ secrets.pypi_token_chromobius }}