Skip to content

BUILD: Upload wheels to anaconda,org#20890

Merged
charris merged 12 commits intonumpy:mainfrom
mattip:upload-anaconda
Feb 1, 2022
Merged

BUILD: Upload wheels to anaconda,org#20890
charris merged 12 commits intonumpy:mainfrom
mattip:upload-anaconda

Conversation

@mattip
Copy link
Copy Markdown
Member

@mattip mattip commented Jan 25, 2022

Fixes #20262

Upload wheels to anaconda.org via cibuildwheel. The logic is:

  • pushing a new tag will trigger a guthub action with `github.ref='refs/tags/v*' which will upload the wheels to multibuild-wheels-staging
  • the cron-scheduled job or NumPy team members clicking on the "Run workflow" button from Actions (in the menu bar above) -> Wheel builder will upload wheels to scipy-wheels-nightly

This uses the secret tokens which were generated from https://anaconda.org/multibuild-wheels-staging/settings/access https://anaconda.org/scipy-wheels-nightly/settings/access and then added to this repo at https://github.com/numpy/numpy/settings/environments/231368784/edit

This will probably influence the release instructions

I tested this in my fork of the repo. The commit ref is echoed in the Get commit message step (open the "Get commit message" fold in the CI run area to see the temporary tag in my fork of refs/tags/v2.0.1.dev0. Then this causes "push and tag event" to be echoed from the appropriate branch of the if in the "Setup Upload Variables" fold in any of the wheel builds, which will set up the $TOKEN and $ANACONDA_ORG to be appropriately set.

The use of the secrets and final upload step should Just Work(tm) but may require some tweaks.

Thanks to @bashtage for the parallel work done in MacPython/statsmodels-wheels#97

@lithomas1 - does this look right?

Along the way, I also added if: github.repository == 'numpy/numpy' to some other workflows so they do not run on forks.

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
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bashtage I used ${{ secrets.NUMPY_TOKEN }} here like elsewhere in this repo where you used $NUMPY_TOKEN. I wonder if it makes a difference?

@lithomas1
Copy link
Copy Markdown
Contributor

Maybe it's better to wait for all wheels to be present before uploading wheels.
(The main ones that are missing are the aarch64 ones).

Uploading wheels from here would also mean stopping the numpy-wheels uploads, so it might not be ideal if some wheels are missing.

(P.S. can you append [wheel build] to your next commit so that the wheel builder triggers and we can see if the workflow works?)

@mattip
Copy link
Copy Markdown
Member Author

mattip commented Jan 26, 2022

Maybe it's better to wait for all wheels to be present before uploading wheels.
(The main ones that are missing are the aarch64 ones).

Those wheels should come from the travis action, like in numpy-wheels which uses azure for x86 / macOS builds and travis for aarch64.

I think the proper order would be:

  • get approval for this PR
  • submit a PR to remove the cron job from the numpy-wheels azure pipeline
  • merge the two PRs simultaneously.

Then subsequent PRs can deal with aarch64 and travis.

@mattip
Copy link
Copy Markdown
Member Author

mattip commented Jan 26, 2022

The wheel build run finished, it reports non-dispatch event when decided whether to upload or not.

@mattip
Copy link
Copy Markdown
Member Author

mattip commented Jan 26, 2022

The intermittent PyPy38 windows failure will be fixed by the next release, which should happen in the next few weeks. See https://foss.heptapod.net/pypy/pypy/-/issues/3604

@mattip
Copy link
Copy Markdown
Member Author

mattip commented Jan 26, 2022

We should filter out the dummy tag for starting a new branch (like v1.22.0.dev0) and not upload those wheels.

@charris
Copy link
Copy Markdown
Member

charris commented Jan 26, 2022

Does this skip uploading duplicate builds? That can be handy when a build fails for unrelated reasons and needs to be rerun. Github actions doesn't allow us to selectively rerun a build. Hmm, makes me wonder if there is a way to break things up so that that is possible.

@mattip
Copy link
Copy Markdown
Member Author

mattip commented Jan 26, 2022

Does this skip uploading duplicate builds

No, like the current numpy-wheel runs on Azure, the entire build can be rerun but individual wheel builds cannot, and any new upload will replace and older one with the same name.

@bashtage
Copy link
Copy Markdown
Contributor

If you upload a dupe to Anaconda it just overwrites the previous daily that will have the same git hash and other descriptors.

@mattip
Copy link
Copy Markdown
Member Author

mattip commented Jan 26, 2022

Tags that end with dev0 will not upload.

@charris
Copy link
Copy Markdown
Member

charris commented Jan 26, 2022

and any new upload will replace and older one with the same name.

Ah, you use --force instead of --skip. Another thing that can happen is the tag needs to be changed to another commit, i.e., deleted and replaced when something needs to be fixed. How is that handled? I'd almost rather hit a button than rely on tags.

@lithomas1
Copy link
Copy Markdown
Contributor

and any new upload will replace and older one with the same name.

Ah, you use --force instead of --skip. Another thing that can happen is the tag needs to be changed to another commit, i.e., deleted and replaced when something needs to be fixed. How is that handled? I'd almost rather hit a button than rely on tags.

Maybe we can make the uploading to the staging area based off another commit trigger.
(i.e. adding [wheel release] to a commit to upload to staging)

@mattip
Copy link
Copy Markdown
Member Author

mattip commented Jan 27, 2022

Another thing that can happen is the tag needs to be changed to another commit, i.e., deleted and replaced when something needs to be fixed.

How common is this? I think changing tags is discouraged as an anti-practice. It would be better to liberally use release candidates, then re-tag the last release candidate with the release tag once everything is OK.

Maybe we can make the uploading to the staging area based off another commit trigger.
(i.e. adding [wheel release] to a commit to upload to staging)

I would prefer to put this in as-is (and fix the inevitable problems with tokens and uploading) and if needed in a future PR we can add more features.

@mattip
Copy link
Copy Markdown
Member Author

mattip commented Jan 27, 2022

Ah, you use --force instead of --skip

Changed to use --skip like the current numpy-wheels workflows.

@charris
Copy link
Copy Markdown
Member

charris commented Jan 27, 2022

How common is this?

Typos happen :) That said, it may be that adding an empty commit for a new tag might be the best solution. I do tend to think of the release branch as my private preserve.

@mattip
Copy link
Copy Markdown
Member Author

mattip commented Jan 27, 2022

I do tend to think of the release branch as my private preserve.

Rightly so. I think --skipped should make changing the tags plausible, if not desirable.

@charris
Copy link
Copy Markdown
Member

charris commented Jan 28, 2022

merge the two PRs simultaneously.

Might just have them on different days (Wed and Sat) and we can compare before disabling the numpy-wheels build.

@mattip
Copy link
Copy Markdown
Member Author

mattip commented Jan 31, 2022

@charris thoughts?

@charris
Copy link
Copy Markdown
Member

charris commented Feb 1, 2022

Let's just put this in, I don't see any reason to worry about multiple nightly uploads.

@charris charris merged commit 5e2c1e8 into numpy:main Feb 1, 2022
@charris
Copy link
Copy Markdown
Member

charris commented Feb 1, 2022

Thanks Matti.

@charris
Copy link
Copy Markdown
Member

charris commented Feb 3, 2022

There hasn't been a wheels upload to the nightly repo. I think that should have happened?

@mattip
Copy link
Copy Markdown
Member Author

mattip commented Feb 3, 2022

Let's see, I pushed the button "Run workflow" on https://github.com/numpy/numpy/actions/workflows/wheels.yml.

@mattip
Copy link
Copy Markdown
Member Author

mattip commented Feb 3, 2022

Ahh, indeed, something is wrong. The "Upload wheels" build step was not triggered from this scheduled run, but it is printing "scheduled or dispatched event" in the "Set Upload Variables" step. The condition if: env.TOKEN is not being set :(

@mattip
Copy link
Copy Markdown
Member Author

mattip commented Feb 4, 2022

fixed in PR #20996

@mattip mattip deleted the upload-anaconda branch December 27, 2022 16:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUILD: use cibuildwheel to upload wheels

4 participants