name: icc

on:
  push:
    branches:
      - master
  pull_request:
    branches:
      - master
jobs:
  build:
    runs-on: ubuntu-22.04
    strategy:
      matrix:
        python-version: ['3.10']
        cpp-version: [icpc]
    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 pytest-xdist
        if test ${{ matrix.python-version }} != '3.10' ; then pip install scipy ; fi
        wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | gpg --dearmor | sudo tee /usr/share/keyrings/oneapi-archive-keyring.gpg
        echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list
        sudo apt update
        sudo apt install intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic
        sudo apt install libopenblas-dev
    - name: Setup
      run: |
        python -m pip install .
        python -m pip install . 'pythran[test]'
        printf '[compiler]\nblas=openblas\n' > ~/.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++/icx/'`
        export CXX=`echo ${{ matrix.cpp-version }} | sed -e 's/clang/icx/'`
        source /opt/intel/oneapi/setvars.sh
        pytest pythran/tests/test_base.py pythran/tests/test_scipy.py pythran/tests/test_icc.py -v -x --numprocesses=auto $PYTEST_ARGS
