-
Notifications
You must be signed in to change notification settings - Fork 7
83 lines (75 loc) · 2.41 KB
/
CI.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# 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