Skip to content

Env instructions

Env instructions #230

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: Python application
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
permissions:
contents: read
jobs:
build:
name: Build and test
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
os:
- ubuntu-latest
- macos-latest
- windows-latest
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v3
- name: Set up conda
uses: conda-incubator/setup-miniconda@v2
with:
miniforge-variant: Mambaforge # mamba is faster than base conda
miniforge-version: latest
activate-environment: osier-env
use-mamba: true
use-only-tar-bz2: true
- run: |
conda config --env --set pip_interop_enabled True
- name: Install dependencies
run: |
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Install flake8
run: |
python -m pip install flake8
- name: Install CBC
if: matrix.os != 'windows-latest'
run: |
mamba install coin-or-cbc coincbc
- name: install CBC (Windows)
if: matrix.os == 'windows-latest'
run: |
curl -L https://github.com/coin-or/Cbc/releases/download/releases%2F2.10.10/Cbc-releases.2.10.10-w64-msvc17-md.zip -o cbc.zip
unzip cbc.zip -d ${HOME}/cbc
echo "${HOME}/cbc/bin" >> $GITHUB_PATH
- name: Install osier package (macos)
if: matrix.os == 'macos-latest'
run: |
pip install -e .'[doc]'
- name: Install osier package
if: matrix.os != 'macos-latest'
run: |
pip install -e .[doc]
- name: Test with pytest
run: |
pytest tests/
- 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