diff options
author | Thomas Li <47963215+lithomas1@users.noreply.github.com> | 2022-02-19 17:32:33 -0800 |
---|---|---|
committer | Thomas Li <47963215+lithomas1@users.noreply.github.com> | 2022-03-12 18:32:55 -0800 |
commit | 028e6d141d27ba0605d4fd180a264505025bc92d (patch) | |
tree | a2026ff3b94a5260d2a7693a95d8e6943cf0aaff | |
parent | fa0881fe14ab735c4ac1822767cc2f024f650130 (diff) | |
download | numpy-028e6d141d27ba0605d4fd180a264505025bc92d.tar.gz |
BLD: Make a sdist [wheel build]
-rw-r--r-- | .github/workflows/wheels.yml | 60 | ||||
-rw-r--r-- | tools/wheels/upload_wheels.sh | 12 |
2 files changed, 70 insertions, 2 deletions
diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 7759e2550..253dd074b 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -147,3 +147,63 @@ jobs: # https://anaconda.org/multibuild-wheels-staging/numpy # The tokens were originally generated at anaconda.org upload_wheels + build_sdist: + name: Build sdist + needs: get_commit_message + if: >- + contains(needs.get_commit_message.outputs.message, '[wheel build]') || + github.event_name == 'schedule' || + github.event_name == 'workflow_dispatch' || + (github.event_name == 'pull_request' && + (contains(github.event.pull_request.labels.*.name, '36 - Build') || + contains(github.event.pull_request.labels.*.name, '03 - Maintenance') || + contains(github.event.pull_request.labels.*.name, '14 - Release'))) || + (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && ( ! endsWith(github.ref, 'dev0'))) + runs-on: ubuntu-latest + steps: + - name: Checkout numpy + uses: actions/checkout@v2 + with: + submodules: true + # versioneer.py requires the latest tag to be reachable. Here we + # fetch the complete history to get access to the tags. + # A shallow clone can work when the following issue is resolved: + # https://github.com/actions/checkout/issues/338 + fetch-depth: 0 + # Used to push the built wheels + - uses: actions/setup-python@v2 + with: + # Build sdist on lowest supported Python + python-version: '3.8' + - name: Build sdist + run: | + python setup.py sdist + - name: Test the sdist + run: | + # TODO: Don't run test suite, and instead build wheels from sdist + # Depends on pypa/cibuildwheel#1020 + python -m pip install dist/*.gz + pip install -r test_requirements.txt + cd .. # Can't import numpy within numpy src directory + python -c "import numpy; print(numpy.__version__); numpy.test();" + - uses: actions/upload-artifact@v2 + with: + name: sdist + path: ./dist/* + + - name: Upload sdist + if: success() + shell: bash + env: + NUMPY_STAGING_UPLOAD_TOKEN: ${{ secrets.NUMPY_STAGING_UPLOAD_TOKEN }} + NUMPY_NIGHTLY_UPLOAD_TOKEN: ${{ secrets.NUMPY_NIGHTLY_UPLOAD_TOKEN }} + run: | + source tools/wheels/upload_wheels.sh + set_upload_vars + # trigger an upload to + # https://anaconda.org/scipy-wheels-nightly/numpy + # for cron jobs or "Run workflow" (restricted to main branch). + # Tags will upload to + # https://anaconda.org/multibuild-wheels-staging/numpy + # The tokens were originally generated at anaconda.org + upload_wheels diff --git a/tools/wheels/upload_wheels.sh b/tools/wheels/upload_wheels.sh index 031d62000..21c6e629e 100644 --- a/tools/wheels/upload_wheels.sh +++ b/tools/wheels/upload_wheels.sh @@ -41,8 +41,16 @@ upload_wheels() { echo no token set, not uploading else python -m pip install git+https://github.com/Anaconda-Server/anaconda-client - ls ./wheelhouse/*.whl - anaconda -t ${TOKEN} upload --no-progress --skip -u ${ANACONDA_ORG} ./wheelhouse/*.whl + if compgen -G "./wheelhouse/*.gz"; then + echo "Found sdist" + anaconda -t ${TOKEN} upload --skip -u ${ANACONDA_ORG} ./wheelhouse/*.gz + elif compgen -G "./wheelhouse/*.whl"; then + echo "Found wheel" + anaconda -t ${TOKEN} upload --skip -u ${ANACONDA_ORG} ./wheelhouse/*.whl + else + echo "Files do not exist" + return 1 + fi echo "PyPI-style index: https://pypi.anaconda.org/$ANACONDA_ORG/simple" fi fi |