File tree Expand file tree Collapse file tree 2 files changed +81
-0
lines changed Expand file tree Collapse file tree 2 files changed +81
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : Publish to Pypi
2
+ on :
3
+ workflow_dispatch :
4
+ inputs :
5
+ version :
6
+ description : ' Version upload to pypi'
7
+ required : true
8
+ pypi_repo :
9
+ description : ' Repo to upload to (testpypi or pypi)'
10
+ default : ' testpypi'
11
+ required : true
12
+
13
+ jobs :
14
+ publish :
15
+ runs-on : ubuntu-latest
16
+ steps :
17
+ - uses : actions/checkout@v2
18
+ - uses : actions/setup-python@v2
19
+ with :
20
+ python-version : ' 3.8'
21
+ - name : Install dependencies
22
+ run : |
23
+ pip install -U wheelhouse_uploader pyyaml
24
+ - name : Downloading wheels and sdist from staging
25
+ env :
26
+ SKLEARN_VERSION : ${{ github.event.inputs.version }}
27
+ run : |
28
+ echo "Download $SKLEARN_VERSION wheels and sdist"
29
+ python -m wheelhouse_uploader fetch \
30
+ --version $SKLEARN_VERSION \
31
+ --local-folder dist/ \
32
+ scikit-learn \
33
+ https://pypi.anaconda.org/scikit-learn-wheels-staging/simple/scikit-learn/
34
+ - name : Check dist has the correct number of artifacts
35
+ run : |
36
+ python build_tools/github/check_wheels.py
37
+ - name : Publish package to TestPyPI
38
+ uses : pypa/gh-action-pypi-publish@v1.4.1
39
+ with :
40
+ user : __token__
41
+ password : ${{ secrets.TEST_PYPI_TOKEN }}
42
+ repository_url : https://test.pypi.org/legacy/
43
+ if : ${{ github.event.inputs.pypi_repo }} == 'testpypi'
44
+ - name : Publish package to PyPI
45
+ uses : pypa/gh-action-pypi-publish@v1.4.1
46
+ with :
47
+ user : __token__
48
+ password : ${{ secrets.PYPI_TOKEN }}
49
+ if : ${{ github.event.inputs.pypi_repo }} == 'pypi'
Original file line number Diff line number Diff line change
1
+ """Checks that dist/* contains the number of wheels built from the
2
+ .github/workflows/wheels.yml config."""
3
+ import yaml
4
+ from pathlib import Path
5
+ import sys
6
+
7
+ gh_wheel_path = Path .cwd () / ".github" / "workflows" / "wheels.yml"
8
+ with gh_wheel_path .open ('r' ) as f :
9
+ wheel_config = yaml .safe_load (f )
10
+
11
+ build_matrix = wheel_config ['jobs' ]['build_wheels' ]['strategy' ]['matrix' ]
12
+ n_python_versions = len (build_matrix ['python' ])
13
+
14
+ # For each python version we have: 5 wheels
15
+ # 1 osx wheel (x86_64)
16
+ # 2 linux wheel (i686 + x86_64)
17
+ # 2 windows wheel (win32 + wind_amd64)
18
+ n_wheels = 5 * n_python_versions
19
+
20
+ # plus one more for the sdist
21
+ n_wheels += 1
22
+
23
+ dist_files = list (Path ("dist" ).glob ('**/*' ))
24
+ n_dist_files = len (dist_files )
25
+
26
+ if n_dist_files != n_wheels :
27
+ print (f"Expected { n_wheels } wheels in dist/* but "
28
+ f"got { n_dist_files } artifacts instead." )
29
+ sys .exit (1 )
30
+
31
+ print (f"dist/* has the expected { n_wheels } wheels:" )
32
+ print ("\n " .join (file .name for file in dist_files ))
You can’t perform that action at this time.
0 commit comments