Skip to content

v3 MVP

v3 MVP #394

Workflow file for this run

name: Test
on:
push:
branches:
- develop
pull_request:
jobs:
cpp-linux-macos-windows:
name: 'C++ tests (Linux-MacOS-Windows/x64)'
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 }}
steps:
- name: Install Python
uses: actions/setup-python@v4
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
- 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
cpp-arm64:
name: 'C++ tests (gcc/Linux/ARM64, clang/MacOS/ARM64)'
runs-on: [self-hosted, ARM64, "${{ matrix.os }}"]
strategy:
fail-fast: false
matrix:
os:
- Linux
- macOS
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
shell: bash
- if: matrix.os == 'macOS'
# 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)
run: |
brew install bison flex gcc java python
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
python:
name: Python
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-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 numpy pytest setuptools wheel
- name: Install SWIG, and set build type (Linux)
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get install -y swig
echo "LIBQASM_BUILD_TYPE=Debug" >> $GITHUB_ENV
- name: Install SWIG, and set build type (MacOS)
if: matrix.os == 'macos-latest'
run: |
brew install swig
echo "LIBQASM_BUILD_TYPE=Debug" >> $GITHUB_ENV
- name: Set build type (Windows)
if: matrix.os == 'windows-latest'
shell: powershell
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
conda:
name: Conda
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up conda
uses: conda-incubator/setup-miniconda@v2
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 -y
- name: Build & test
run: conda build python/conda
- name: Install
run: conda install libqasm --use-local
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