|
1 | | -name: Build Wheels (cbuild-nox) |
| 1 | +name: Build and Publish Wheels |
2 | 2 |
|
3 | | -on: [push, pull_request] |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ main, develop ] |
| 6 | + tags: [ 'v*' ] |
| 7 | + pull_request: |
| 8 | + branches: [ main, develop ] |
4 | 9 |
|
5 | 10 | jobs: |
6 | | - build_wheels: |
| 11 | + build: |
7 | 12 | name: Build wheels on ${{ matrix.os }} |
8 | 13 | runs-on: ${{ matrix.os }} |
9 | 14 | strategy: |
| 15 | + fail-fast: false |
10 | 16 | matrix: |
11 | | - os: [ubuntu-latest, ubuntu-24.04-arm, windows-latest, windows-11-arm, macos-15-intel, macos-latest] |
| 17 | + os: [ubuntu-latest, windows-latest, macos-latest] |
12 | 18 |
|
13 | 19 | steps: |
14 | 20 | - uses: actions/checkout@v5 |
15 | 21 |
|
16 | | - # Used to host cibuildwheel |
17 | | - - uses: actions/setup-python@v5 |
| 22 | + - name: Set up Python |
| 23 | + uses: actions/setup-python@v5 |
18 | 24 | with: |
19 | 25 | python-version: '3.11' |
20 | 26 | cache: 'pip' |
21 | 27 |
|
22 | | - - name: Install cibuildwheel |
23 | | - run: python -m pip install cibuildwheel==3.2.1 |
| 28 | + - name: Install build dependencies |
| 29 | + run: python -m pip install --upgrade pip setuptools wheel build |
24 | 30 |
|
25 | | - - name: Build wheels |
26 | | - run: python -m cibuildwheel --output-dir wheelhouse |
27 | | - env: |
28 | | - # Build for Python 3.8 through 3.12 |
29 | | - CIBW_BUILD: cp38-* cp39-* cp310-* cp311-* cp312-* |
30 | | - # Skip PyPy builds |
31 | | - CIBW_SKIP: pp* |
32 | | - # Test before building (optional) |
33 | | - CIBW_TEST_COMMAND: python -c "import libcrypto; print(f'libcrypto {libcrypto.__version__}')" |
| 31 | + - name: Build wheel and sdist |
| 32 | + run: python -m build |
34 | 33 |
|
35 | | - - uses: actions/upload-artifact@v4 |
| 34 | + - name: List built artifacts |
| 35 | + shell: bash |
| 36 | + run: ls -lh dist/ |
| 37 | + |
| 38 | + - name: Upload artifacts |
| 39 | + uses: actions/upload-artifact@v4 |
| 40 | + with: |
| 41 | + name: wheels-${{ matrix.os }} |
| 42 | + path: dist/ |
| 43 | + retention-days: 7 |
| 44 | + |
| 45 | + test: |
| 46 | + name: Test on Python ${{ matrix.python-version }} |
| 47 | + runs-on: ubuntu-latest |
| 48 | + needs: build |
| 49 | + strategy: |
| 50 | + fail-fast: false |
| 51 | + matrix: |
| 52 | + python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] |
| 53 | + |
| 54 | + steps: |
| 55 | + - uses: actions/checkout@v5 |
| 56 | + |
| 57 | + - name: Set up Python ${{ matrix.python-version }} |
| 58 | + uses: actions/setup-python@v5 |
| 59 | + with: |
| 60 | + python-version: ${{ matrix.python-version }} |
| 61 | + cache: 'pip' |
| 62 | + |
| 63 | + - name: Download built wheel |
| 64 | + uses: actions/download-artifact@v4 |
| 65 | + with: |
| 66 | + name: wheels-ubuntu-latest |
| 67 | + path: dist/ |
| 68 | + |
| 69 | + - name: Install wheel |
| 70 | + run: | |
| 71 | + python -m pip install --upgrade pip |
| 72 | + pip install dist/*.whl |
| 73 | +
|
| 74 | + - name: Install test dependencies |
| 75 | + run: pip install pytest pytest-cov |
| 76 | + |
| 77 | + - name: Run tests |
| 78 | + run: pytest -v |
| 79 | + |
| 80 | + publish: |
| 81 | + name: Publish to PyPI |
| 82 | + if: startsWith(github.ref, 'refs/tags/') |
| 83 | + needs: test |
| 84 | + runs-on: ubuntu-latest |
| 85 | + environment: |
| 86 | + name: pypi |
| 87 | + url: https://pypi.org/p/libcrypto |
| 88 | + |
| 89 | + steps: |
| 90 | + - uses: actions/checkout@v5 |
| 91 | + |
| 92 | + - name: Set up Python |
| 93 | + uses: actions/setup-python@v5 |
| 94 | + with: |
| 95 | + python-version: '3.11' |
| 96 | + |
| 97 | + - name: Install build dependencies |
| 98 | + run: python -m pip install --upgrade pip build |
| 99 | + |
| 100 | + - name: Build wheel and sdist |
| 101 | + run: python -m build |
| 102 | + |
| 103 | + - name: Publish to PyPI |
| 104 | + uses: pypa/gh-action-pypi-publish@release/v1 |
36 | 105 | with: |
37 | | - name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} |
38 | | - path: ./wheelhouse/*.whl |
| 106 | + password: ${{ secrets.PYPI_API_TOKEN }} |
0 commit comments