xref: /libCEED/.github/workflows/python-test-with-style.yml (revision 7b3ff0698626cc2e5ce463afc10290072fd55c90)
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]
14ed1ebff7SJeremy 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 }}
33ed1ebff7SJeremy 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"
41*7b3ff069SJeremy L Thompson        cd ../../examples/python
42*7b3ff069SJeremy L Thompson        PYTHON=python3 make test TEST_OPTS="--ceed /cpu/self/ref/serial -vv"
433446d1b5SJeremy L Thompson        cd ../..
443446d1b5SJeremy L Thompson    - name: Python style
453446d1b5SJeremy L Thompson      env:
463446d1b5SJeremy L Thompson        CC: ${{ matrix.compiler }}
47ed1ebff7SJeremy L Thompson        FC: gfortran
483446d1b5SJeremy L Thompson      run: |
492b730f8bSJeremy L Thompson        make format-py && git diff --exit-code
50e6aaec06SJeremy L Thompson    - name: Python version
51e6aaec06SJeremy L Thompson      env:
52e6aaec06SJeremy L Thompson        CC: ${{ matrix.compiler }}
53ed1ebff7SJeremy L Thompson        FC: gfortran
54e6aaec06SJeremy L Thompson      run: |
55e6aaec06SJeremy L Thompson        make vermin
56