From 1d0522fbb1c73459e681c92a9ed72e7fbf8800e8 Mon Sep 17 00:00:00 2001 From: rturrado <68099809+rturrado@users.noreply.github.com> Date: Wed, 13 Dec 2023 11:39:43 +0100 Subject: [PATCH 01/33] Update GitHub pipeline to look like QX's one. --- .github/actions/cpp-tests/action.yaml | 29 ++ .github/actions/python-tests/action.yaml | 25 ++ .github/workflows/assets.yml | 370 ++++++++++------------- .github/workflows/test.yml | 259 ++++++++-------- 4 files changed, 354 insertions(+), 329 deletions(-) create mode 100644 .github/actions/cpp-tests/action.yaml create mode 100644 .github/actions/python-tests/action.yaml diff --git a/.github/actions/cpp-tests/action.yaml b/.github/actions/cpp-tests/action.yaml new file mode 100644 index 00000000..38281cad --- /dev/null +++ b/.github/actions/cpp-tests/action.yaml @@ -0,0 +1,29 @@ +name: Compile libqasm +description: Install tools and compile libqasm +inputs: + build_type: + required: true + description: Is the build a debug or release version + shell: + required: true + description: Which shell to use for the `run` command + +runs: + using: composite + steps: + - name: Install conan + run: python3 -m pip install --upgrade pip conan + shell: ${{ inputs.shell }} + - name: Get latest CMake + uses: lukka/get-cmake@latest + - name: Configure and build + run: | + conan profile detect --force + build_type=${{ inputs.build_type }} + lowercase_build_type=$(echo ${build_type} | tr '[:upper:]' '[:lower:]') + conan build . -pr=conan/profiles/tests-${lowercase_build_type} -b missing + shell: ${{ inputs.shell }} + - name: Test + working-directory: build/${{ inputs.build_type }} + run: ctest -C ${{ inputs.build_type }} --output-on-failure + shell: ${{ inputs.shell }} diff --git a/.github/actions/python-tests/action.yaml b/.github/actions/python-tests/action.yaml new file mode 100644 index 00000000..14587932 --- /dev/null +++ b/.github/actions/python-tests/action.yaml @@ -0,0 +1,25 @@ +name: Python tests +description: Install and run tests in Python +inputs: + shell: + required: true + description: Which shell to use for the `run` command + +runs: + using: composite + steps: + - uses: actions/setup-python@v4 + with: + python-version: "3.11" + - name: Get latest CMake + uses: lukka/get-cmake@latest + - name: Install Python dependencies + run: python -m pip install --upgrade pip conan setuptools wheel + shell: ${{ inputs.shell }} + - name: Build + run: python -m pip install --verbose . + shell: ${{ inputs.shell }} + - name: Test + working-directory: tests/qxelarator + run: python -m pytest + shell: ${{ inputs.shell }} diff --git a/.github/workflows/assets.yml b/.github/workflows/assets.yml index 2ce50c3b..e297aab8 100644 --- a/.github/workflows/assets.yml +++ b/.github/workflows/assets.yml @@ -9,241 +9,193 @@ on: - 'release**' jobs: - macos: + macos-x64: name: PyPI wheels for macOS runs-on: macos-latest strategy: matrix: python: - - '3.6' - - '3.7' - - '3.8' - - '3.9' + - "3.8" + - "3.9" + - "3.10" + - "3.11" + - "3.12" steps: - - uses: actions/checkout@v2 - with: - submodules: true - - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python }} - - name: Install dependencies - run: | - brew install bison flex swig - echo "/usr/local/opt/bison/bin" >> $GITHUB_PATH - echo "/usr/local/opt/flex/bin" >> $GITHUB_PATH - python -m pip install --upgrade pip setuptools wheel - - name: Build wheel - env: - NPROCS: 100 - run: python setup.py bdist_wheel - - name: Wheel path - id: wheel - working-directory: pybuild/dist/ - run: echo "##[set-output name=wheel;]$(ls *.whl)" - - uses: actions/upload-artifact@v2 - with: - name: pypi-macos-py${{ matrix.python }} - path: pybuild/dist/${{ steps.wheel.outputs.wheel }} - - uses: actions/upload-release-asset@v1 - if: ${{ github.event_name == 'release' && github.event.action == 'created' }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ github.event.release.upload_url }} - asset_path: pybuild/dist/${{ steps.wheel.outputs.wheel }} - asset_name: ${{ steps.wheel.outputs.wheel }} - asset_content_type: application/zip + - name: Checkout + uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python }} + - name: Install dependencies + run: | + brew install bison flex + echo "/usr/local/opt/bison/bin" >> $GITHUB_PATH + echo "/usr/local/opt/flex/bin" >> $GITHUB_PATH + python -m pip install --upgrade pip conan setuptools wheel + - name: Build wheel + run: python setup.py bdist_wheel + - name: Wheel path + id: wheel + working-directory: pybuild/dist/ + run: echo "##[set-output name=wheel;]$(ls *.whl)" + - uses: actions/upload-artifact@v3 + with: + name: pypi-macos-py${{ matrix.python }} + path: pybuild/dist/${{ steps.wheel.outputs.wheel }} + - uses: actions/upload-release-asset@v1 + if: ${{ github.event_name == 'release' && github.event.action == 'created' }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: pybuild/dist/${{ steps.wheel.outputs.wheel }} + asset_name: ${{ steps.wheel.outputs.wheel }} + asset_content_type: application/zip - manylinux: - name: PyPI wheels for Manylinux + manylinux-x64: + name: PyPI wheels for Manylinux (x64) runs-on: ubuntu-latest container: quay.io/pypa/manylinux${{ matrix.manylinux }}_x86_64:latest - env: - FLEX_VERSION: '2.6.4' - BISON_VERSION: '3.0.4-2.el7' - SWIG_VERSION: '3.0.12-17.el7' - CMAKE_VERSION: '3.1.3' strategy: matrix: manylinux: - - 2014 + - "_2_28" cpython_version: - - 'cp36-cp36m' - - 'cp37-cp37m' - - 'cp38-cp38' - - 'cp39-cp39' + - "cp38-cp38" + - "cp39-cp39" + - "cp310-cp310" + - "cp311-cp311" + - "cp312-cp312" steps: - - uses: actions/checkout@v2 - with: - submodules: true - - name: Install dependencies - run: | - yum install -y bison-$BISON_VERSION swig3-$SWIG_VERSION - /opt/python/${{ matrix.cpython_version }}/bin/python -m pip install auditwheel - - name: Install flex - run: | - mkdir -p $HOME/flex - curl -L https://github.com/westes/flex/releases/download/v$FLEX_VERSION/flex-$FLEX_VERSION.tar.gz | tar xz --strip-components=1 -C $HOME/flex - cd $HOME/flex - ./configure - make -j - make install - - name: Install cmake - run: curl -L https://github.com/Kitware/CMake/releases/download/v$CMAKE_VERSION/cmake-$CMAKE_VERSION-Linux-x86_64.tar.gz | tar xz --strip-components=1 -C /usr - - name: Build wheel - env: - NPROCS: 100 - run: | - /opt/python/${{ matrix.cpython_version }}/bin/python setup.py bdist_wheel - /opt/python/${{ matrix.cpython_version }}/bin/python -m auditwheel repair pybuild/dist/*.whl - - name: Wheel path - id: wheel - working-directory: wheelhouse - run: echo "##[set-output name=wheel;]$(ls *.whl)" - - uses: actions/upload-artifact@v2 - with: - name: pypi-linux-${{ matrix.cpython_version }} - path: wheelhouse/${{ steps.wheel.outputs.wheel }} - - uses: actions/upload-release-asset@v1 - if: ${{ github.event_name == 'release' && github.event.action == 'created' }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ github.event.release.upload_url }} - asset_path: wheelhouse/${{ steps.wheel.outputs.wheel }} - asset_name: ${{ steps.wheel.outputs.wheel }} - asset_content_type: application/zip + - name: Checkout + uses: actions/checkout@v3 + - name: Install dependencies + run: | + yum install -y bison-$BISON_VERSION swig3-$SWIG_VERSION + /opt/python/${{ matrix.cpython_version }}/bin/python -m pip install --upgrade conan wheel auditwheel + - name: Build wheel + run: | + /opt/python/${{ matrix.cpython_version }}/bin/python setup.py bdist_wheel + /opt/python/${{ matrix.cpython_version }}/bin/python -m auditwheel repair pybuild/dist/*.whl + - name: Wheel path + id: wheel + working-directory: wheelhouse + run: echo "##[set-output name=wheel;]$(ls *.whl)" + - uses: actions/upload-artifact@v3 + with: + name: pypi-linux-${{ matrix.cpython_version }} + path: wheelhouse/${{ steps.wheel.outputs.wheel }} + - uses: actions/upload-release-asset@v1 + if: ${{ github.event_name == 'release' && github.event.action == 'created' }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: wheelhouse/${{ steps.wheel.outputs.wheel }} + asset_name: ${{ steps.wheel.outputs.wheel }} + asset_content_type: application/zip - windows: - name: PyPI wheels for Windows - runs-on: windows-latest + manylinux-arm64: + name: PyPI wheels for Manylinux (arm64) + runs-on: + - "self-hosted" + - "ARM64" + - "Linux" + container: quay.io/pypa/manylinux${{ matrix.manylinux }}_aarch64:latest strategy: matrix: - python: - - '3.6' - - '3.7' - - '3.8' - - '3.9' + manylinux: + - "_2_28" + cpython_version: + - "cp38-cp38" + - "cp39-cp39" + - "cp310-cp310" + - "cp311-cp311" + - "cp312-cp312" steps: - - uses: actions/checkout@v2 - with: - submodules: true - - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python }} - - uses: actions/cache@v2 - with: - path: C:\Users\runneradmin\AppData\Local\Temp\chocolatey - key: ${{ runner.os }}-chocolatey-python-1 - restore-keys: | - ${{ runner.os }}-chocolatey-python- - ${{ runner.os }}-chocolatey- - - name: Install dependencies - run: | - python -m pip install --upgrade pip setuptools wheel - choco install winflexbison3 --version 2.5.18.20190508 - #choco install swig --version 4.0.1 - - name: Build wheel - env: - NPROCS: 100 - run: python setup.py bdist_wheel - - name: Wheel path - id: wheel - working-directory: pybuild/dist/ - run: echo "##[set-output name=wheel;]$(Get-ChildItem -name *.whl)" - - uses: actions/upload-artifact@v2 - with: - name: pypi-windows-py${{ matrix.python }} - path: pybuild/dist/${{ steps.wheel.outputs.wheel }} - - uses: actions/upload-release-asset@v1 - if: ${{ github.event_name == 'release' && github.event.action == 'created' }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ github.event.release.upload_url }} - asset_path: pybuild/dist/${{ steps.wheel.outputs.wheel }} - asset_name: ${{ steps.wheel.outputs.wheel }} - asset_content_type: application/zip + - name: Checkout + uses: actions/checkout@v3 + - name: Install dependencies + run: | + /opt/python/${{ matrix.cpython_version }}/bin/python -m pip install --upgrade pip conan wheel auditwheel + - name: Build wheel + run: | + conan remove -c "qx/*" + /opt/python/${{ matrix.cpython_version }}/bin/python setup.py bdist_wheel + /opt/python/${{ matrix.cpython_version }}/bin/python -m auditwheel repair pybuild/dist/*.whl + - name: Wheel path + id: wheel + working-directory: wheelhouse + run: echo "##[set-output name=wheel;]$(ls *.whl)" + - uses: actions/upload-artifact@v3 + with: + name: pypi-linux-${{ matrix.cpython_version }} + path: wheelhouse/${{ steps.wheel.outputs.wheel }} + - uses: actions/upload-release-asset@v1 + if: ${{ github.event_name == 'release' && github.event.action == 'created' }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: wheelhouse/${{ steps.wheel.outputs.wheel }} + asset_name: ${{ steps.wheel.outputs.wheel }} + asset_content_type: application/zip - conda: - name: Conda wheels - runs-on: ${{ matrix.os }} + windows-x64: + name: PyPI wheels for Windows + runs-on: windows-latest strategy: - fail-fast: false matrix: - os: - - ubuntu-latest - - macos-latest - #- windows-latest - python-version: - - '3.6' - - '3.7' - - '3.8' - - '3.9' + python: + - "3.8" + - "3.9" + - "3.10" + - "3.11" + - "3.12" steps: - - uses: actions/checkout@v2 - with: - submodules: true - - name: Set up conda - uses: conda-incubator/setup-miniconda@v2 - with: - auto-update-conda: true - miniconda-version: "latest" - channel-priority: strict - channels: conda-forge - show-channel-urls: true - use-only-tar-bz2: true - - name: Install Windows dependencies - if: matrix.os == 'windows-2016' - run: choco install winflexbison3 --version 2.5.18.20190508 - - name: Install conda dependencies - run: conda install conda-build conda-verify -y - - name: Build & test - env: - NPROCS: 100 - run: conda build python/conda --python=${{ matrix.python-version }} - - name: Wheel path - id: wheel - run: | - python -c "import sys,os; print('##[set-output name=path;]' + os.path.abspath(sys.argv[1])); print('##[set-output name=wheel;]' + os.path.basename(sys.argv[1]));" "$(conda build python/conda --python=${{ matrix.python-version }} --output)" - python -c "import sys; print('##[set-output name=os;]' + ('linux' if sys.argv[1].startswith('ubuntu') else 'macos' if sys.argv[1].startswith('macos') else 'windows' if sys.argv[1].startswith('windows') else 0/0))" ${{ matrix.os }} - - uses: actions/upload-artifact@v2 - with: - name: conda-${{ steps.wheel.outputs.os }}-py${{ matrix.python-version }} - path: ${{ steps.wheel.outputs.path }} - - uses: actions/upload-release-asset@v1 - if: ${{ github.event_name == 'release' && github.event.action == 'created' }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ github.event.release.upload_url }} - asset_path: ${{ steps.wheel.outputs.path }} - asset_name: ${{ steps.wheel.outputs.wheel }} - asset_content_type: application/x-bzip2 + - name: Checkout + uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python }} + - name: Install dependencies + run: python -m pip install --upgrade pip conan setuptools wheel + - name: Build wheel + run: python setup.py bdist_wheel + - name: Wheel path + id: wheel + working-directory: pybuild/dist/ + run: echo "##[set-output name=wheel;]$(Get-ChildItem -name *.whl)" + - uses: actions/upload-artifact@v3 + with: + name: pypi-windows-py${{ matrix.python }} + path: pybuild/dist/${{ steps.wheel.outputs.wheel }} + - uses: actions/upload-release-asset@v1 + if: ${{ github.event_name == 'release' && github.event.action == 'created' }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: pybuild/dist/${{ steps.wheel.outputs.wheel }} + asset_name: ${{ steps.wheel.outputs.wheel }} + asset_content_type: application/zip publish: name: Publish if: ${{ github.event_name == 'release' && github.event.action == 'created' }} needs: - - macos - - manylinux - - windows - - conda + - macos-x64 + - manylinux-x64 + - manylinux-arm64 + - windows-x64 runs-on: ubuntu-latest steps: - - name: Download artifacts - uses: actions/download-artifact@v2 - id: download - - name: Publish to Anaconda cloud - run: | - conda install -c anaconda anaconda-client -y - conda run anaconda login --username ${{ secrets.ANACONDA_USER }} --password ${{ secrets.ANACONDA_PASSWORD }} - conda run anaconda upload ${{ steps.download.outputs.download-path }}/conda-*/*.bz2 - conda run anaconda logout - - name: Publish to PyPI - uses: pypa/gh-action-pypi-publish@v1.3.1 - with: - user: __token__ - password: ${{ secrets.PYPI_TOKEN }} - packages_dir: ${{ steps.download.outputs.download-path }}/pypi-* - + - name: Download artifacts + uses: actions/download-artifact@v3 + id: download + - name: Publish to PyPI + uses: pypa/gh-action-pypi-publish@v1.3.1 + with: + user: __token__ + password: ${{ secrets.PYPI_TOKEN }} + packages_dir: ${{ steps.download.outputs.download-path }}/pypi-* diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c7316f07..9977a90e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,157 +7,149 @@ on: pull_request: jobs: - cpp-linux-macos-windows: - name: 'C++ tests (Linux-MacOS-Windows/x64)' + cpp-linux-x64: + name: "C++ tests (gcc-clang/Linux/x64)" + runs-on: ubuntu-latest strategy: fail-fast: false matrix: - # Building for {g++, clang++}/Linux, clang++/MacOS, and msvc/Windows - # both in Debug and Release - os: [ubuntu-latest, macos-latest, windows-latest] - compiler: [g++, clang++, msvc] - build_type: [Debug, Release] - exclude: - - os: ubuntu-latest - compiler: msvc - - os: macos-latest - compiler: g++ - - os: macos-latest - compiler: msvc - - os: windows-latest - compiler: g++ - - os: windows-latest - compiler: clang++ - runs-on: ${{ matrix.os }} + build_type: + - Debug + - Release + compiler: + - clang++ + - g++ steps: - - name: Install Python - uses: actions/setup-python@v4 + - name: Checkout + uses: actions/checkout@v4 + - uses: ./.github/actions/cpp-tests with: - python-version: "3.11" - - name: Install conan - run: python -m pip install --upgrade pip conan - - name: Get latest CMake - uses: lukka/get-cmake@latest + build_type: ${{ matrix.build_type }} + shell: bash + + cpp-macos-x64: + name: "C++ tests (clang/MacOS/x64)" + runs-on: macos-latest + strategy: + fail-fast: false + matrix: + build_type: + - Debug + - Release + steps: - name: Checkout - uses: actions/checkout@v3 - - name: Configure and build - run: | - conan profile detect - build_type=${{ matrix.build_type }} - lowercase_build_type=$(echo ${build_type} | tr '[:upper:]' '[:lower:]') - conan build . -pr=conan/profiles/tests-${lowercase_build_type}-compat -b missing - shell: bash - - name: Test - working-directory: build/${{ matrix.build_type }} - run: ctest -C ${{ matrix.build_type }} --output-on-failure + uses: actions/checkout@v4 + - uses: ./.github/actions/cpp-tests + with: + build_type: ${{ matrix.build_type }} + shell: bash - cpp-arm64: - name: 'C++ tests (gcc/Linux/ARM64, clang/MacOS/ARM64)' - runs-on: [self-hosted, ARM64, "${{ matrix.os }}"] + cpp-windows-x64: + name: "C++ tests (msvc/Windows/x64)" + runs-on: windows-latest strategy: fail-fast: false matrix: - os: - - Linux - - macOS + build_type: + - Debug + - Release steps: - - if: matrix.os == 'Linux' - name: Install gcc and python (Linux) - run: | - sudo apt-get -y update - sudo apt-get -y upgrade - sudo apt-get -y install gcc python3 python3-pip python3-venv + - name: Checkout + uses: actions/checkout@v4 + - uses: ./.github/actions/cpp-tests + with: + build_type: ${{ matrix.build_type }} + shell: bash + + cpp-linux-arm64: + name: "C++ tests (gcc/Linux/ARM64)" + runs-on: [self-hosted, ARM64, Linux] + container: python:3.11 + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Add Python symlink + run: ln -sf /usr/local/bin/python3.11 /usr/bin/python3 shell: bash - - if: matrix.os == 'macOS' +# - name: Install bison and flex +# run: | +# apt-get update +# apt-get install -y bison flex default-jre + - uses: ./.github/actions/cpp-tests + with: + build_type: Release + shell: bash + + cpp-macos-arm64: + name: "C++ tests (clang/macos/ARM64)" + runs-on: [self-hosted, ARM64, macOS] + steps: + - name: Checkout + uses: actions/checkout@v4 # We are having problems when using the m4 and zulu-opendjk Conan packages on an armv8 architecture # m4 is required by flex/bison and zulu-openjdk provides the Java JRE required by the ANTLR generator # So, for the time being, we are installing flex/bison and java manually for this platform - name: Install bison, flex, gcc, java and python (MacOS) + - name: Install bison, flex and java run: | - brew install bison flex gcc java python + brew install bison flex java echo "$(brew --prefix bison)/bin" >> $GITHUB_PATH echo "$(brew --prefix flex)/bin" >> $GITHUB_PATH echo "$(brew --prefix java)/bin" >> $GITHUB_PATH shell: bash - - name: Get latest CMake - uses: lukka/get-cmake@latest - - name: Checkout - uses: actions/checkout@v3 - - name: Configure and build - env: - CXX: ${{ matrix.compiler }} - run: | - python3 -m venv venv - source venv/bin/activate - python3 -m pip install --upgrade pip conan - conan profile detect --force - conan build . -pr=conan/profiles/tests-release-compat -b missing - - name: Test - working-directory: build/Release - run: ctest -C Release --output-on-failure + - uses: ./.github/actions/cpp-tests + with: + build_type: Release + shell: bash - python: - name: Python - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: - - ubuntu-latest - - macos-latest - - windows-latest + python-linux-x64: + name: "Python tests (Linux/x64)" + runs-on: ubuntu-latest steps: - - name: Install Python - uses: actions/setup-python@v4 - with: - python-version: "3.11" - - name: Install Python dependencies - run: python -m pip install --upgrade pip conan numpy pytest setuptools wheel - - name: Install SWIG, and set build type (Linux) - if: matrix.os == 'ubuntu-latest' + - name: Checkout + uses: actions/checkout@v4 + - name: Install SWIG run: | sudo apt-get install -y swig + shell: bash + - name: Export LIBQASM_BUILD_TYPE + run: | echo "LIBQASM_BUILD_TYPE=Debug" >> $GITHUB_ENV - - name: Install SWIG, and set build type (MacOS) - if: matrix.os == 'macos-latest' + shell: bash + - uses: ./.github/actions/python-tests + with: + shell: bash + + python-macos-x64: + name: "Python tests (macOS/x64)" + runs-on: macos-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Install SWIG run: | brew install swig - echo "LIBQASM_BUILD_TYPE=Debug" >> $GITHUB_ENV - - name: Set build type (Windows) - if: matrix.os == 'windows-latest' - shell: powershell + shell: bash + - name: Export LIBQASM_BUILD_TYPE run: | - echo "LIBQASM_BUILD_TYPE=Release" >> $env:GITHUB_ENV - - name: Checkout - uses: actions/checkout@v3 - - name: Build - run: python -m pip install --verbose . - - name: Test - run: python -m pytest + echo "LIBQASM_BUILD_TYPE=Debug" >> $GITHUB_ENV + shell: bash + - uses: ./.github/actions/python-tests + with: + shell: bash - conda: - name: Conda - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: - - ubuntu-latest + python-windows-x64: + name: "Python tests (Windows/x64)" + runs-on: windows-latest steps: - - uses: actions/checkout@v3 - - name: Set up conda - uses: conda-incubator/setup-miniconda@v2 + - 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: - auto-update-conda: true - channels: conda-forge - miniconda-version: "latest" - show-channel-urls: true - - name: Install conda dependencies - run: conda install conda-build conda-verify numpy -y - - name: Build & test - run: conda build python/conda - - name: Install - run: conda install libqasm --use-local + shell: bash docker: name: Docker @@ -172,3 +164,30 @@ jobs: with: push: false tags: libqasm:latest + + complete: + # see https://github.community/t/status-check-for-a-matrix-jobs/127354/7 + name: Report status + needs: + - cpp-linux-x64 + - cpp-macos-x64 + - cpp-windows-x64 + - cpp-linux-arm64 + - cpp-macos-arm64 + - python-linux-x64 + - python-macos-x64 + - python-windows-x64 + - docker + if: ${{ always() }} + runs-on: ubuntu-latest + steps: + - name: Check all job status + # see https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#needs-context + # see https://stackoverflow.com/a/67532120/4907315 + if: >- + ${{ + contains(needs.*.result, 'failure') + || contains(needs.*.result, 'cancelled') + || contains(needs.*.result, 'skipped') + }} + run: exit 1 From feced59575884068d8f6ee408537b50dbc7027a2 Mon Sep 17 00:00:00 2001 From: rturrado <68099809+rturrado@users.noreply.github.com> Date: Wed, 13 Dec 2023 11:40:29 +0100 Subject: [PATCH 02/33] Testing new pipeline. --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9977a90e..ad74987a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -3,7 +3,7 @@ name: Test on: push: branches: - - develop + - olafs_git_hub_pipeline pull_request: jobs: From 5d1faf6f963086e7c474b37dce573de73eb7f114 Mon Sep 17 00:00:00 2001 From: rturrado <68099809+rturrado@users.noreply.github.com> Date: Wed, 13 Dec 2023 11:55:55 +0100 Subject: [PATCH 03/33] Trying to fix cpp-linux-arm64 job. --- .github/workflows/test.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ad74987a..4ce51b6c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -71,10 +71,13 @@ jobs: - name: Add Python symlink run: ln -sf /usr/local/bin/python3.11 /usr/bin/python3 shell: bash -# - name: Install bison and flex -# run: | -# apt-get update -# apt-get install -y bison flex default-jre + # We are having problems when using the m4 and zulu-opendjk Conan packages on an armv8 architecture + # m4 is required by flex/bison and zulu-openjdk provides the Java JRE required by the ANTLR generator + # So, for the time being, we are installing flex/bison and java manually for this platform + - name: Install bison, flex and java + run: | + apt-get update + apt-get install -y bison flex java - uses: ./.github/actions/cpp-tests with: build_type: Release From 03dbe8673322713506e40b055c9523139d55f276 Mon Sep 17 00:00:00 2001 From: rturrado <68099809+rturrado@users.noreply.github.com> Date: Wed, 13 Dec 2023 11:56:24 +0100 Subject: [PATCH 04/33] Trying to fix python jobs. --- .github/actions/python-tests/action.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/actions/python-tests/action.yaml b/.github/actions/python-tests/action.yaml index 14587932..c63bbbf7 100644 --- a/.github/actions/python-tests/action.yaml +++ b/.github/actions/python-tests/action.yaml @@ -20,6 +20,5 @@ runs: run: python -m pip install --verbose . shell: ${{ inputs.shell }} - name: Test - working-directory: tests/qxelarator run: python -m pytest shell: ${{ inputs.shell }} From f83a6984d13ccc2727d03f6f6bb0eca2b1bcc89d Mon Sep 17 00:00:00 2001 From: rturrado <68099809+rturrado@users.noreply.github.com> Date: Wed, 13 Dec 2023 12:06:29 +0100 Subject: [PATCH 05/33] Trying to fix cpp-linux-arm64 job. --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4ce51b6c..6f5f73ae 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -77,7 +77,7 @@ jobs: - name: Install bison, flex and java run: | apt-get update - apt-get install -y bison flex java + apt-get install -y bison flex default-jre - uses: ./.github/actions/cpp-tests with: build_type: Release From b1b6a62c77ba23dcf7c7d21a35839ac5a6bc34ab Mon Sep 17 00:00:00 2001 From: rturrado <68099809+rturrado@users.noreply.github.com> Date: Wed, 13 Dec 2023 12:06:46 +0100 Subject: [PATCH 06/33] Trying to fix python jobs. --- .github/actions/python-tests/action.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/python-tests/action.yaml b/.github/actions/python-tests/action.yaml index c63bbbf7..ed6a171c 100644 --- a/.github/actions/python-tests/action.yaml +++ b/.github/actions/python-tests/action.yaml @@ -14,7 +14,7 @@ runs: - name: Get latest CMake uses: lukka/get-cmake@latest - name: Install Python dependencies - run: python -m pip install --upgrade pip conan setuptools wheel + run: python -m pip install --upgrade pip conan pytest setuptools wheel shell: ${{ inputs.shell }} - name: Build run: python -m pip install --verbose . From dfc87a52b4d0699145e957610921b88ba6e27f67 Mon Sep 17 00:00:00 2001 From: rturrado <68099809+rturrado@users.noreply.github.com> Date: Wed, 13 Dec 2023 12:20:58 +0100 Subject: [PATCH 07/33] Trying to fix cpp-linux-arm64 job. --- .github/workflows/test.yml | 328 ++++++++++++++++++------------------- src/CMakeLists.txt | 1 + 2 files changed, 165 insertions(+), 164 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6f5f73ae..03aa9657 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,59 +7,59 @@ on: pull_request: jobs: - cpp-linux-x64: - name: "C++ tests (gcc-clang/Linux/x64)" - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - build_type: - - Debug - - Release - compiler: - - clang++ - - g++ - steps: - - name: Checkout - uses: actions/checkout@v4 - - uses: ./.github/actions/cpp-tests - with: - build_type: ${{ matrix.build_type }} - shell: bash - - cpp-macos-x64: - name: "C++ tests (clang/MacOS/x64)" - runs-on: macos-latest - strategy: - fail-fast: false - matrix: - build_type: - - Debug - - Release - steps: - - name: Checkout - uses: actions/checkout@v4 - - uses: ./.github/actions/cpp-tests - with: - build_type: ${{ matrix.build_type }} - shell: bash - - cpp-windows-x64: - name: "C++ tests (msvc/Windows/x64)" - runs-on: windows-latest - strategy: - fail-fast: false - matrix: - build_type: - - Debug - - Release - steps: - - name: Checkout - uses: actions/checkout@v4 - - uses: ./.github/actions/cpp-tests - with: - build_type: ${{ matrix.build_type }} - shell: bash +# cpp-linux-x64: +# name: "C++ tests (gcc-clang/Linux/x64)" +# runs-on: ubuntu-latest +# strategy: +# fail-fast: false +# matrix: +# build_type: +# - Debug +# - Release +# compiler: +# - clang++ +# - g++ +# steps: +# - name: Checkout +# uses: actions/checkout@v4 +# - uses: ./.github/actions/cpp-tests +# with: +# build_type: ${{ matrix.build_type }} +# shell: bash +# +# cpp-macos-x64: +# name: "C++ tests (clang/MacOS/x64)" +# runs-on: macos-latest +# strategy: +# fail-fast: false +# matrix: +# build_type: +# - Debug +# - Release +# steps: +# - name: Checkout +# uses: actions/checkout@v4 +# - uses: ./.github/actions/cpp-tests +# with: +# build_type: ${{ matrix.build_type }} +# shell: bash +# +# cpp-windows-x64: +# name: "C++ tests (msvc/Windows/x64)" +# runs-on: windows-latest +# strategy: +# fail-fast: false +# matrix: +# build_type: +# - Debug +# - Release +# steps: +# - name: Checkout +# uses: actions/checkout@v4 +# - uses: ./.github/actions/cpp-tests +# with: +# build_type: ${{ matrix.build_type }} +# shell: bash cpp-linux-arm64: name: "C++ tests (gcc/Linux/ARM64)" @@ -83,114 +83,114 @@ jobs: build_type: Release shell: bash - cpp-macos-arm64: - name: "C++ tests (clang/macos/ARM64)" - runs-on: [self-hosted, ARM64, macOS] - steps: - - name: Checkout - uses: actions/checkout@v4 - # We are having problems when using the m4 and zulu-opendjk Conan packages on an armv8 architecture - # m4 is required by flex/bison and zulu-openjdk provides the Java JRE required by the ANTLR generator - # So, for the time being, we are installing flex/bison and java manually for this platform - - name: Install bison, flex and java - run: | - brew install bison flex java - echo "$(brew --prefix bison)/bin" >> $GITHUB_PATH - echo "$(brew --prefix flex)/bin" >> $GITHUB_PATH - echo "$(brew --prefix java)/bin" >> $GITHUB_PATH - shell: bash - - uses: ./.github/actions/cpp-tests - with: - build_type: Release - shell: bash - - python-linux-x64: - name: "Python tests (Linux/x64)" - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Install SWIG - run: | - sudo apt-get install -y 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 - - python-macos-x64: - name: "Python tests (macOS/x64)" - runs-on: macos-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - 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 - - python-windows-x64: - name: "Python tests (Windows/x64)" - runs-on: windows-latest - 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 - - docker: - name: Docker - runs-on: ubuntu-latest - steps: - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - - name: Build without pushing - uses: docker/build-push-action@v4 - with: - push: false - tags: libqasm:latest - - complete: - # see https://github.community/t/status-check-for-a-matrix-jobs/127354/7 - name: Report status - needs: - - cpp-linux-x64 - - cpp-macos-x64 - - cpp-windows-x64 - - cpp-linux-arm64 - - cpp-macos-arm64 - - python-linux-x64 - - python-macos-x64 - - python-windows-x64 - - docker - if: ${{ always() }} - runs-on: ubuntu-latest - steps: - - name: Check all job status - # see https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#needs-context - # see https://stackoverflow.com/a/67532120/4907315 - if: >- - ${{ - contains(needs.*.result, 'failure') - || contains(needs.*.result, 'cancelled') - || contains(needs.*.result, 'skipped') - }} - run: exit 1 +# cpp-macos-arm64: +# name: "C++ tests (clang/macos/ARM64)" +# runs-on: [self-hosted, ARM64, macOS] +# steps: +# - name: Checkout +# uses: actions/checkout@v4 +# # We are having problems when using the m4 and zulu-opendjk Conan packages on an armv8 architecture +# # m4 is required by flex/bison and zulu-openjdk provides the Java JRE required by the ANTLR generator +# # So, for the time being, we are installing flex/bison and java manually for this platform +# - name: Install bison, flex and java +# run: | +# brew install bison flex java +# echo "$(brew --prefix bison)/bin" >> $GITHUB_PATH +# echo "$(brew --prefix flex)/bin" >> $GITHUB_PATH +# echo "$(brew --prefix java)/bin" >> $GITHUB_PATH +# shell: bash +# - uses: ./.github/actions/cpp-tests +# with: +# build_type: Release +# shell: bash +# +# python-linux-x64: +# name: "Python tests (Linux/x64)" +# runs-on: ubuntu-latest +# steps: +# - name: Checkout +# uses: actions/checkout@v4 +# - name: Install SWIG +# run: | +# sudo apt-get install -y 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 +# +# python-macos-x64: +# name: "Python tests (macOS/x64)" +# runs-on: macos-latest +# steps: +# - name: Checkout +# uses: actions/checkout@v4 +# - 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 +# +# python-windows-x64: +# name: "Python tests (Windows/x64)" +# runs-on: windows-latest +# 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 +# +# docker: +# name: Docker +# runs-on: ubuntu-latest +# steps: +# - name: Set up QEMU +# uses: docker/setup-qemu-action@v2 +# - name: Set up Docker Buildx +# uses: docker/setup-buildx-action@v2 +# - name: Build without pushing +# uses: docker/build-push-action@v4 +# with: +# push: false +# tags: libqasm:latest +# +# complete: +# # see https://github.community/t/status-check-for-a-matrix-jobs/127354/7 +# name: Report status +# needs: +# - cpp-linux-x64 +# - cpp-macos-x64 +# - cpp-windows-x64 +# - cpp-linux-arm64 +# - cpp-macos-arm64 +# - python-linux-x64 +# - python-macos-x64 +# - python-windows-x64 +# - docker +# if: ${{ always() }} +# runs-on: ubuntu-latest +# steps: +# - name: Check all job status +# # see https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#needs-context +# # see https://stackoverflow.com/a/67532120/4907315 +# if: >- +# ${{ +# contains(needs.*.result, 'failure') +# || contains(needs.*.result, 'cancelled') +# || contains(needs.*.result, 'skipped') +# }} +# run: exit 1 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 7306d161..1d0695ba 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -298,6 +298,7 @@ if(CMAKE_COMPILER_IS_GNUCXX) -Wall -Wextra -Werror -Wfatal-errors -fPIC -Wno-error=deprecated-declarations + -Wno-error=maybe-uninitialized -Wno-error=restrict -Wno-error=sign-compare ) From c65344f8583816ece3cd84834543beaf0545b649 Mon Sep 17 00:00:00 2001 From: rturrado <68099809+rturrado@users.noreply.github.com> Date: Wed, 13 Dec 2023 12:28:29 +0100 Subject: [PATCH 08/33] Trying to fix cpp-linux-arm64 job. --- src/CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 1d0695ba..1fd3e993 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -298,7 +298,6 @@ if(CMAKE_COMPILER_IS_GNUCXX) -Wall -Wextra -Werror -Wfatal-errors -fPIC -Wno-error=deprecated-declarations - -Wno-error=maybe-uninitialized -Wno-error=restrict -Wno-error=sign-compare ) @@ -322,6 +321,11 @@ else() message(SEND_ERROR "Unknown compiler!") endif() +# TODO: this flag should go in tree-gen CMakeLists.txt, not here +if(CMAKE_COMPILER_IS_GNUCXX) + add_compile_options(-Werror=maybe-uninitialized) +endif() + # Main cQASM library in shared or static form as managed by cmake's # internal BUILD_SHARED_LIBS variable. add_library(cqasm From 224243170760ac63c5d3075109615222fcf63931 Mon Sep 17 00:00:00 2001 From: rturrado <68099809+rturrado@users.noreply.github.com> Date: Wed, 13 Dec 2023 12:30:14 +0100 Subject: [PATCH 09/33] Trying to fix cpp-linux-arm64 job. --- src/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 1fd3e993..f7dfecc6 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -323,7 +323,7 @@ endif() # TODO: this flag should go in tree-gen CMakeLists.txt, not here if(CMAKE_COMPILER_IS_GNUCXX) - add_compile_options(-Werror=maybe-uninitialized) + add_compile_options(-Wno-error=maybe-uninitialized) endif() # Main cQASM library in shared or static form as managed by cmake's From f32d51370d1c951b188283fe065b181222ab0042 Mon Sep 17 00:00:00 2001 From: rturrado <68099809+rturrado@users.noreply.github.com> Date: Wed, 13 Dec 2023 14:55:39 +0100 Subject: [PATCH 10/33] Update tree-gen to latest commit of tree-gen/olafs_git_hub_pipeline. --- src/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f7dfecc6..56e09ef2 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -67,7 +67,7 @@ endif() # This exposes the generate_tree() function. FetchContent_Declare(tree-gen GIT_REPOSITORY https://github.com/QuTech-Delft/tree-gen.git - GIT_TAG "a661b4e91e0f537073fe48f0b9c032f52c5ab20a" + GIT_TAG "1331fd923a92c0a05a26a0280fa2213c0aefb82c" ) FetchContent_MakeAvailable(tree-gen) From 08be15e1d7fb739b963968fc34cbbfc5485ac9db Mon Sep 17 00:00:00 2001 From: rturrado <68099809+rturrado@users.noreply.github.com> Date: Wed, 13 Dec 2023 16:35:53 +0100 Subject: [PATCH 11/33] Update to use the latest commit ID for tree-gen/olafs_git_hub_pipeline. --- src/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 56e09ef2..d6bc643b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -67,7 +67,7 @@ endif() # This exposes the generate_tree() function. FetchContent_Declare(tree-gen GIT_REPOSITORY https://github.com/QuTech-Delft/tree-gen.git - GIT_TAG "1331fd923a92c0a05a26a0280fa2213c0aefb82c" + GIT_TAG "a93479783bdf51836e4ac1bd9b2f445a5f39c873" ) FetchContent_MakeAvailable(tree-gen) From f1079a1cf60b4ed4c451fbfdbc98b89c25989817 Mon Sep 17 00:00:00 2001 From: rturrado <68099809+rturrado@users.noreply.github.com> Date: Wed, 13 Dec 2023 16:36:00 +0100 Subject: [PATCH 12/33] clang++ compiler is never used. Trying to pass it as an input to action.yaml. --- .github/actions/cpp-tests/action.yaml | 5 ++++- .github/workflows/test.yml | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/actions/cpp-tests/action.yaml b/.github/actions/cpp-tests/action.yaml index 38281cad..e5923b30 100644 --- a/.github/actions/cpp-tests/action.yaml +++ b/.github/actions/cpp-tests/action.yaml @@ -4,6 +4,9 @@ inputs: build_type: required: true description: Is the build a debug or release version + compiler: + required: true + description: Which compiler to use shell: required: true description: Which shell to use for the `run` command @@ -21,7 +24,7 @@ runs: conan profile detect --force build_type=${{ inputs.build_type }} lowercase_build_type=$(echo ${build_type} | tr '[:upper:]' '[:lower:]') - conan build . -pr=conan/profiles/tests-${lowercase_build_type} -b missing + conan build . -pr=conan/profiles/tests-${lowercase_build_type} -s: compiler=${{ inputs.compiler }} -b missing shell: ${{ inputs.shell }} - name: Test working-directory: build/${{ inputs.build_type }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 03aa9657..f56f6bac 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -81,6 +81,7 @@ jobs: - uses: ./.github/actions/cpp-tests with: build_type: Release + compiler: gcc shell: bash # cpp-macos-arm64: From 17e4f193354892551bd957d26e383a32aefdbf7c Mon Sep 17 00:00:00 2001 From: rturrado <68099809+rturrado@users.noreply.github.com> Date: Wed, 13 Dec 2023 16:38:03 +0100 Subject: [PATCH 13/33] Fix conan line in action.yaml. --- .github/actions/cpp-tests/action.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/cpp-tests/action.yaml b/.github/actions/cpp-tests/action.yaml index e5923b30..1d7d0068 100644 --- a/.github/actions/cpp-tests/action.yaml +++ b/.github/actions/cpp-tests/action.yaml @@ -24,7 +24,7 @@ runs: conan profile detect --force build_type=${{ inputs.build_type }} lowercase_build_type=$(echo ${build_type} | tr '[:upper:]' '[:lower:]') - conan build . -pr=conan/profiles/tests-${lowercase_build_type} -s: compiler=${{ inputs.compiler }} -b missing + conan build . -pr=conan/profiles/tests-${lowercase_build_type} -s:b compiler=${{ inputs.compiler }} -b missing shell: ${{ inputs.shell }} - name: Test working-directory: build/${{ inputs.build_type }} From 30b79cfd1429a2506c25f8f23afc11314038ba47 Mon Sep 17 00:00:00 2001 From: rturrado <68099809+rturrado@users.noreply.github.com> Date: Wed, 13 Dec 2023 17:01:41 +0100 Subject: [PATCH 14/33] Trying to fix cpp-linux-arm64 job. --- src/CMakeLists.txt | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d6bc643b..60451fda 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -305,6 +305,7 @@ elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") target_compile_options(cqasm-lib-obj PRIVATE -Wall -Wextra -Werror -Wfatal-errors -fPIC + -Wno-maybe-uninitialized -Wno-error=sign-compare -Wno-error=unused-private-field -Wno-error=unused-but-set-variable @@ -321,11 +322,6 @@ else() message(SEND_ERROR "Unknown compiler!") endif() -# TODO: this flag should go in tree-gen CMakeLists.txt, not here -if(CMAKE_COMPILER_IS_GNUCXX) - add_compile_options(-Wno-error=maybe-uninitialized) -endif() - # Main cQASM library in shared or static form as managed by cmake's # internal BUILD_SHARED_LIBS variable. add_library(cqasm From 0d9a70e00ebf9a796e0ecfc84b0992d991d15c29 Mon Sep 17 00:00:00 2001 From: rturrado <68099809+rturrado@users.noreply.github.com> Date: Wed, 13 Dec 2023 17:05:23 +0100 Subject: [PATCH 15/33] Trying to fix cpp-linux-arm64 job. --- src/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 60451fda..0dcdb13d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -298,6 +298,7 @@ if(CMAKE_COMPILER_IS_GNUCXX) -Wall -Wextra -Werror -Wfatal-errors -fPIC -Wno-error=deprecated-declarations + -Wno-maybe-uninitialized -Wno-error=restrict -Wno-error=sign-compare ) @@ -305,7 +306,6 @@ elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") target_compile_options(cqasm-lib-obj PRIVATE -Wall -Wextra -Werror -Wfatal-errors -fPIC - -Wno-maybe-uninitialized -Wno-error=sign-compare -Wno-error=unused-private-field -Wno-error=unused-but-set-variable From 6eb252250ffafee72b965e6b6cd500f6873cc1e7 Mon Sep 17 00:00:00 2001 From: rturrado <68099809+rturrado@users.noreply.github.com> Date: Wed, 13 Dec 2023 17:07:52 +0100 Subject: [PATCH 16/33] Trying to fix cpp-linux-arm64 job. --- test/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 843372c7..1d21b74b 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -36,6 +36,7 @@ if(CMAKE_COMPILER_IS_GNUCXX) -Wall -Wextra -Werror -Wfatal-errors -fPIC -Wno-error=deprecated-declarations + -Wno-maybe-uninitialized -Wno-error=restrict -Wno-error=sign-compare ) From 79470ced4ec5d9f48b84115791dc16c3b8d9907d Mon Sep 17 00:00:00 2001 From: rturrado <68099809+rturrado@users.noreply.github.com> Date: Thu, 14 Dec 2023 10:20:28 +0100 Subject: [PATCH 17/33] Trying to fix cpp-linux-arm64 job. --- conan/profiles/release | 3 +++ conan/profiles/tests-release | 3 +++ src/CMakeLists.txt | 1 - test/CMakeLists.txt | 1 - 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/conan/profiles/release b/conan/profiles/release index 7842c688..c4133034 100644 --- a/conan/profiles/release +++ b/conan/profiles/release @@ -8,3 +8,6 @@ libqasm/*:build_type=Release libqasm/*:asan_enabled=False libqasm/*:build_tests=False libqasm/*:compat=False + +[conf] +tools.build:cxxflags=["-Wno-error=maybe-uninitialized"] diff --git a/conan/profiles/tests-release b/conan/profiles/tests-release index e0ab99ec..fe28a566 100644 --- a/conan/profiles/tests-release +++ b/conan/profiles/tests-release @@ -8,3 +8,6 @@ libqasm/*:build_type=Release libqasm/*:asan_enabled=True libqasm/*:build_tests=True libqasm/*:compat=False + +[conf] +tools.build:cxxflags=["-Wno-error=maybe-uninitialized"] diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0dcdb13d..789adec7 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -298,7 +298,6 @@ if(CMAKE_COMPILER_IS_GNUCXX) -Wall -Wextra -Werror -Wfatal-errors -fPIC -Wno-error=deprecated-declarations - -Wno-maybe-uninitialized -Wno-error=restrict -Wno-error=sign-compare ) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 1d21b74b..843372c7 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -36,7 +36,6 @@ if(CMAKE_COMPILER_IS_GNUCXX) -Wall -Wextra -Werror -Wfatal-errors -fPIC -Wno-error=deprecated-declarations - -Wno-maybe-uninitialized -Wno-error=restrict -Wno-error=sign-compare ) From 7535fea5fb0e9ac7c7afe9f7cbda747ec4d558e9 Mon Sep 17 00:00:00 2001 From: rturrado <68099809+rturrado@users.noreply.github.com> Date: Thu, 14 Dec 2023 11:03:37 +0100 Subject: [PATCH 18/33] Enabled all jobs in test.yml. Added Debug and Release builds for arm64 jobs. --- .github/workflows/test.yml | 340 +++++++++++++++++++------------------ 1 file changed, 176 insertions(+), 164 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f56f6bac..bee80a83 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,64 +7,70 @@ on: pull_request: jobs: -# cpp-linux-x64: -# name: "C++ tests (gcc-clang/Linux/x64)" -# runs-on: ubuntu-latest -# strategy: -# fail-fast: false -# matrix: -# build_type: -# - Debug -# - Release -# compiler: -# - clang++ -# - g++ -# steps: -# - name: Checkout -# uses: actions/checkout@v4 -# - uses: ./.github/actions/cpp-tests -# with: -# build_type: ${{ matrix.build_type }} -# shell: bash -# -# cpp-macos-x64: -# name: "C++ tests (clang/MacOS/x64)" -# runs-on: macos-latest -# strategy: -# fail-fast: false -# matrix: -# build_type: -# - Debug -# - Release -# steps: -# - name: Checkout -# uses: actions/checkout@v4 -# - uses: ./.github/actions/cpp-tests -# with: -# build_type: ${{ matrix.build_type }} -# shell: bash -# -# cpp-windows-x64: -# name: "C++ tests (msvc/Windows/x64)" -# runs-on: windows-latest -# strategy: -# fail-fast: false -# matrix: -# build_type: -# - Debug -# - Release -# steps: -# - name: Checkout -# uses: actions/checkout@v4 -# - uses: ./.github/actions/cpp-tests -# with: -# build_type: ${{ matrix.build_type }} -# shell: bash + cpp-linux-x64: + name: "C++ tests (gcc-clang/Linux/x64)" + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + build_type: + - Debug + - Release + compiler: + - clang++ + - g++ + steps: + - name: Checkout + uses: actions/checkout@v4 + - uses: ./.github/actions/cpp-tests + with: + build_type: ${{ matrix.build_type }} + shell: bash + + cpp-macos-x64: + name: "C++ tests (clang/MacOS/x64)" + runs-on: macos-latest + strategy: + fail-fast: false + matrix: + build_type: + - Debug + - Release + steps: + - name: Checkout + uses: actions/checkout@v4 + - uses: ./.github/actions/cpp-tests + with: + build_type: ${{ matrix.build_type }} + shell: bash + + cpp-windows-x64: + name: "C++ tests (msvc/Windows/x64)" + runs-on: windows-latest + strategy: + fail-fast: false + matrix: + build_type: + - Debug + - Release + steps: + - name: Checkout + uses: actions/checkout@v4 + - uses: ./.github/actions/cpp-tests + with: + build_type: ${{ matrix.build_type }} + shell: bash cpp-linux-arm64: name: "C++ tests (gcc/Linux/ARM64)" runs-on: [self-hosted, ARM64, Linux] container: python:3.11 + strategy: + fail-fast: false + matrix: + build_type: + - Debug + - Release steps: - name: Checkout uses: actions/checkout@v4 @@ -84,114 +90,120 @@ jobs: compiler: gcc shell: bash -# cpp-macos-arm64: -# name: "C++ tests (clang/macos/ARM64)" -# runs-on: [self-hosted, ARM64, macOS] -# steps: -# - name: Checkout -# uses: actions/checkout@v4 -# # We are having problems when using the m4 and zulu-opendjk Conan packages on an armv8 architecture -# # m4 is required by flex/bison and zulu-openjdk provides the Java JRE required by the ANTLR generator -# # So, for the time being, we are installing flex/bison and java manually for this platform -# - name: Install bison, flex and java -# run: | -# brew install bison flex java -# echo "$(brew --prefix bison)/bin" >> $GITHUB_PATH -# echo "$(brew --prefix flex)/bin" >> $GITHUB_PATH -# echo "$(brew --prefix java)/bin" >> $GITHUB_PATH -# shell: bash -# - uses: ./.github/actions/cpp-tests -# with: -# build_type: Release -# shell: bash -# -# python-linux-x64: -# name: "Python tests (Linux/x64)" -# runs-on: ubuntu-latest -# steps: -# - name: Checkout -# uses: actions/checkout@v4 -# - name: Install SWIG -# run: | -# sudo apt-get install -y 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 -# -# python-macos-x64: -# name: "Python tests (macOS/x64)" -# runs-on: macos-latest -# steps: -# - name: Checkout -# uses: actions/checkout@v4 -# - 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 -# -# python-windows-x64: -# name: "Python tests (Windows/x64)" -# runs-on: windows-latest -# 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 -# -# docker: -# name: Docker -# runs-on: ubuntu-latest -# steps: -# - name: Set up QEMU -# uses: docker/setup-qemu-action@v2 -# - name: Set up Docker Buildx -# uses: docker/setup-buildx-action@v2 -# - name: Build without pushing -# uses: docker/build-push-action@v4 -# with: -# push: false -# tags: libqasm:latest -# -# complete: -# # see https://github.community/t/status-check-for-a-matrix-jobs/127354/7 -# name: Report status -# needs: -# - cpp-linux-x64 -# - cpp-macos-x64 -# - cpp-windows-x64 -# - cpp-linux-arm64 -# - cpp-macos-arm64 -# - python-linux-x64 -# - python-macos-x64 -# - python-windows-x64 -# - docker -# if: ${{ always() }} -# runs-on: ubuntu-latest -# steps: -# - name: Check all job status -# # see https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#needs-context -# # see https://stackoverflow.com/a/67532120/4907315 -# if: >- -# ${{ -# contains(needs.*.result, 'failure') -# || contains(needs.*.result, 'cancelled') -# || contains(needs.*.result, 'skipped') -# }} -# run: exit 1 + cpp-macos-arm64: + name: "C++ tests (clang/macos/ARM64)" + runs-on: [self-hosted, ARM64, macOS] + strategy: + fail-fast: false + matrix: + build_type: + - Debug + - Release + steps: + - name: Checkout + uses: actions/checkout@v4 + # We are having problems when using the m4 and zulu-opendjk Conan packages on an armv8 architecture + # m4 is required by flex/bison and zulu-openjdk provides the Java JRE required by the ANTLR generator + # So, for the time being, we are installing flex/bison and java manually for this platform + - name: Install bison, flex and java + run: | + brew install bison flex java + echo "$(brew --prefix bison)/bin" >> $GITHUB_PATH + echo "$(brew --prefix flex)/bin" >> $GITHUB_PATH + echo "$(brew --prefix java)/bin" >> $GITHUB_PATH + shell: bash + - uses: ./.github/actions/cpp-tests + with: + build_type: Release + shell: bash + + python-linux-x64: + name: "Python tests (Linux/x64)" + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Install SWIG + run: | + sudo apt-get install -y 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 + + python-macos-x64: + name: "Python tests (macOS/x64)" + runs-on: macos-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - 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 + + python-windows-x64: + name: "Python tests (Windows/x64)" + runs-on: windows-latest + 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 + + docker: + name: Docker + runs-on: ubuntu-latest + steps: + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - name: Build without pushing + uses: docker/build-push-action@v4 + with: + push: false + tags: libqasm:latest + + complete: + # see https://github.community/t/status-check-for-a-matrix-jobs/127354/7 + name: Report status + needs: + - cpp-linux-x64 + - cpp-macos-x64 + - cpp-windows-x64 + - cpp-linux-arm64 + - cpp-macos-arm64 + - python-linux-x64 + - python-macos-x64 + - python-windows-x64 + - docker + if: ${{ always() }} + runs-on: ubuntu-latest + steps: + - name: Check all job status + # see https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#needs-context + # see https://stackoverflow.com/a/67532120/4907315 + if: >- + ${{ + contains(needs.*.result, 'failure') + || contains(needs.*.result, 'cancelled') + || contains(needs.*.result, 'skipped') + }} + run: exit 1 From 9ecea4c4950d6288f1069a4b136ce74c9d9fa27b Mon Sep 17 00:00:00 2001 From: rturrado <68099809+rturrado@users.noreply.github.com> Date: Thu, 14 Dec 2023 11:12:52 +0100 Subject: [PATCH 19/33] Passing compiler to .github/actions/cpp-tests for all cpp jobs. --- .github/workflows/test.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index bee80a83..d7f82ab9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -25,6 +25,7 @@ jobs: - uses: ./.github/actions/cpp-tests with: build_type: ${{ matrix.build_type }} + compiler: ${{ matrix.compiler }} shell: bash cpp-macos-x64: @@ -42,6 +43,7 @@ jobs: - uses: ./.github/actions/cpp-tests with: build_type: ${{ matrix.build_type }} + compiler: clang shell: bash cpp-windows-x64: @@ -59,6 +61,7 @@ jobs: - uses: ./.github/actions/cpp-tests with: build_type: ${{ matrix.build_type }} + compiler: msvc shell: bash cpp-linux-arm64: @@ -115,6 +118,7 @@ jobs: - uses: ./.github/actions/cpp-tests with: build_type: Release + compiler: clang shell: bash python-linux-x64: From a2de93ab996f6dc404e2100ad17788b20c4a0a9a Mon Sep 17 00:00:00 2001 From: rturrado <68099809+rturrado@users.noreply.github.com> Date: Thu, 14 Dec 2023 11:15:03 +0100 Subject: [PATCH 20/33] Fixing compiler name for cpp-linux-x64 job. --- .github/workflows/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d7f82ab9..499159d8 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -17,8 +17,8 @@ jobs: - Debug - Release compiler: - - clang++ - - g++ + - clang + - gcc steps: - name: Checkout uses: actions/checkout@v4 From 62cceca0b704684065cbd976e8fe4281c8e6d0e4 Mon Sep 17 00:00:00 2001 From: rturrado <68099809+rturrado@users.noreply.github.com> Date: Thu, 14 Dec 2023 14:13:12 +0100 Subject: [PATCH 21/33] Added new conan profiles. They are specific for every compiler, OS, and architecture. --- conan/profiles/tests-debug-clang-linux-x64 | 5 +++++ conan/profiles/tests-debug-gcc-linux-x64 | 1 + conan/profiles/tests-debug-linux-arm64 | 1 + conan/profiles/tests-debug-macos-arm64 | 5 +++++ conan/profiles/tests-debug-macos-x64 | 5 +++++ conan/profiles/tests-debug-windows-x64 | 1 + conan/profiles/tests-release-clang-linux-x64 | 5 +++++ conan/profiles/tests-release-gcc-linux-x64 | 1 + conan/profiles/tests-release-linux-arm64 | 4 ++++ conan/profiles/tests-release-macos-arm64 | 5 +++++ conan/profiles/tests-release-macos-x64 | 5 +++++ conan/profiles/tests-release-windows-x64 | 1 + 12 files changed, 39 insertions(+) create mode 100644 conan/profiles/tests-debug-clang-linux-x64 create mode 100644 conan/profiles/tests-debug-gcc-linux-x64 create mode 100644 conan/profiles/tests-debug-linux-arm64 create mode 100644 conan/profiles/tests-debug-macos-arm64 create mode 100644 conan/profiles/tests-debug-macos-x64 create mode 100644 conan/profiles/tests-debug-windows-x64 create mode 100644 conan/profiles/tests-release-clang-linux-x64 create mode 100644 conan/profiles/tests-release-gcc-linux-x64 create mode 100644 conan/profiles/tests-release-linux-arm64 create mode 100644 conan/profiles/tests-release-macos-arm64 create mode 100644 conan/profiles/tests-release-macos-x64 create mode 100644 conan/profiles/tests-release-windows-x64 diff --git a/conan/profiles/tests-debug-clang-linux-x64 b/conan/profiles/tests-debug-clang-linux-x64 new file mode 100644 index 00000000..cb2b3617 --- /dev/null +++ b/conan/profiles/tests-debug-clang-linux-x64 @@ -0,0 +1,5 @@ +include(tests-debug) + +[settings] +compiler=clang +compiler.version=14 diff --git a/conan/profiles/tests-debug-gcc-linux-x64 b/conan/profiles/tests-debug-gcc-linux-x64 new file mode 100644 index 00000000..28102643 --- /dev/null +++ b/conan/profiles/tests-debug-gcc-linux-x64 @@ -0,0 +1 @@ +include(tests-debug) diff --git a/conan/profiles/tests-debug-linux-arm64 b/conan/profiles/tests-debug-linux-arm64 new file mode 100644 index 00000000..28102643 --- /dev/null +++ b/conan/profiles/tests-debug-linux-arm64 @@ -0,0 +1 @@ +include(tests-debug) diff --git a/conan/profiles/tests-debug-macos-arm64 b/conan/profiles/tests-debug-macos-arm64 new file mode 100644 index 00000000..5652dec8 --- /dev/null +++ b/conan/profiles/tests-debug-macos-arm64 @@ -0,0 +1,5 @@ +include(tests-debug) + +[settings] +compiler=apple-clang +compiler.version=14 diff --git a/conan/profiles/tests-debug-macos-x64 b/conan/profiles/tests-debug-macos-x64 new file mode 100644 index 00000000..5652dec8 --- /dev/null +++ b/conan/profiles/tests-debug-macos-x64 @@ -0,0 +1,5 @@ +include(tests-debug) + +[settings] +compiler=apple-clang +compiler.version=14 diff --git a/conan/profiles/tests-debug-windows-x64 b/conan/profiles/tests-debug-windows-x64 new file mode 100644 index 00000000..1d207abf --- /dev/null +++ b/conan/profiles/tests-debug-windows-x64 @@ -0,0 +1 @@ +include(tests-debug) \ No newline at end of file diff --git a/conan/profiles/tests-release-clang-linux-x64 b/conan/profiles/tests-release-clang-linux-x64 new file mode 100644 index 00000000..9f862d29 --- /dev/null +++ b/conan/profiles/tests-release-clang-linux-x64 @@ -0,0 +1,5 @@ +include(tests-release) + +[settings] +compiler=clang +compiler.version=14 diff --git a/conan/profiles/tests-release-gcc-linux-x64 b/conan/profiles/tests-release-gcc-linux-x64 new file mode 100644 index 00000000..9f649735 --- /dev/null +++ b/conan/profiles/tests-release-gcc-linux-x64 @@ -0,0 +1 @@ +include(tests-release) diff --git a/conan/profiles/tests-release-linux-arm64 b/conan/profiles/tests-release-linux-arm64 new file mode 100644 index 00000000..058c0f3a --- /dev/null +++ b/conan/profiles/tests-release-linux-arm64 @@ -0,0 +1,4 @@ +include(tests-release) + +[conf] +tools.build:cxxflags=["-Wno-error=maybe-uninitialized"] diff --git a/conan/profiles/tests-release-macos-arm64 b/conan/profiles/tests-release-macos-arm64 new file mode 100644 index 00000000..9c920952 --- /dev/null +++ b/conan/profiles/tests-release-macos-arm64 @@ -0,0 +1,5 @@ +include(tests-release) + +[settings] +compiler=apple-clang +compiler.version=14 diff --git a/conan/profiles/tests-release-macos-x64 b/conan/profiles/tests-release-macos-x64 new file mode 100644 index 00000000..9c920952 --- /dev/null +++ b/conan/profiles/tests-release-macos-x64 @@ -0,0 +1,5 @@ +include(tests-release) + +[settings] +compiler=apple-clang +compiler.version=14 diff --git a/conan/profiles/tests-release-windows-x64 b/conan/profiles/tests-release-windows-x64 new file mode 100644 index 00000000..9f649735 --- /dev/null +++ b/conan/profiles/tests-release-windows-x64 @@ -0,0 +1 @@ +include(tests-release) From 377ccf86582e4294742d8d7d13d41734583ee0ba Mon Sep 17 00:00:00 2001 From: rturrado <68099809+rturrado@users.noreply.github.com> Date: Thu, 14 Dec 2023 14:14:26 +0100 Subject: [PATCH 22/33] Updated GitHub jobs to use specific profiles. --- .github/actions/cpp-tests/action.yaml | 6 +++--- .github/workflows/test.yml | 14 +++++++------- conan/profiles/release | 3 --- conan/profiles/tests-release | 3 --- 4 files changed, 10 insertions(+), 16 deletions(-) diff --git a/.github/actions/cpp-tests/action.yaml b/.github/actions/cpp-tests/action.yaml index 1d7d0068..73492e84 100644 --- a/.github/actions/cpp-tests/action.yaml +++ b/.github/actions/cpp-tests/action.yaml @@ -4,9 +4,9 @@ inputs: build_type: required: true description: Is the build a debug or release version - compiler: + conan_profile: required: true - description: Which compiler to use + description: Which conan profile to use shell: required: true description: Which shell to use for the `run` command @@ -24,7 +24,7 @@ runs: conan profile detect --force build_type=${{ inputs.build_type }} lowercase_build_type=$(echo ${build_type} | tr '[:upper:]' '[:lower:]') - conan build . -pr=conan/profiles/tests-${lowercase_build_type} -s:b compiler=${{ inputs.compiler }} -b missing + conan build . -pr=conan/profiles/${{ inputs.conan_profile }} -b missing shell: ${{ inputs.shell }} - name: Test working-directory: build/${{ inputs.build_type }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 499159d8..9ebadf0c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -25,7 +25,7 @@ jobs: - uses: ./.github/actions/cpp-tests with: build_type: ${{ matrix.build_type }} - compiler: ${{ matrix.compiler }} + conan_profile: tests-${{ matrix.build_type }}-${{ matrix.compiler }}-linux-x64 shell: bash cpp-macos-x64: @@ -43,7 +43,7 @@ jobs: - uses: ./.github/actions/cpp-tests with: build_type: ${{ matrix.build_type }} - compiler: clang + conan_profile: tests-${{ matrix.build_type }}-macos-x64 shell: bash cpp-windows-x64: @@ -61,7 +61,7 @@ jobs: - uses: ./.github/actions/cpp-tests with: build_type: ${{ matrix.build_type }} - compiler: msvc + conan_profile: tests-${{ matrix.build_type }}-windows-x64 shell: bash cpp-linux-arm64: @@ -89,8 +89,8 @@ jobs: apt-get install -y bison flex default-jre - uses: ./.github/actions/cpp-tests with: - build_type: Release - compiler: gcc + build_type: ${{ matrix.build_type }} + conan_profile: tests-${{ matrix.build_type }}-linux-arm64 shell: bash cpp-macos-arm64: @@ -117,8 +117,8 @@ jobs: shell: bash - uses: ./.github/actions/cpp-tests with: - build_type: Release - compiler: clang + build_type: ${{ matrix.build_type }} + conan_profile: tests-${{ matrix.build_type }}-macos-arm64 shell: bash python-linux-x64: diff --git a/conan/profiles/release b/conan/profiles/release index c4133034..7842c688 100644 --- a/conan/profiles/release +++ b/conan/profiles/release @@ -8,6 +8,3 @@ libqasm/*:build_type=Release libqasm/*:asan_enabled=False libqasm/*:build_tests=False libqasm/*:compat=False - -[conf] -tools.build:cxxflags=["-Wno-error=maybe-uninitialized"] diff --git a/conan/profiles/tests-release b/conan/profiles/tests-release index fe28a566..e0ab99ec 100644 --- a/conan/profiles/tests-release +++ b/conan/profiles/tests-release @@ -8,6 +8,3 @@ libqasm/*:build_type=Release libqasm/*:asan_enabled=True libqasm/*:build_tests=True libqasm/*:compat=False - -[conf] -tools.build:cxxflags=["-Wno-error=maybe-uninitialized"] From c77cda3e28a88410f71df97a58adf73ade4c6f1f Mon Sep 17 00:00:00 2001 From: rturrado <68099809+rturrado@users.noreply.github.com> Date: Thu, 14 Dec 2023 14:24:05 +0100 Subject: [PATCH 23/33] Fix conan profile name. --- .github/actions/cpp-tests/action.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/actions/cpp-tests/action.yaml b/.github/actions/cpp-tests/action.yaml index 73492e84..dda4f267 100644 --- a/.github/actions/cpp-tests/action.yaml +++ b/.github/actions/cpp-tests/action.yaml @@ -22,9 +22,9 @@ runs: - name: Configure and build run: | conan profile detect --force - build_type=${{ inputs.build_type }} - lowercase_build_type=$(echo ${build_type} | tr '[:upper:]' '[:lower:]') - conan build . -pr=conan/profiles/${{ inputs.conan_profile }} -b missing + conan_profile=${{ inputs.conan_profile }} + lowercase_conan_profile=$(echo ${conan_profile} | tr '[:upper:]' '[:lower:]') + conan build . -pr=conan/profiles/${lowercase_conan_profile} -b missing shell: ${{ inputs.shell }} - name: Test working-directory: build/${{ inputs.build_type }} From a83a096826290f8d0202f7728eee2a05e5771dca Mon Sep 17 00:00:00 2001 From: rturrado <68099809+rturrado@users.noreply.github.com> Date: Thu, 14 Dec 2023 15:01:40 +0100 Subject: [PATCH 24/33] Trying to fix clang-linux-x64 jobs. Using a build profile instead of a host profile. --- .github/actions/cpp-tests/action.yaml | 2 +- .github/workflows/test.yml | 370 +++++++++++++------------- 2 files changed, 186 insertions(+), 186 deletions(-) diff --git a/.github/actions/cpp-tests/action.yaml b/.github/actions/cpp-tests/action.yaml index dda4f267..a284dc7f 100644 --- a/.github/actions/cpp-tests/action.yaml +++ b/.github/actions/cpp-tests/action.yaml @@ -24,7 +24,7 @@ runs: conan profile detect --force conan_profile=${{ inputs.conan_profile }} lowercase_conan_profile=$(echo ${conan_profile} | tr '[:upper:]' '[:lower:]') - conan build . -pr=conan/profiles/${lowercase_conan_profile} -b missing + conan build . -pr:b=conan/profiles/${lowercase_conan_profile} -b missing shell: ${{ inputs.shell }} - name: Test working-directory: build/${{ inputs.build_type }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9ebadf0c..a2e67a86 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,11 +14,11 @@ jobs: fail-fast: false matrix: build_type: - - Debug +# - Debug - Release compiler: - clang - - gcc +# - gcc steps: - name: Checkout uses: actions/checkout@v4 @@ -28,186 +28,186 @@ jobs: conan_profile: tests-${{ matrix.build_type }}-${{ matrix.compiler }}-linux-x64 shell: bash - cpp-macos-x64: - name: "C++ tests (clang/MacOS/x64)" - runs-on: macos-latest - strategy: - fail-fast: false - matrix: - build_type: - - Debug - - Release - steps: - - name: Checkout - uses: actions/checkout@v4 - - uses: ./.github/actions/cpp-tests - with: - build_type: ${{ matrix.build_type }} - conan_profile: tests-${{ matrix.build_type }}-macos-x64 - shell: bash - - cpp-windows-x64: - name: "C++ tests (msvc/Windows/x64)" - runs-on: windows-latest - strategy: - fail-fast: false - matrix: - build_type: - - Debug - - Release - steps: - - name: Checkout - uses: actions/checkout@v4 - - uses: ./.github/actions/cpp-tests - with: - build_type: ${{ matrix.build_type }} - conan_profile: tests-${{ matrix.build_type }}-windows-x64 - shell: bash - - cpp-linux-arm64: - name: "C++ tests (gcc/Linux/ARM64)" - runs-on: [self-hosted, ARM64, Linux] - container: python:3.11 - strategy: - fail-fast: false - matrix: - build_type: - - Debug - - Release - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Add Python symlink - run: ln -sf /usr/local/bin/python3.11 /usr/bin/python3 - shell: bash - # We are having problems when using the m4 and zulu-opendjk Conan packages on an armv8 architecture - # m4 is required by flex/bison and zulu-openjdk provides the Java JRE required by the ANTLR generator - # So, for the time being, we are installing flex/bison and java manually for this platform - - name: Install bison, flex and java - run: | - apt-get update - apt-get install -y bison flex default-jre - - uses: ./.github/actions/cpp-tests - with: - build_type: ${{ matrix.build_type }} - conan_profile: tests-${{ matrix.build_type }}-linux-arm64 - shell: bash - - cpp-macos-arm64: - name: "C++ tests (clang/macos/ARM64)" - runs-on: [self-hosted, ARM64, macOS] - strategy: - fail-fast: false - matrix: - build_type: - - Debug - - Release - steps: - - name: Checkout - uses: actions/checkout@v4 - # We are having problems when using the m4 and zulu-opendjk Conan packages on an armv8 architecture - # m4 is required by flex/bison and zulu-openjdk provides the Java JRE required by the ANTLR generator - # So, for the time being, we are installing flex/bison and java manually for this platform - - name: Install bison, flex and java - run: | - brew install bison flex java - echo "$(brew --prefix bison)/bin" >> $GITHUB_PATH - echo "$(brew --prefix flex)/bin" >> $GITHUB_PATH - echo "$(brew --prefix java)/bin" >> $GITHUB_PATH - shell: bash - - uses: ./.github/actions/cpp-tests - with: - build_type: ${{ matrix.build_type }} - conan_profile: tests-${{ matrix.build_type }}-macos-arm64 - shell: bash - - python-linux-x64: - name: "Python tests (Linux/x64)" - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Install SWIG - run: | - sudo apt-get install -y 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 - - python-macos-x64: - name: "Python tests (macOS/x64)" - runs-on: macos-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - 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 - - python-windows-x64: - name: "Python tests (Windows/x64)" - runs-on: windows-latest - 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 - - docker: - name: Docker - runs-on: ubuntu-latest - steps: - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - - name: Build without pushing - uses: docker/build-push-action@v4 - with: - push: false - tags: libqasm:latest - - complete: - # see https://github.community/t/status-check-for-a-matrix-jobs/127354/7 - name: Report status - needs: - - cpp-linux-x64 - - cpp-macos-x64 - - cpp-windows-x64 - - cpp-linux-arm64 - - cpp-macos-arm64 - - python-linux-x64 - - python-macos-x64 - - python-windows-x64 - - docker - if: ${{ always() }} - runs-on: ubuntu-latest - steps: - - name: Check all job status - # see https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#needs-context - # see https://stackoverflow.com/a/67532120/4907315 - if: >- - ${{ - contains(needs.*.result, 'failure') - || contains(needs.*.result, 'cancelled') - || contains(needs.*.result, 'skipped') - }} - run: exit 1 +# cpp-macos-x64: +# name: "C++ tests (clang/MacOS/x64)" +# runs-on: macos-latest +# strategy: +# fail-fast: false +# matrix: +# build_type: +# - Debug +# - Release +# steps: +# - name: Checkout +# uses: actions/checkout@v4 +# - uses: ./.github/actions/cpp-tests +# with: +# build_type: ${{ matrix.build_type }} +# conan_profile: tests-${{ matrix.build_type }}-macos-x64 +# shell: bash +# +# cpp-windows-x64: +# name: "C++ tests (msvc/Windows/x64)" +# runs-on: windows-latest +# strategy: +# fail-fast: false +# matrix: +# build_type: +# - Debug +# - Release +# steps: +# - name: Checkout +# uses: actions/checkout@v4 +# - uses: ./.github/actions/cpp-tests +# with: +# build_type: ${{ matrix.build_type }} +# conan_profile: tests-${{ matrix.build_type }}-windows-x64 +# shell: bash +# +# cpp-linux-arm64: +# name: "C++ tests (gcc/Linux/ARM64)" +# runs-on: [self-hosted, ARM64, Linux] +# container: python:3.11 +# strategy: +# fail-fast: false +# matrix: +# build_type: +# - Debug +# - Release +# steps: +# - name: Checkout +# uses: actions/checkout@v4 +# - name: Add Python symlink +# run: ln -sf /usr/local/bin/python3.11 /usr/bin/python3 +# shell: bash +# # We are having problems when using the m4 and zulu-opendjk Conan packages on an armv8 architecture +# # m4 is required by flex/bison and zulu-openjdk provides the Java JRE required by the ANTLR generator +# # So, for the time being, we are installing flex/bison and java manually for this platform +# - name: Install bison, flex and java +# run: | +# apt-get update +# apt-get install -y bison flex default-jre +# - uses: ./.github/actions/cpp-tests +# with: +# build_type: ${{ matrix.build_type }} +# conan_profile: tests-${{ matrix.build_type }}-linux-arm64 +# shell: bash +# +# cpp-macos-arm64: +# name: "C++ tests (clang/macos/ARM64)" +# runs-on: [self-hosted, ARM64, macOS] +# strategy: +# fail-fast: false +# matrix: +# build_type: +# - Debug +# - Release +# steps: +# - name: Checkout +# uses: actions/checkout@v4 +# # We are having problems when using the m4 and zulu-opendjk Conan packages on an armv8 architecture +# # m4 is required by flex/bison and zulu-openjdk provides the Java JRE required by the ANTLR generator +# # So, for the time being, we are installing flex/bison and java manually for this platform +# - name: Install bison, flex and java +# run: | +# brew install bison flex java +# echo "$(brew --prefix bison)/bin" >> $GITHUB_PATH +# echo "$(brew --prefix flex)/bin" >> $GITHUB_PATH +# echo "$(brew --prefix java)/bin" >> $GITHUB_PATH +# shell: bash +# - uses: ./.github/actions/cpp-tests +# with: +# build_type: ${{ matrix.build_type }} +# conan_profile: tests-${{ matrix.build_type }}-macos-arm64 +# shell: bash +# +# python-linux-x64: +# name: "Python tests (Linux/x64)" +# runs-on: ubuntu-latest +# steps: +# - name: Checkout +# uses: actions/checkout@v4 +# - name: Install SWIG +# run: | +# sudo apt-get install -y 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 +# +# python-macos-x64: +# name: "Python tests (macOS/x64)" +# runs-on: macos-latest +# steps: +# - name: Checkout +# uses: actions/checkout@v4 +# - 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 +# +# python-windows-x64: +# name: "Python tests (Windows/x64)" +# runs-on: windows-latest +# 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 +# +# docker: +# name: Docker +# runs-on: ubuntu-latest +# steps: +# - name: Set up QEMU +# uses: docker/setup-qemu-action@v2 +# - name: Set up Docker Buildx +# uses: docker/setup-buildx-action@v2 +# - name: Build without pushing +# uses: docker/build-push-action@v4 +# with: +# push: false +# tags: libqasm:latest +# +# complete: +# # see https://github.community/t/status-check-for-a-matrix-jobs/127354/7 +# name: Report status +# needs: +# - cpp-linux-x64 +# - cpp-macos-x64 +# - cpp-windows-x64 +# - cpp-linux-arm64 +# - cpp-macos-arm64 +# - python-linux-x64 +# - python-macos-x64 +# - python-windows-x64 +# - docker +# if: ${{ always() }} +# runs-on: ubuntu-latest +# steps: +# - name: Check all job status +# # see https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#needs-context +# # see https://stackoverflow.com/a/67532120/4907315 +# if: >- +# ${{ +# contains(needs.*.result, 'failure') +# || contains(needs.*.result, 'cancelled') +# || contains(needs.*.result, 'skipped') +# }} +# run: exit 1 From 6e07ef5c6df0372dea1580bbae867175bc5edbcf Mon Sep 17 00:00:00 2001 From: rturrado <68099809+rturrado@users.noreply.github.com> Date: Thu, 14 Dec 2023 15:26:34 +0100 Subject: [PATCH 25/33] Trying to fix clang-linux-x64 jobs. Using a build profile instead of a host profile. --- conan/profiles/tests-release-clang-linux-x64 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/conan/profiles/tests-release-clang-linux-x64 b/conan/profiles/tests-release-clang-linux-x64 index 9f862d29..ca6e8179 100644 --- a/conan/profiles/tests-release-clang-linux-x64 +++ b/conan/profiles/tests-release-clang-linux-x64 @@ -3,3 +3,6 @@ include(tests-release) [settings] compiler=clang compiler.version=14 + +[conf] +tools.build:compiler_executables={ 'c' : 'clang', 'cpp' : 'clang++' } From 8bee1cb1347b0e241581fc330395ac22acd8f1db Mon Sep 17 00:00:00 2001 From: rturrado <68099809+rturrado@users.noreply.github.com> Date: Thu, 14 Dec 2023 15:32:23 +0100 Subject: [PATCH 26/33] Trying to fix clang-linux-x64 jobs. Back to using '-pr' instead of '-pr:b'. --- .github/actions/cpp-tests/action.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/cpp-tests/action.yaml b/.github/actions/cpp-tests/action.yaml index a284dc7f..dda4f267 100644 --- a/.github/actions/cpp-tests/action.yaml +++ b/.github/actions/cpp-tests/action.yaml @@ -24,7 +24,7 @@ runs: conan profile detect --force conan_profile=${{ inputs.conan_profile }} lowercase_conan_profile=$(echo ${conan_profile} | tr '[:upper:]' '[:lower:]') - conan build . -pr:b=conan/profiles/${lowercase_conan_profile} -b missing + conan build . -pr=conan/profiles/${lowercase_conan_profile} -b missing shell: ${{ inputs.shell }} - name: Test working-directory: build/${{ inputs.build_type }} From 97d8c76511c6df2abcc8a8ed1ae8c8c072d57a00 Mon Sep 17 00:00:00 2001 From: rturrado <68099809+rturrado@users.noreply.github.com> Date: Thu, 14 Dec 2023 15:44:10 +0100 Subject: [PATCH 27/33] Trying to fix clang-linux-x64 jobs. Added build flag '-stdlib=libc++'. --- conan/profiles/tests-release-clang-linux-x64 | 1 + 1 file changed, 1 insertion(+) diff --git a/conan/profiles/tests-release-clang-linux-x64 b/conan/profiles/tests-release-clang-linux-x64 index ca6e8179..7d702665 100644 --- a/conan/profiles/tests-release-clang-linux-x64 +++ b/conan/profiles/tests-release-clang-linux-x64 @@ -5,4 +5,5 @@ compiler=clang compiler.version=14 [conf] +tools.build:cxx_flags=["-stdlib=libc++"] tools.build:compiler_executables={ 'c' : 'clang', 'cpp' : 'clang++' } From 92b6e27684b7986bdb740b86438e607bf6c8e0cb Mon Sep 17 00:00:00 2001 From: rturrado <68099809+rturrado@users.noreply.github.com> Date: Thu, 14 Dec 2023 15:48:24 +0100 Subject: [PATCH 28/33] Trying to fix clang-linux-x64 jobs. Changed 'cxx_flags' to 'cxxflags'. --- conan/profiles/tests-release-clang-linux-x64 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conan/profiles/tests-release-clang-linux-x64 b/conan/profiles/tests-release-clang-linux-x64 index 7d702665..3f39a2ca 100644 --- a/conan/profiles/tests-release-clang-linux-x64 +++ b/conan/profiles/tests-release-clang-linux-x64 @@ -5,5 +5,5 @@ compiler=clang compiler.version=14 [conf] -tools.build:cxx_flags=["-stdlib=libc++"] +tools.build:cxxflags=["-stdlib=libc++"] tools.build:compiler_executables={ 'c' : 'clang', 'cpp' : 'clang++' } From 98441041cf7b80041c21611f9c949b97ec75f90d Mon Sep 17 00:00:00 2001 From: rturrado <68099809+rturrado@users.noreply.github.com> Date: Thu, 14 Dec 2023 16:04:48 +0100 Subject: [PATCH 29/33] Trying to fix clang-linux-x64 jobs. Setting 'libqasm/*:asan_enabled=False' for clang. --- conan/profiles/tests-release-clang-linux-x64 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/conan/profiles/tests-release-clang-linux-x64 b/conan/profiles/tests-release-clang-linux-x64 index 3f39a2ca..75ec07a4 100644 --- a/conan/profiles/tests-release-clang-linux-x64 +++ b/conan/profiles/tests-release-clang-linux-x64 @@ -4,6 +4,9 @@ include(tests-release) compiler=clang compiler.version=14 +[options] +libqasm/*:asan_enabled=False + [conf] tools.build:cxxflags=["-stdlib=libc++"] tools.build:compiler_executables={ 'c' : 'clang', 'cpp' : 'clang++' } From fe7cff1e4fac698a0a5a90ec8a01cdb94648f17a Mon Sep 17 00:00:00 2001 From: rturrado <68099809+rturrado@users.noreply.github.com> Date: Thu, 14 Dec 2023 16:12:38 +0100 Subject: [PATCH 30/33] Enabled all GitHub jobs. Updated tests-debug-clang-linux-x64 conan profile. --- .github/workflows/test.yml | 366 ++++++++++----------- conan/profiles/tests-debug-clang-linux-x64 | 7 + 2 files changed, 190 insertions(+), 183 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a2e67a86..63529f9c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -28,186 +28,186 @@ jobs: conan_profile: tests-${{ matrix.build_type }}-${{ matrix.compiler }}-linux-x64 shell: bash -# cpp-macos-x64: -# name: "C++ tests (clang/MacOS/x64)" -# runs-on: macos-latest -# strategy: -# fail-fast: false -# matrix: -# build_type: -# - Debug -# - Release -# steps: -# - name: Checkout -# uses: actions/checkout@v4 -# - uses: ./.github/actions/cpp-tests -# with: -# build_type: ${{ matrix.build_type }} -# conan_profile: tests-${{ matrix.build_type }}-macos-x64 -# shell: bash -# -# cpp-windows-x64: -# name: "C++ tests (msvc/Windows/x64)" -# runs-on: windows-latest -# strategy: -# fail-fast: false -# matrix: -# build_type: -# - Debug -# - Release -# steps: -# - name: Checkout -# uses: actions/checkout@v4 -# - uses: ./.github/actions/cpp-tests -# with: -# build_type: ${{ matrix.build_type }} -# conan_profile: tests-${{ matrix.build_type }}-windows-x64 -# shell: bash -# -# cpp-linux-arm64: -# name: "C++ tests (gcc/Linux/ARM64)" -# runs-on: [self-hosted, ARM64, Linux] -# container: python:3.11 -# strategy: -# fail-fast: false -# matrix: -# build_type: -# - Debug -# - Release -# steps: -# - name: Checkout -# uses: actions/checkout@v4 -# - name: Add Python symlink -# run: ln -sf /usr/local/bin/python3.11 /usr/bin/python3 -# shell: bash -# # We are having problems when using the m4 and zulu-opendjk Conan packages on an armv8 architecture -# # m4 is required by flex/bison and zulu-openjdk provides the Java JRE required by the ANTLR generator -# # So, for the time being, we are installing flex/bison and java manually for this platform -# - name: Install bison, flex and java -# run: | -# apt-get update -# apt-get install -y bison flex default-jre -# - uses: ./.github/actions/cpp-tests -# with: -# build_type: ${{ matrix.build_type }} -# conan_profile: tests-${{ matrix.build_type }}-linux-arm64 -# shell: bash -# -# cpp-macos-arm64: -# name: "C++ tests (clang/macos/ARM64)" -# runs-on: [self-hosted, ARM64, macOS] -# strategy: -# fail-fast: false -# matrix: -# build_type: -# - Debug -# - Release -# steps: -# - name: Checkout -# uses: actions/checkout@v4 -# # We are having problems when using the m4 and zulu-opendjk Conan packages on an armv8 architecture -# # m4 is required by flex/bison and zulu-openjdk provides the Java JRE required by the ANTLR generator -# # So, for the time being, we are installing flex/bison and java manually for this platform -# - name: Install bison, flex and java -# run: | -# brew install bison flex java -# echo "$(brew --prefix bison)/bin" >> $GITHUB_PATH -# echo "$(brew --prefix flex)/bin" >> $GITHUB_PATH -# echo "$(brew --prefix java)/bin" >> $GITHUB_PATH -# shell: bash -# - uses: ./.github/actions/cpp-tests -# with: -# build_type: ${{ matrix.build_type }} -# conan_profile: tests-${{ matrix.build_type }}-macos-arm64 -# shell: bash -# -# python-linux-x64: -# name: "Python tests (Linux/x64)" -# runs-on: ubuntu-latest -# steps: -# - name: Checkout -# uses: actions/checkout@v4 -# - name: Install SWIG -# run: | -# sudo apt-get install -y 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 -# -# python-macos-x64: -# name: "Python tests (macOS/x64)" -# runs-on: macos-latest -# steps: -# - name: Checkout -# uses: actions/checkout@v4 -# - 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 -# -# python-windows-x64: -# name: "Python tests (Windows/x64)" -# runs-on: windows-latest -# 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 -# -# docker: -# name: Docker -# runs-on: ubuntu-latest -# steps: -# - name: Set up QEMU -# uses: docker/setup-qemu-action@v2 -# - name: Set up Docker Buildx -# uses: docker/setup-buildx-action@v2 -# - name: Build without pushing -# uses: docker/build-push-action@v4 -# with: -# push: false -# tags: libqasm:latest -# -# complete: -# # see https://github.community/t/status-check-for-a-matrix-jobs/127354/7 -# name: Report status -# needs: -# - cpp-linux-x64 -# - cpp-macos-x64 -# - cpp-windows-x64 -# - cpp-linux-arm64 -# - cpp-macos-arm64 -# - python-linux-x64 -# - python-macos-x64 -# - python-windows-x64 -# - docker -# if: ${{ always() }} -# runs-on: ubuntu-latest -# steps: -# - name: Check all job status -# # see https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#needs-context -# # see https://stackoverflow.com/a/67532120/4907315 -# if: >- -# ${{ -# contains(needs.*.result, 'failure') -# || contains(needs.*.result, 'cancelled') -# || contains(needs.*.result, 'skipped') -# }} -# run: exit 1 + cpp-macos-x64: + name: "C++ tests (clang/MacOS/x64)" + runs-on: macos-latest + strategy: + fail-fast: false + matrix: + build_type: + - Debug + - Release + steps: + - name: Checkout + uses: actions/checkout@v4 + - uses: ./.github/actions/cpp-tests + with: + build_type: ${{ matrix.build_type }} + conan_profile: tests-${{ matrix.build_type }}-macos-x64 + shell: bash + + cpp-windows-x64: + name: "C++ tests (msvc/Windows/x64)" + runs-on: windows-latest + strategy: + fail-fast: false + matrix: + build_type: + - Debug + - Release + steps: + - name: Checkout + uses: actions/checkout@v4 + - uses: ./.github/actions/cpp-tests + with: + build_type: ${{ matrix.build_type }} + conan_profile: tests-${{ matrix.build_type }}-windows-x64 + shell: bash + + cpp-linux-arm64: + name: "C++ tests (gcc/Linux/ARM64)" + runs-on: [self-hosted, ARM64, Linux] + container: python:3.11 + strategy: + fail-fast: false + matrix: + build_type: + - Debug + - Release + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Add Python symlink + run: ln -sf /usr/local/bin/python3.11 /usr/bin/python3 + shell: bash + # We are having problems when using the m4 and zulu-opendjk Conan packages on an armv8 architecture + # m4 is required by flex/bison and zulu-openjdk provides the Java JRE required by the ANTLR generator + # So, for the time being, we are installing flex/bison and java manually for this platform + - name: Install bison, flex and java + run: | + apt-get update + apt-get install -y bison flex default-jre + - uses: ./.github/actions/cpp-tests + with: + build_type: ${{ matrix.build_type }} + conan_profile: tests-${{ matrix.build_type }}-linux-arm64 + shell: bash + + cpp-macos-arm64: + name: "C++ tests (clang/macos/ARM64)" + runs-on: [self-hosted, ARM64, macOS] + strategy: + fail-fast: false + matrix: + build_type: + - Debug + - Release + steps: + - name: Checkout + uses: actions/checkout@v4 + # We are having problems when using the m4 and zulu-opendjk Conan packages on an armv8 architecture + # m4 is required by flex/bison and zulu-openjdk provides the Java JRE required by the ANTLR generator + # So, for the time being, we are installing flex/bison and java manually for this platform + - name: Install bison, flex and java + run: | + brew install bison flex java + echo "$(brew --prefix bison)/bin" >> $GITHUB_PATH + echo "$(brew --prefix flex)/bin" >> $GITHUB_PATH + echo "$(brew --prefix java)/bin" >> $GITHUB_PATH + shell: bash + - uses: ./.github/actions/cpp-tests + with: + build_type: ${{ matrix.build_type }} + conan_profile: tests-${{ matrix.build_type }}-macos-arm64 + shell: bash + + python-linux-x64: + name: "Python tests (Linux/x64)" + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Install SWIG + run: | + sudo apt-get install -y 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 + + python-macos-x64: + name: "Python tests (macOS/x64)" + runs-on: macos-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - 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 + + python-windows-x64: + name: "Python tests (Windows/x64)" + runs-on: windows-latest + 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 + + docker: + name: Docker + runs-on: ubuntu-latest + steps: + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - name: Build without pushing + uses: docker/build-push-action@v4 + with: + push: false + tags: libqasm:latest + + complete: + # see https://github.community/t/status-check-for-a-matrix-jobs/127354/7 + name: Report status + needs: + - cpp-linux-x64 + - cpp-macos-x64 + - cpp-windows-x64 + - cpp-linux-arm64 + - cpp-macos-arm64 + - python-linux-x64 + - python-macos-x64 + - python-windows-x64 + - docker + if: ${{ always() }} + runs-on: ubuntu-latest + steps: + - name: Check all job status + # see https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#needs-context + # see https://stackoverflow.com/a/67532120/4907315 + if: >- + ${{ + contains(needs.*.result, 'failure') + || contains(needs.*.result, 'cancelled') + || contains(needs.*.result, 'skipped') + }} + run: exit 1 diff --git a/conan/profiles/tests-debug-clang-linux-x64 b/conan/profiles/tests-debug-clang-linux-x64 index cb2b3617..783e7e94 100644 --- a/conan/profiles/tests-debug-clang-linux-x64 +++ b/conan/profiles/tests-debug-clang-linux-x64 @@ -3,3 +3,10 @@ include(tests-debug) [settings] compiler=clang compiler.version=14 + +[options] +libqasm/*:asan_enabled=False + +[conf] +tools.build:cxxflags=["-stdlib=libc++"] +tools.build:compiler_executables={ 'c' : 'clang', 'cpp' : 'clang++' } From 3502d99d6596d910c0a4027b4b5783a2e01ab38c Mon Sep 17 00:00:00 2001 From: rturrado <68099809+rturrado@users.noreply.github.com> Date: Thu, 14 Dec 2023 16:22:35 +0100 Subject: [PATCH 31/33] Enabled all GitHub cpp-linux-x64 jobs. --- .github/workflows/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 63529f9c..9ebadf0c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,11 +14,11 @@ jobs: fail-fast: false matrix: build_type: -# - Debug + - Debug - Release compiler: - clang -# - gcc + - gcc steps: - name: Checkout uses: actions/checkout@v4 From 67582330c7e28f8537147f0962c7438843169302 Mon Sep 17 00:00:00 2001 From: rturrado <68099809+rturrado@users.noreply.github.com> Date: Thu, 14 Dec 2023 16:50:06 +0100 Subject: [PATCH 32/33] Changed on/push/branches back to develop. --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9ebadf0c..b3915b10 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -3,7 +3,7 @@ name: Test on: push: branches: - - olafs_git_hub_pipeline + - develop pull_request: jobs: From b3dc9106a420b42b3f20ce4e91a5cea5bef2b210 Mon Sep 17 00:00:00 2001 From: rturrado <68099809+rturrado@users.noreply.github.com> Date: Fri, 15 Dec 2023 12:23:00 +0100 Subject: [PATCH 33/33] Update to use the latest commit ID from tree-gen/master. --- src/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 789adec7..f0dfbb98 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -67,7 +67,7 @@ endif() # This exposes the generate_tree() function. FetchContent_Declare(tree-gen GIT_REPOSITORY https://github.com/QuTech-Delft/tree-gen.git - GIT_TAG "a93479783bdf51836e4ac1bd9b2f445a5f39c873" + GIT_TAG "2ae96a563bb2346207450bf8865e65058f248ee7" ) FetchContent_MakeAvailable(tree-gen)