Added a test for circuit conversion to two qubit gates layers and bac… #349
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Compiling and testing on Ubuntu | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| pull_request: | |
| branches: [ "main" ] | |
| workflow_call: | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Repo | |
| uses: actions/checkout@v5 | |
| # 1. INSTALL TOOLS | |
| - name: Install System Tools | |
| run: sudo apt install -y libopenblas-dev ccache ninja-build | |
| # 2. CACHE EXTERNAL LIBS (Boost/Eigen/QCSim/JSON/AER) | |
| - name: Cache Boost and Eigen | |
| id: cache-libs | |
| uses: actions/cache@v5 | |
| with: | |
| path: | | |
| eigen-5.0.0 | |
| boost_1_90_0 | |
| key: ${{ runner.os }}-libs-boost1.90.0-eigen5.0.0 | |
| - name: Cache Git Dependencies | |
| id: cache-git-deps | |
| uses: actions/cache@v5 | |
| with: | |
| path: | | |
| QCSim | |
| json | |
| qiskit-aer | |
| key: ${{ runner.os }}-git-deps-v2 | |
| # 3. SETUP CCACHE | |
| - name: Cache ccache | |
| uses: actions/cache@v5 | |
| with: | |
| path: ~/.ccache | |
| key: ccache-${{ runner.os }}-${{ github.sha }} | |
| restore-keys: | | |
| ccache-${{ runner.os }}- | |
| - name: Configure ccache | |
| run: | | |
| ccache --max-size=500M | |
| ccache --set-config=compression=true | |
| ccache -z | |
| # 4. INSTALL DEPENDENCIES (If not cached) | |
| - name: Install Eigen | |
| if: steps.cache-libs.outputs.cache-hit != 'true' | |
| run: | | |
| curl -L https://gitlab.com/libeigen/eigen/-/archive/5.0.0/eigen-5.0.0.tar.gz --output eigen.tgz | |
| tar -xzvf eigen.tgz && rm eigen.tgz | |
| - name: Install and Compile Boost | |
| if: steps.cache-libs.outputs.cache-hit != 'true' | |
| run: | | |
| curl -L https://archives.boost.io/release/1.90.0/source/boost_1_90_0.tar.gz --output boost.tgz | |
| tar -xzvf boost.tgz && rm boost.tgz | |
| cd boost_1_90_0 | |
| ./bootstrap.sh --prefix=. | |
| ./b2 -j$(nproc) --with-program_options --with-url --with-container --with-json --with-serialization install | |
| # 5. DOWNLOAD DYNAMIC DEPENDENCIES (shallow clones, only if not cached) | |
| - name: Download Dependencies (QCSim, JSON, AER) | |
| run: | | |
| if [ -d QCSim ]; then cd QCSim && git pull && cd ..; else git clone --depth 1 https://github.com/aromanro/QCSim.git; fi | |
| [ -d json ] || git clone --depth 1 --branch v3.11.2 https://github.com/nlohmann/json.git | |
| [ -d qiskit-aer ] || git clone --depth 1 https://github.com/InvictusWingsSRL/qiskit-aer.git | |
| # 6. BUILD WITH CCACHE + NINJA | |
| - name: Run CMake | |
| run: | | |
| export EIGEN5_INCLUDE_DIR=$PWD/eigen-5.0.0/ | |
| export BOOST_ROOT=$PWD/boost_1_90_0 | |
| export QCSIM_INCLUDE_DIR=$PWD/QCSim/QCSim/ | |
| export JSON_INCLUDE_DIR=$PWD/json/single_include | |
| export AER_INCLUDE_DIR=$PWD/qiskit-aer/src/ | |
| cmake . -G Ninja \ | |
| -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ | |
| -DCMAKE_C_COMPILER_LAUNCHER=ccache | |
| - name: Build | |
| run: ninja | |
| - name: Show ccache stats | |
| run: ccache -s | |
| - name: Run tests | |
| run: ./bin/tests --log_level=test_suite |