1name: Pip
2
3on:
4  workflow_dispatch:
5  pull_request:
6  push:
7    branches:
8    - master
9    - stable
10    - v*
11  release:
12    types:
13    - published
14
15jobs:
16  # This builds the sdists and wheels and makes sure the files are exactly as
17  # expected. Using Windows and Python 2.7, since that is often the most
18  # challenging matrix element.
19  test-packaging:
20    name: �� 2.7 • �� tests • windows-latest
21    runs-on: windows-latest
22
23    steps:
24    - uses: actions/checkout@v2
25
26    - name: Setup �� 2.7
27      uses: actions/setup-python@v2
28      with:
29        python-version: 2.7
30
31    - name: Prepare env
32      run: python -m pip install -r tests/requirements.txt --prefer-binary
33
34    - name: Python Packaging tests
35      run: pytest tests/extra_python_package/
36
37
38  # This runs the packaging tests and also builds and saves the packages as
39  # artifacts.
40  packaging:
41    name: �� 3.8 • �� & �� tests • ubuntu-latest
42    runs-on: ubuntu-latest
43
44    steps:
45    - uses: actions/checkout@v2
46
47    - name: Setup �� 3.8
48      uses: actions/setup-python@v2
49      with:
50        python-version: 3.8
51
52    - name: Prepare env
53      run: python -m pip install -r tests/requirements.txt build twine --prefer-binary
54
55    - name: Python Packaging tests
56      run: pytest tests/extra_python_package/
57
58    - name: Build SDist and wheels
59      run: |
60        python -m build
61        PYBIND11_GLOBAL_SDIST=1 python -m build
62
63    - name: Check metadata
64      run: twine check dist/*
65
66    - name: Save standard package
67      uses: actions/upload-artifact@v2
68      with:
69        name: standard
70        path: dist/pybind11-*
71
72    - name: Save global package
73      uses: actions/upload-artifact@v2
74      with:
75        name: global
76        path: dist/pybind11_global-*
77
78
79
80  # When a GitHub release is made, upload the artifacts to PyPI
81  upload:
82    name: Upload to PyPI
83    runs-on: ubuntu-latest
84    if: github.event_name == 'release' && github.event.action == 'published'
85    needs: [packaging]
86
87    steps:
88    - uses: actions/setup-python@v2
89
90    # Downloads all to directories matching the artifact names
91    - uses: actions/download-artifact@v2
92
93    - name: Publish standard package
94      uses: pypa/gh-action-pypi-publish@v1.4.1
95      with:
96        password: ${{ secrets.pypi_password }}
97        packages_dir: standard/
98
99    - name: Publish global package
100      uses: pypa/gh-action-pypi-publish@v1.4.1
101      with:
102        password: ${{ secrets.pypi_password_global }}
103        packages_dir: global/
104