name: parallel

on:
  push:
    branches:
      - master
  pull_request:
    branches:
      - master
jobs:
  build:
    runs-on: ubuntu-22.04
    strategy:
      matrix:
        python-version: [3.8, '3.10']
        cpp-version: [g++-12]
    steps:
    - uses: actions/checkout@v2
    - name: Setup Python ${{ matrix.python-version }}
      uses: actions/setup-python@v4
      with:
        python-version: ${{ matrix.python-version }}
    - name: Install dependencies
      run: |
        python -m pip install --upgrade pip
        pip install scipy
        pip install pytest-xdist
        sudo apt install libopenblas-dev ${{ matrix.cpp-version }}
    - name: Setup
      run: |
        python -m pip install .
        python -m pip install . 'pythran[test]'
        printf '[compiler]\nblas=openblas\n' > ~/.pythranrc
    - name: Testing vectorized
      run: |
        export CC=`echo ${{ matrix.cpp-version }} | sed -e 's/g++/gcc/'`
        export CXX=`echo ${{ matrix.cpp-version }} | sed -e 's/clang/clang++/'`
        export CXXFLAGS="-DUSE_XSIMD -march=native"
        pytest pythran/tests/test_cases.py -v --numprocesses=auto
    - name: Testing parallel
      run: |
        export CC=`echo ${{ matrix.cpp-version }} | sed -e 's/g++/gcc/'`
        export CXX=`echo ${{ matrix.cpp-version }} | sed -e 's/clang/clang++/'`
        export CXXFLAGS="-fopenmp"
        export LDFLAGS="-fopenmp"
        printf '[compiler]\nldflags=-fopenmp\ncflags=-fopenmp\n' > ~/.pythranrc
        pytest pythran/tests/test_cases.py -v --numprocesses=1
