-
Notifications
You must be signed in to change notification settings - Fork 0
164 lines (139 loc) · 4.11 KB
/
Copy pathci.yaml
File metadata and controls
164 lines (139 loc) · 4.11 KB
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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
name: numflow.py CI
on:
push:
branches: [release, main]
pull_request:
branches: [main]
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: "recursive"
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest pytest-cov
- name: Build numflow.py package
run: |
pip install .
pip install numpy
- name: Test with pytest
run: |
pytest ./tests/* --cov=numflow
- name: Upload to Coveralls
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_TOKEN }}
run: |
pip install coveralls
coveralls
make-wheels:
name: Make ${{ matrix.os }} wheels
if: github.event_name == 'push' && contains(github.ref, 'release')
needs: test
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ["macos-latest", "ubuntu-latest", "windows-latest"]
steps:
- name: "Checkout repo"
uses: actions/checkout@v4
with:
submodules: "recursive"
- name: "Build wheels"
uses: pypa/cibuildwheel@v2.9.0
- name: Verify clean directory
run: git diff --exit-code
shell: bash
- name: "Upload wheel as artifact"
uses: actions/upload-artifact@v4
with:
name: artifact-${{ matrix.os }}-wheel
path: ./wheelhouse/*.whl
make-sdist:
name: Make source distribution
if: github.event_name == 'push' && contains(github.ref, 'release')
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: "recursive"
- name: Build SDist
run: pipx run build --sdist
- name: Check metadata
run: pipx run twine check dist/*
- uses: actions/upload-artifact@v4
with:
name: artifact-source-dist
path: dist/*.tar.gz
tag-and-release:
name: Tag commit and create a release
needs: [make-wheels, make-sdist]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: "recursive"
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install scikit-build
- name: "Get release version"
run: |
CURRENT_VERSION=$(python3 setup.py --version | tail -1)
echo "Current version: $CURRENT_VERSION"
echo "CURRENT_VERSION=v$CURRENT_VERSION" >> $GITHUB_ENV
- uses: rickstaa/action-create-tag@v1
with:
tag: ${{ env.CURRENT_VERSION }}
- uses: ncipollo/release-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
generateReleaseNotes: true
tag: ${{ env.CURRENT_VERSION }}
upload:
name: Upload to PyPI
needs: tag-and-release
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/numflow
permissions:
id-token: write
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: dist
- name: Copy artifacts to dist/ folder
run: |
echo "* Downloaded artifacts:"
ls dist/
cd dist/
echo "* Copying artifacts to dist/ folder:"
find . -mindepth 2 -maxdepth 2 -type f -print -exec mv {} . \;
echo "* Deleting empty directories:"
find . -maxdepth 1 -type d -empty -print -exec rmdir {} +
cd ..
echo "* Prepared artifacts:"
ls dist/
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}