|  | 
|  | 1 | +name: Build and upload to PyPI | 
|  | 2 | + | 
|  | 3 | +on: | 
|  | 4 | +  push: | 
|  | 5 | +  pull_request: | 
|  | 6 | +  release: | 
|  | 7 | +    types: | 
|  | 8 | +      - published | 
|  | 9 | + | 
|  | 10 | +jobs: | 
|  | 11 | +  build_wheels: | 
|  | 12 | +    name: "Build wheels on ${{ matrix.os }}" | 
|  | 13 | +    runs-on: ${{ matrix.os }} | 
|  | 14 | +    strategy: | 
|  | 15 | +      fail-fast: false | 
|  | 16 | +      matrix: | 
|  | 17 | +        os: [ubuntu-latest, macos-latest, windows-latest] | 
|  | 18 | +    steps: | 
|  | 19 | +      - uses: "actions/checkout@v3" | 
|  | 20 | +        with: | 
|  | 21 | +          submodules: true | 
|  | 22 | +      - name: "Build wheels" | 
|  | 23 | + | 
|  | 24 | +        env: | 
|  | 25 | +          CIBW_SKIP: "pp*"  # FIXME | 
|  | 26 | +          CIBW_BEFORE_BUILD: "pip install -U cython && ./update_cpp.sh" | 
|  | 27 | +          CIBW_BEFORE_BUILD_WINDOWS: "pip install -U cython && update_cpp.sh" | 
|  | 28 | +          CIBW_TEST_REQUIRES: "pytest" | 
|  | 29 | +          CIBW_TEST_COMMAND: "pytest {project}/tests --doctest-modules" | 
|  | 30 | +      - uses: "actions/upload-artifact@v3" | 
|  | 31 | +        with: | 
|  | 32 | +          path: "./wheelhouse/*.whl" | 
|  | 33 | + | 
|  | 34 | +  make_sdist: | 
|  | 35 | +    name: "Build source distribution" | 
|  | 36 | +    runs-on: ubuntu-latest | 
|  | 37 | +    steps: | 
|  | 38 | +      - uses: "actions/checkout@v2" | 
|  | 39 | +        with: | 
|  | 40 | +          submodules: true | 
|  | 41 | +      - name: "Install dependencies" | 
|  | 42 | +        run: "python -m pip install --upgrade cython" | 
|  | 43 | +      - name: "Rebuild CPP files using Cython" | 
|  | 44 | +        run: "./update_cpp.sh" | 
|  | 45 | +      - name: "Build source distribution" | 
|  | 46 | +        run: "pipx run build --sdist" | 
|  | 47 | +      - uses: "actions/upload-artifact@v3" | 
|  | 48 | +        with: | 
|  | 49 | +          path: "./dist/*.tar.gz" | 
|  | 50 | + | 
|  | 51 | +  upload_to_pypi: | 
|  | 52 | +    name: "Upload to PyPI" | 
|  | 53 | +    runs-on: ubuntu-latest | 
|  | 54 | +    needs: | 
|  | 55 | +      - build_wheels | 
|  | 56 | +      - make_sdist | 
|  | 57 | +    if: github.event_name == 'release' && github.event.action == 'published' | 
|  | 58 | +    steps: | 
|  | 59 | +      - uses: "actions/download-artifact@v3" | 
|  | 60 | +        with: | 
|  | 61 | +          name: artifact | 
|  | 62 | +          path: dist | 
|  | 63 | + | 
|  | 64 | +        with: | 
|  | 65 | +          user: __token__ | 
|  | 66 | +          password: ${{ secrets.PYPI_TOKEN }} | 
|  | 67 | +          print_hash: true | 
|  | 68 | +          verbose: true | 
0 commit comments