Skip to content
This repository has been archived by the owner on Dec 16, 2022. It is now read-only.

Adds release workflow #4112

Merged
merged 17 commits into from Apr 21, 2020
Merged

Adds release workflow #4112

merged 17 commits into from Apr 21, 2020

Conversation

epwalsh
Copy link
Member

@epwalsh epwalsh commented Apr 21, 2020

Addresses #4096 and fixes other issues with the GitHub Actions workflows including the ssh problems with the docs deployment job. This also fixes the issue with the logging test.

Changes

The PR checks remain the same. What's different is what happens on a release or master commit. When either of these events occur, 4 more jobs will be ran once the usual PR checks are successful:

Build Package: Builds the PyPI distribution files.

Test Package: Tests installing the core library from the distribution files.

Docker: Builds, tests, and pushes a Docker image by installing the core library from the distribution files. This only runs once the Test Package job has completed successfully. On a master commit, the image will be pushed as allennnlp/commit:COMMIT_SHA, and on a release it will be pushed as allennlp/allennlp:RELEASE_TAG.

Docs: Builds and pushes the documentation to the allennlp-docs repo. This only runs once the Test Package job has completed successfully. On a master commit, the docs are put in the master/ folder, and on a release they are put into a folder with the name of the release tag.

Further, for a release (not for a master commit), one more job named PyPI runs after all of the other jobs mentioned complete successfully. This just uploads the distribution files to PyPI.

Release process

With this updated workflow, the release process will look like this:

  1. Create and publish a GitHub release for the core library.
  2. Wait for the workflow to pass, which will result in the core library being published to PyPI.
  3. Create and publish a GitHub release for the models library.
  4. Wait for the workflow (in the models repo) to pass, which will result in the modesl library being published to PyPI.

What this PR doesn't address

  • Nightly builds. I'll follow up with a PR for that later.
  • Automating the process of creating a GitHub release. This will be more involved.

@epwalsh epwalsh requested review from dirkgr and schmmd April 21, 2020 20:55
@epwalsh epwalsh self-assigned this Apr 21, 2020
@schmmd
Copy link
Member

schmmd commented Apr 21, 2020

Painful commit history! The release process looks like a huge improvement over our past one!

@epwalsh
Copy link
Member Author

epwalsh commented Apr 21, 2020

Painful commit history! The release process looks like a huge improvement over our past one!

It really was 😭 😭 😭

@epwalsh
Copy link
Member Author

epwalsh commented Apr 21, 2020

I've confirmed that the fixes to the docs workflow actually do the trick: https://github.com/epwalsh/allennlp/runs/606384562

@epwalsh
Copy link
Member Author

epwalsh commented Apr 21, 2020

And this confirms that the logging test has been fixed: https://github.com/epwalsh/allennlp/runs/606506610

@@ -0,0 +1,32 @@
# This Dockerfile creates an environment suitable for downstream usage of AllenNLP.
# It creates an environment that includes a wheel installation of allennlp.
Copy link
Member

Choose a reason for hiding this comment

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

Should we install -models into this too?

Copy link
Member Author

Choose a reason for hiding this comment

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

Another option would be to publish a separate image that includes models. Could do that in the release workflow in the models repo

@dirkgr
Copy link
Member

dirkgr commented Apr 21, 2020

It's not great that it says "skipped" for all those tests, but not critical either.

name: CI

on:
# TODO: add nightly schedule.
Copy link
Member

Choose a reason for hiding this comment

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

So no nightly release right now?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yea, although I could probably get that done by the end of the day

@epwalsh epwalsh merged commit b4c7d76 into allenai:master Apr 21, 2020
@epwalsh epwalsh deleted the release-workflow branch April 21, 2020 21:31
runs-on: ubuntu-latest
strategy:
matrix:
python: ['3.6', '3.7']
Copy link
Contributor

Choose a reason for hiding this comment

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

I know you just moved things from files, but maybe we should make the tests run on 3.6-8? As these are the 3 major Python versions we support.

Copy link
Member Author

@epwalsh epwalsh Apr 21, 2020

Choose a reason for hiding this comment

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

I'm not sure if we should support 3.8 yet. Last time I tried to use 3.8 I ran into a bunch of issues with dependencies not supporting it yet. That was a couple months ago so maybe those issues are fixed by now. In any case it would be worth trying but should probably hold off until we get the release process completely ironed out.

Copy link
Member

Choose a reason for hiding this comment

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

@bryant1410, did you try it with 3.8? Does it work?

Copy link
Contributor

Choose a reason for hiding this comment

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

I have a project with Python 3.8 with AllenNLP from master. It runs fine (unless there's a bug I'm not aware of...).

run: |
make typecheck

- name: Run tests
Copy link
Contributor

Choose a reason for hiding this comment

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

What about also adding a python setup.py check? This performs checks package-wise, especially on the metadata.

Copy link
Member Author

Choose a reason for hiding this comment

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

That's probably a good idea. It looks like it will fail though when we have a -unreleased version?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, it breaks pip and PyPI. There are some rules of what are valid suffixes.


- name: Install requirements
run: |
pip install --upgrade pip setuptools wheel
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it necessary to specify "setuptools" and "wheel", given that they're here and will be installed if missing by the next pip install -e .?:

requires = ["setuptools", "wheel"]

Copy link
Member Author

Choose a reason for hiding this comment

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

I did run into an issue once where some deps failed to install because wheel hadn't been installed yet. Maybe I was doing something weird at the time.

Copy link
Contributor

Choose a reason for hiding this comment

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

I understand what you say. However, it should be installed now if missing because of that line I'm mentioning. See https://pip.pypa.io/en/stable/reference/pip/#pep-517-and-518-support

Copy link
Member Author

Choose a reason for hiding this comment

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

Gotcha, I didn't know about that until now so thank you. It's probably a good idea to keep them up-to-date though. Do you know if pip will automatically do that?

Copy link
Contributor

Choose a reason for hiding this comment

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

It won't, at least when I had problems with older Python versions. I'm not sure if it's necessary to keep them up-to-date but probably is necessary to set a minimum version. I had to set a minimum version for setuptools once, to support my features, because I saw the default in some configuration (Python 3.5?) wasn't working fine: pln-fing-udelar/fast-krippendorff@e8ec06f#diff-90829e76e906f1c73140c7ded7e1b268

Comment on lines +97 to +98
pip install -e .
pip install --upgrade -r dev-requirements.txt
Copy link
Contributor

Choose a reason for hiding this comment

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

It can be faster to do:

pip install --upgrade -e . -r dev-requirements.txt

As it resolves the dependencies only once.

Copy link
Member

Choose a reason for hiding this comment

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

That's neat. It also gives it a chance to do a better job resolving dependencies.

Copy link
Member Author

Choose a reason for hiding this comment

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

@bryant1410 feel free to make a PR for this

@bryant1410
Copy link
Contributor

Oh, my comments were 5m late.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants