Skip to content

Bump astral-sh/ruff-action from 2 to 3 #774

Bump astral-sh/ruff-action from 2 to 3

Bump astral-sh/ruff-action from 2 to 3 #774

Workflow file for this run

# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: build and test
on:
push:
branches:
- main
# Release branches
- "[0-9]+.[0-9]+.x"
- test_gh_actions
permissions:
contents: read
jobs:
build_push:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
gurobi-version: ["gurobi10", "gurobi11","gurobi12"]
exclude:
- python-version: "3.12"
gurobi-version: "gurobi10"
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest tox tox-gh-actions
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- shell: bash
id: write-license
env:
LICENSE: ${{ secrets.LICENSE }}
run: |
echo "$LICENSE" > $PWD/gurobi.lic
echo "grb_license_file=$PWD/gurobi.lic" >> $GITHUB_OUTPUT
- name: Test with tox
env:
GRB_LICENSE_FILE: ${{ steps.write-license.outputs.grb_license_file }}
GUROBI_VERSION: ${{matrix.gurobi-version}}
run: |
tox
- name: Run examples with Gurobi 11
if: ${{ (matrix.gurobi-version != 'gurobi10') && (matrix.python-version == '3.12') }}
env:
GRB_LICENSE_FILE: ${{ steps.write-license.outputs.grb_license_file }}
GUROBI_VERSION: ${{ matrix.gurobi-version }}
run: |
python_version_no_dot=$(echo "${{ matrix.python-version }}" | tr -d '.')
tox -e py${python_version_no_dot}-examples-${{matrix.gurobi-version}}