-
Notifications
You must be signed in to change notification settings - Fork 0
145 lines (136 loc) · 5.13 KB
/
ci_test.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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
name: Python package CI/CD
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
release:
types: [published]
jobs:
tests:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.9', '3.10', '3.11', '3.12']
steps:
- name: Checkout repository
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
run: |
python -m pip install --upgrade pip setuptools wheel cython
#pip install "scipy>=1.11.3" --only-binary=scipy
pip install "numpy>=1.16.3" --only-binary=numpy "scipy>=1.11.3" --only-binary=scipy
pip install black pytest pytest-cov
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
shell: bash
- name: Build Cython extensions
run: python setup.py build_ext --inplace
- name: Lint with black
run: |
black . --check
- name: Install package in editable mode
run: pip install -e .
shell: bash
- name: Run tests with pytest
run: |
# Add your testing command/script here
pytest --cov=fastshermanmorrison --cov-report xml:coverage.xml tests/
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
flags: unittests
name: codecov-umbrella
fail_ci_if_error: true
build:
needs: tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install build dependencies
run: |
python -m pip install --upgrade pip setuptools wheel cython cibuildwheel==2.3.1
- name: Install project dependencies
run: |
pip install "numpy>=1.16.3" --only-binary=numpy "scipy>=1.2.0" --only-binary=scipy
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Build wheels using cibuildwheel
run: cibuildwheel --output-dir dist
env:
# If you need to build on a specific platform like macOS, set the CIBW_PLATFORM environment variable
# CIBW_PLATFORM: "macos"
#CIBW_BEFORE_BUILD: "pip install scipy>=1.11.3 --only-binary=scipy"
CIBW_BEFORE_BUILD: "pip install numpy>=1.16.3 --only-binary=numpy scipy>=1.2.0 --only-binary=scipy"
CIBW_BUILD_VERBOSITY: 1
#CIBW_SKIP: "pp* cp27-* cp35-* cp36-* cp37-* cp38-*"
CIBW_SKIP: "pp* cp27-* cp35-* cp36-* cp37-* cp38-* *-win32 *-manylinux_i686 *-musllinux_i686 *-macosx_10_6_intel *-macosx_10_9_intel *-macosx_10_10_intel *-macosx_10_11_intel *-macosx_10_12_intel *-macosx_10_13_intel *-macosx_10_14_intel *-macosx_10_15_intel"
CIBW_ARCHS: "x86_64"
CIBW_ARCHS_MACOS: "x86_64 arm64"
CIBW_MANYLINUX_X86_64_IMAGE: "manylinux2014"
- name: Build source distribution
run: python setup.py sdist
- uses: actions/upload-artifact@v4
with:
name: dist
path: |
./dist/*.whl
./dist/*.tar.gz
deploy:
needs: build
runs-on: ubuntu-latest
if: github.event_name == 'release' #&& github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Download built distributions
uses: actions/download-artifact@v4
with:
name: dist
path: ./
- name: List files in dist
run: echo "Content of dist:" && ls -lah dist/ && echo "Content of ./:" && ls -lah ./
- name: Publish to PyPI
run: |
python -m pip install --upgrade twine
#twine upload dist/*
#twine upload --repository-url https://test.pypi.org/legacy dist/*
python -m twine upload ./dist/*
env:
#TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
#TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_API_TOKEN }}
TWINE_REPOSITORY_URL: https://test.pypi.org/legacy/
# conda-package:
# runs-on: ubuntu-latest
# strategy:
# matrix:
# python-version: ['3.9', '3.10', '3.11', '3.12']
# steps:
# - uses: actions/checkout@v2
# - name: Set up conda for Python ${{ matrix.python-version }}
# uses: conda-incubator/setup-miniconda@v2
# with:
# auto-update-conda: true
# python-version: ${{ matrix.python-version }}
# - name: Build conda package
# run: conda build .
# - name: Upload conda package
# env:
# ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_API_TOKEN }}
# USER_NAME: ${{ env.GITHUB_REPOSITORY_OWNER }}
# run: anaconda upload --user $USER_NAME $(conda build . --output)