Skip to content

Commit

Permalink
Fix pythonapp
Browse files Browse the repository at this point in the history
  • Loading branch information
jinningwang committed Nov 6, 2024
1 parent aa796b3 commit d60e15c
Showing 1 changed file with 31 additions and 29 deletions.
60 changes: 31 additions & 29 deletions .github/workflows/pythonapp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,42 +3,40 @@ name: Python application
on: [push, pull_request]

jobs:
lint:
pretest:
name: AMS Pretest

runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.11] # Only run flake8 on Python 3.11

if: ${{ github.ref != 'refs/heads/misc' }}

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
- uses: conda-incubator/setup-miniconda@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
python-version: 3.11
mamba-version: "*"
miniforge-version: "latest"
channels: conda-forge,defaults
channel-priority: true
activate-environment: anaconda-client-env
- shell: bash -el {0}
name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8
- name: Lint with flake8
mamba install -y nbmake pytest-xdist line_profiler # add'l packages for notebook tests.
mamba install --file requirements.txt --file requirements-extra.txt
python -m pip install pyscipopt
python -m pip install -e .
- shell: bash -el {0}
name: Run pip check
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 .
test-notebooks:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.11] # Only test notebooks on Python 3.11
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
pip check || true # Allow pip check to fail without failing the job
- shell: bash -el {0}
name: Test with pytest
run: |
python -m pip install --upgrade pip
pip install nbmake
- name: Test notebooks
pytest
- shell: bash -el {0}
name: Test notebooks.
run: |
pytest --nbmake examples --ignore=examples/verification
Expand Down Expand Up @@ -78,6 +76,10 @@ jobs:
name: Test with pytest
run: |
pytest
- shell: bash -el {0}
name: Test notebooks.
run: |
pytest --nbmake examples --ignore=examples/verification
- name: Build a distribution if tagged
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') && matrix.os == 'ubuntu-latest' && matrix.python-version == '3.9'
run: |
Expand Down

0 comments on commit d60e15c

Please sign in to comment.