diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2022-02-01 11:44:31 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-01 11:44:31 -0700 |
commit | 5e2c1e8afcc446bc17e78f4ead1d9bd03e841ef9 (patch) | |
tree | 145b479fef8c425227d18671055fc26d18002f51 | |
parent | bcdfd208a9b99036cc6e379180c3242b08dedc47 (diff) | |
parent | 127a09f7478740e61d99899baceb249f226ac300 (diff) | |
download | numpy-5e2c1e8afcc446bc17e78f4ead1d9bd03e841ef9.tar.gz |
Merge pull request #20890 from mattip/upload-anaconda
BUILD: Upload wheels to anaconda,org
-rw-r--r-- | .github/workflows/circleci.yml | 24 | ||||
-rw-r--r-- | .github/workflows/cygwin.yml | 4 | ||||
-rw-r--r-- | .github/workflows/wheels.yml | 54 | ||||
-rw-r--r-- | tools/wheels/cibw_test_command.sh | 2 |
4 files changed, 70 insertions, 14 deletions
diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index de02ac6d3..153e46d80 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -1,12 +1,16 @@ +# To enable this workflow on a fork, comment out: +# +# if: github.repository == 'numpy/numpy' on: [status] jobs: - circleci_artifacts_redirector_job: - runs-on: ubuntu-latest - name: Run CircleCI artifacts redirector - steps: - - name: GitHub Action step - uses: larsoner/circleci-artifacts-redirector-action@master - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - artifact-path: 0/doc/build/html/index.html - circleci-jobs: build + circleci_artifacts_redirector_job: + runs-on: ubuntu-latest + name: Run CircleCI artifacts redirector + # if: github.repository == 'numpy/numpy' + steps: + - name: GitHub Action step + uses: larsoner/circleci-artifacts-redirector-action@master + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + artifact-path: 0/doc/build/html/index.html + circleci-jobs: build diff --git a/.github/workflows/cygwin.yml b/.github/workflows/cygwin.yml index fdc776785..8bf7bd1a6 100644 --- a/.github/workflows/cygwin.yml +++ b/.github/workflows/cygwin.yml @@ -1,3 +1,6 @@ +# To enable this workflow on a fork, comment out: +# +# if: github.repository == 'numpy/numpy' name: Test on Cygwin on: push: @@ -9,6 +12,7 @@ on: jobs: cygwin_build_test: runs-on: windows-latest + if: github.repository == 'numpy/numpy' steps: - uses: actions/checkout@v2 with: diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 6a05c5830..384b8f6db 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -10,8 +10,13 @@ name: Wheel builder on: schedule: - # Nightly build at 1:42 UTC - - cron: "42 1 * * *" + # ┌───────────── minute (0 - 59) + # │ ┌───────────── hour (0 - 23) + # │ │ ┌───────────── day of the month (1 - 31) + # │ │ │ ┌───────────── month (1 - 12 or JAN-DEC) + # │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT) + # │ │ │ │ │ + - cron: "42 1 * * 4" push: pull_request: workflow_dispatch: @@ -35,6 +40,7 @@ jobs: set -xe COMMIT_MSG=$(git log --no-merges -1 --oneline) echo "::set-output name=message::$COMMIT_MSG" + echo github.ref ${{ github.ref }} build_wheels: name: Build wheel for ${{ matrix.python }}-${{ matrix.buildplat[1] }} @@ -42,7 +48,8 @@ jobs: if: >- contains(needs.get_commit_message.outputs.message, '[wheel build]') || github.event_name == 'schedule' || - github.event_name == 'workflow_dispatch' + github.event_name == 'workflow_dispatch' || + (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && ( ! endsWith(github.ref, 'dev0'))) runs-on: ${{ matrix.buildplat[0] }} strategy: # Ensure that a wheel builder finishes even if another fails @@ -125,3 +132,44 @@ jobs: with: name: ${{ matrix.python }}-${{ startsWith(matrix.buildplat[1], 'macosx') && 'macosx' || matrix.buildplat[1] }} path: ./wheelhouse/*.whl + + - name: Setup Upload Variables + if: success() + shell: bash + run: | + if [ "push" == "${{ github.event_name }}" ] && [ "${{ startsWith(github.ref, 'refs/tags/v') }}" ]; then + echo push and tag event + echo "ANACONDA_ORG=multibuild-wheels-staging" >> $GITHUB_ENV + echo "TOKEN=${{ secrets.NUMPY_STAGING_UPLOAD_TOKEN }}" >> $GITHUB_ENV + echo "ANACONDA_UPLOAD=true" >> $GITHUB_ENV + elif [ "schedule" == "${{ github.event_name }}" ] || [ "workflow_dispatch" == "${{ github.event_name }}" ]; then + echo scheduled or dispatched event + echo "ANACONDA_ORG=scipy-wheels-nightly" >> $GITHUB_ENV + echo "TOKEN=${{ secrets.NUMPY_NIGHTLY_UPLOAD_TOKEN }}" >> $GITHUB_ENV + echo "ANACONDA_UPLOAD=true" >> $GITHUB_ENV + else + echo non-dispatch event + echo "ANACONDA_UPLOAD=false" >> $GITHUB_ENV + fi + - name: Upload wheels + if: env.TOKEN + shell: bash + run: | + # 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 + echo ${PWD} + if [ ${ANACONDA_UPLOAD} == true ]; then + if [ -z ${TOKEN} ]; then + 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 --skip -u ${ANACONDA_ORG} ./wheelhouse/*.whl + echo "PyPI-style index: https://pypi.anaconda.org/$ANACONDA_ORG/simple" + fi + fi + diff --git a/tools/wheels/cibw_test_command.sh b/tools/wheels/cibw_test_command.sh index ef67172d8..b296993fc 100644 --- a/tools/wheels/cibw_test_command.sh +++ b/tools/wheels/cibw_test_command.sh @@ -11,7 +11,7 @@ if [[ $RUNNER_OS == "Windows" ]]; then PY_DIR=$(python -c "import sys; print(sys.prefix)") mkdir $PY_DIR/libs fi -python -c "import sys; import numpy; sys.exit(not numpy.test('full', extra_argv=['-v']))" +python -c "import sys; import numpy; sys.exit(not numpy.test('full', extra_argv=['-vvv']))" python $PROJECT_DIR/tools/wheels/check_license.py if [[ $UNAME == "Linux" || $UNAME == "Darwin" ]] ; then |