diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2ba10b77..d6a2f41c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -155,24 +155,21 @@ jobs: submodules: true - name: Build sdist - run: pipx run build --sdist + run: pipx run build --sdist -Csetup-args=-Dsdist_mode=true - uses: actions/upload-artifact@v4 with: name: cibw-sdist path: dist/*.tar.gz - upload_pypi: + test_upload_pypi: needs: [build_wheels, build_sdist] runs-on: ubuntu-latest - environment: pypi + environment: + name: testpypi + url: https://test.pypi.org/p/test_scs permissions: id-token: write - # We can also upload always, with skip-existing: true, below - # We upload on every push event (only master, above) that is a new tag - if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') - # Only run this step on GH release - # if: github.event_name == 'release' && github.event.action == 'published' steps: - uses: actions/download-artifact@v4 with: @@ -181,9 +178,23 @@ jobs: path: dist merge-multiple: true + - uses: pypa/gh-action-pypi-publish@release/v1 + # To test: + with: + repository-url: https://test.pypi.org/legacy/ + + upload_pypi: + needs: [test_upload_pypi] + runs-on: ubuntu-latest + environment: pypi + permissions: + id-token: write + # We can also upload always, with skip-existing: true, below + # We upload on every push event (only master, above) that is a new tag + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') + # Only run this step on GH release + # if: github.event_name == 'release' && github.event.action == 'published' + steps: - uses: pypa/gh-action-pypi-publish@release/v1 with: skip-existing: true - # To test: - # with: - # repository-url: https://test.pypi.org/legacy/ diff --git a/meson.build b/meson.build index 2fa6d2a6..d428a164 100644 --- a/meson.build +++ b/meson.build @@ -43,9 +43,10 @@ else endif endif -# Since nothing above was required, we stop here if failed -if not blas_deps[0].found() - error('OpenBLAS or Netlib BLAS/CBLAS is required on all platforms except Windows, and was not found.') +# Since nothing above was required, we stop here if failed. +# When creating an sdist we are not compiling / linking, so don't need to fail. +if not blas_deps[0].found() and not get_option('sdist_mode') + error('OpenBLAS or Netlib BLAS/CBLAS is required on all platforms, and was not found.') endif fs = import('fs') diff --git a/meson.options b/meson.options index ba840d40..79b56784 100644 --- a/meson.options +++ b/meson.options @@ -5,3 +5,5 @@ option('link_blas_statically', type: 'boolean', value: false, description: 'copy BLAS compiled object into SCS module(s)') option('link_mkl', type: 'boolean', value: false, description: 'link to mkl-rt library') +option('sdist_mode', type: 'boolean', value: false, + description: 'Set to true if building an sdist')