xref: /libCEED/.github/workflows/python-test-with-style.yml (revision ed1ebff7abaa668c9b274382abc627b7a8754a20)
1dfb8ed23Sjeremyltname: Python
23446d1b5SJeremy L Thompson
33446d1b5SJeremy L Thompsonon:
43446d1b5SJeremy L Thompson  push:
5dcd9f19cSJeremy L Thompson    branches:
6dcd9f19cSJeremy L Thompson      - main
7dcd9f19cSJeremy L Thompson  pull_request:
83446d1b5SJeremy L Thompson
93446d1b5SJeremy L Thompsonjobs:
103446d1b5SJeremy L Thompson  test:
113446d1b5SJeremy L Thompson    strategy:
123446d1b5SJeremy L Thompson      matrix:
13d83cf49fSJeremy L Thompson        os: [ubuntu-24.04]
14*ed1ebff7SJeremy L Thompson        compiler: [gcc]
1542e6192fSJeremy L Thompson        python-version: ['3.x']
163446d1b5SJeremy L Thompson
173446d1b5SJeremy L Thompson    runs-on: ${{ matrix.os }}
183446d1b5SJeremy L Thompson
193446d1b5SJeremy L Thompson    steps:
203446d1b5SJeremy L Thompson    - name: Environment setup
21e735508cSJeremy L Thompson      uses: actions/checkout@v4
223446d1b5SJeremy L Thompson    - name: Python setup
23e735508cSJeremy L Thompson      uses: actions/setup-python@v5
2442e6192fSJeremy L Thompson      with:
2542e6192fSJeremy L Thompson        python-version: ${{ matrix.python-version }}
263446d1b5SJeremy L Thompson    - name: Python dependencies
273446d1b5SJeremy L Thompson      run: |
283446d1b5SJeremy L Thompson        pip install -r requirements.txt
293446d1b5SJeremy L Thompson        pip install -r requirements-test.txt
303446d1b5SJeremy L Thompson    - name: Python test
313446d1b5SJeremy L Thompson      env:
323446d1b5SJeremy L Thompson        CC: ${{ matrix.compiler }}
33*ed1ebff7SJeremy L Thompson        FC: gfortran
343446d1b5SJeremy L Thompson      run: |
353446d1b5SJeremy L Thompson        make info
363446d1b5SJeremy L Thompson        make -j2
373446d1b5SJeremy L Thompson        export CEED_DIR=$PWD
383446d1b5SJeremy L Thompson        pip install .
390ef72598Sjeremylt        cd python/tests
40619db83cSjeremylt        PYTHON=python3 make test TEST_OPTS="--ceed /cpu/self/ref/serial -vv"
413446d1b5SJeremy L Thompson        cd ../..
423446d1b5SJeremy L Thompson    - name: Python style
433446d1b5SJeremy L Thompson      env:
443446d1b5SJeremy L Thompson        CC: ${{ matrix.compiler }}
45*ed1ebff7SJeremy L Thompson        FC: gfortran
463446d1b5SJeremy L Thompson      run: |
472b730f8bSJeremy L Thompson        make format-py && git diff --exit-code
48e6aaec06SJeremy L Thompson    - name: Python version
49e6aaec06SJeremy L Thompson      env:
50e6aaec06SJeremy L Thompson        CC: ${{ matrix.compiler }}
51*ed1ebff7SJeremy L Thompson        FC: gfortran
52e6aaec06SJeremy L Thompson      run: |
53e6aaec06SJeremy L Thompson        make vermin
54