name: stable api

on:
  push:
    branches:
      - master
  pull_request:
    branches:
      - master
jobs:
  build:
    runs-on: ubuntu-22.04
    strategy:
      matrix:
        python-version: ["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
        python -m pip install --upgrade setuptools
        pip install scipy-openblas64
        pip install pytest-xdist
        sudo apt install ${{ matrix.cpp-version }}
        sudo apt install libopenblas-dev  # for meson integration testing
    - name: Setup
      run: |
        python -m pip install .
        python -m pip install . 'pythran[build]'
        python -m pip install . 'pythran[test]'
        pip install -U numpy scipy
        printf '[compiler]\nblas=scipy-openblas\n' > ~/.config/.pythranrc
        printf 'cflags=-std=c++14 -Wall -Werror -Wno-unknown-pragmas -Wno-unused-local-typedefs -Wno-cpp -Wno-deprecated-declarations -D_GLIBCXX_DEBUG -DPy_LIMITED_API=0x03080000\n' >> ~/.config/.pythranrc
    - name: Testing minimal CLI
      run: |
        pythran --version
        pythran --help
        pythran-config -vvv
    - name: Testing sequential
      run: |
        export CC=`echo ${{ matrix.cpp-version }} | sed -e 's/g++/gcc/'`
        pytest pythran/tests/test_*.py -v -x --numprocesses=auto $PYTEST_ARGS
