-
Notifications
You must be signed in to change notification settings - Fork 2
105 lines (94 loc) · 2.85 KB
/
ci.yaml
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
name: CI
on:
push:
tags: ["*"]
branches:
- master
- main
pull_request:
branches:
- master
- main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run pre-commit linting
run: pipx run pre-commit run --all-files
check-manifest:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# this test ensures that the sdist contains all necessary files
# if it fails, you need to either update MANIFEST.in,
# or add an explicit "ignore" rule to pyproject.toml
- name: Run check-manifest
run: pipx run check-manifest
test:
runs-on: ${{ matrix.platform }}
defaults:
run:
shell: bash -el {0} # needed when using setup-miniconda
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
platform: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v2
with:
python-version: ${{ matrix.python-version }}
miniforge-version: latest
use-mamba: true
channels: conda-forge,gurobi,defaults
channel-priority: true
- name: install build deps
run: mamba install scip gurobi
- name: add gurobi license
shell: bash
id: write-license
env:
LICENSE: ${{ secrets.GRB_LICENSE_FILE }}
run: |
echo "$LICENSE" > $PWD/gurobi.lic
echo "grb_license_file=$PWD/gurobi.lic" >> $GITHUB_OUTPUT
- name: install package
run: |
python -m pip install -U pip
python -m pip install -e .[dev]
env:
CYTHON_TRACE: 1 # enable coverage of cython code
- name: run tests
run: pytest --color yes -v --cov ilpy --cov-report=xml
env:
GRB_LICENSE_FILE: ${{ steps.write-license.outputs.grb_license_file }}
- name: upload coverage
uses: codecov/codecov-action@v3
# we only deploy the sdist to PyPI, the wheel is still complicated
deploy-sdist:
if: startsWith(github.ref, 'refs/tags')
needs: [test, check-manifest]
name: Build sdist, Publish to PyPI on tagged versions
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Build an sdist
run: |
python -m pip install build
python -m build --sdist
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
- uses: softprops/action-gh-release@v1
with:
generate_release_notes: true