|
| 1 | +# Creating PythonLibCore releases |
| 2 | + |
| 3 | +These instructions cover steps needed to create new releases of |
| 4 | +PythonLibCore. Many individual steps are automated, but we don\'t want |
| 5 | +to automate the whole procedure because it would be hard to react if |
| 6 | +something goes terribly wrong. When applicable, the steps are listed as |
| 7 | +commands that can be copied and executed on the command line. |
| 8 | + |
| 9 | +# Preconditions |
| 10 | + |
| 11 | +## Operating system and Python requirements |
| 12 | + |
| 13 | +Generating releases has only been tested on Linux, but it ought to work |
| 14 | +the same way also on OSX and other unixes. Generating releases on |
| 15 | +Windows may work but is not tested, supported, or recommended. |
| 16 | + |
| 17 | +Creating releases is only supported with Python 3.6 or newer. |
| 18 | + |
| 19 | +The `pip` and `invoke` commands below are also expected to run on Python |
| 20 | +3.6+. Alternatively, it\'s possible to use the `python3.6 -m pip` |
| 21 | +approach to run these commands. |
| 22 | + |
| 23 | +## Python dependencies |
| 24 | + |
| 25 | +Many steps are automated using the generic [Invoke](http://pyinvoke.org) |
| 26 | +tool with a help by our [rellu](https://github.com/robotframework/rellu) |
| 27 | +utilities, but also other tools and modules are needed. A pre-condition |
| 28 | +is installing all these, and that\'s easiest done using |
| 29 | +[pip](http://pip-installer.org) and the provided |
| 30 | +[requirements-build.txt](requirements-build.txt) file: |
| 31 | + |
| 32 | + pip install -r requirements-build.txt |
| 33 | + |
| 34 | +## Using Invoke |
| 35 | + |
| 36 | +Invoke tasks are defined in the [tasks.py](tasks.py) file and they are |
| 37 | +executed from the command line like: |
| 38 | + |
| 39 | + inv[oke] task [options] |
| 40 | + |
| 41 | +Run `invoke` without arguments for help. All tasks can be listed using |
| 42 | +`invoke --list` and each task\'s usage with `invoke --help task`. |
| 43 | + |
| 44 | +## Different Git workflows |
| 45 | + |
| 46 | +Git commands used below always expect that `origin` is the project main |
| 47 | +repository. If that\'s not the case, and instead `origin` is your |
| 48 | +personal fork, you probably still want to push to the main repository. |
| 49 | +In that case you need to add `upstream` or similar to `git push` |
| 50 | +commands before running them. |
| 51 | + |
| 52 | +# Testing |
| 53 | + |
| 54 | +Make sure that adequate unit and acceptance tests are executed using |
| 55 | +supported interpreters and operating systems before releases are |
| 56 | +created. Unit and acceptance tests can be executed by running |
| 57 | +[utest/run.py](utest/run.py) and [atest/run.py](atest/run.py) scripts, |
| 58 | +respectively. |
| 59 | + |
| 60 | +# Preparation |
| 61 | + |
| 62 | +1. Check that you are on the master branch and have nothing left to |
| 63 | + commit, pull, or push: |
| 64 | + |
| 65 | + git branch |
| 66 | + git status |
| 67 | + git pull --rebase |
| 68 | + git push |
| 69 | + |
| 70 | +2. Clean up: |
| 71 | + |
| 72 | + invoke clean |
| 73 | + |
| 74 | +3. Set version information to a shell variable to ease copy-pasting |
| 75 | + further commands. Add `aN`, `bN` or `rcN` postfix if creating a |
| 76 | + pre-release: |
| 77 | + |
| 78 | + VERSION=<version> |
| 79 | + |
| 80 | + For example, `VERSION=3.0.1` or `VERSION=3.1a2`. |
| 81 | + |
| 82 | +# Release notes |
| 83 | + |
| 84 | +1. Set GitHub user information into shell variables to ease |
| 85 | + copy-pasting the following command: |
| 86 | + |
| 87 | + GITHUB_USERNAME=<username> |
| 88 | + GITHUB_PASSWORD=<password> |
| 89 | + |
| 90 | + Alternatively, supply the credentials when running that command. |
| 91 | + |
| 92 | +2. Generate a template for the release notes: |
| 93 | + |
| 94 | + invoke release-notes -w -v $VERSION -u $GITHUB_USERNAME -p $GITHUB_PASSWORD |
| 95 | + |
| 96 | + The `-v $VERSION` option can be omitted if [version is already |
| 97 | + set](#set-version). Omit the `-w` option if you just want to get |
| 98 | + release notes printed to the console, not written to a file. |
| 99 | + |
| 100 | + When generating release notes for a preview release like `3.0.2rc1`, |
| 101 | + the list of issues is only going to contain issues with that label |
| 102 | + (e.g. `rc1`) or with a label of an earlier preview release (e.g. |
| 103 | + `alpha1`, `beta2`). |
| 104 | + |
| 105 | +3. Fill the missing details in the generated release notes template. |
| 106 | + |
| 107 | +4. Make sure that issues have correct information: |
| 108 | + |
| 109 | + - All issues should have type (bug, enhancement or task) and |
| 110 | + priority set. Notice that issues with the task type are |
| 111 | + automatically excluded from the release notes. |
| 112 | + - Issue priorities should be consistent. |
| 113 | + - Issue titles should be informative. Consistency is good here |
| 114 | + too, but no need to overdo it. |
| 115 | + |
| 116 | + If information needs to be added or edited, its better to edit it in |
| 117 | + the issue tracker than in the generated release notes. This allows |
| 118 | + re-generating the list of issues later if more issues are added. |
| 119 | + |
| 120 | +5. Add, commit and push: |
| 121 | + |
| 122 | + git add docs/PythonLibCore-$VERSION.rst |
| 123 | + git commit -m "Release notes for $VERSION" docs/PythonLibCore-$VERSION.rst |
| 124 | + git push |
| 125 | + |
| 126 | +6. Update later if necessary. Writing release notes is typically the |
| 127 | + biggest task when generating releases, and getting everything done |
| 128 | + in one go is often impossible. |
| 129 | + |
| 130 | +# Set version |
| 131 | + |
| 132 | +1. Set version information in |
| 133 | + [src/robotlibcore.py](src/robotlibcore.py): |
| 134 | + |
| 135 | + invoke set-version $VERSION |
| 136 | + |
| 137 | +2. Commit and push changes: |
| 138 | + |
| 139 | + git commit -m "Updated version to $VERSION" src/robotlibcore.py |
| 140 | + git push |
| 141 | + |
| 142 | +# Tagging |
| 143 | + |
| 144 | +1. Create an annotated tag and push it: |
| 145 | + |
| 146 | + git tag -a v$VERSION -m "Release $VERSION" |
| 147 | + git push --tags |
| 148 | + |
| 149 | +2. Add short release notes to GitHub\'s [releases |
| 150 | + page](https://github.com/robotframework/PythonLibCore/releases) with |
| 151 | + a link to the full release notes. |
| 152 | + |
| 153 | +# Creating distributions |
| 154 | + |
| 155 | +1. Checkout the earlier created tag if necessary: |
| 156 | + |
| 157 | + git checkout v$VERSION |
| 158 | + |
| 159 | + This isn\'t necessary if continuing right after [tagging](#tagging). |
| 160 | + |
| 161 | +2. Cleanup (again). This removes temporary files as well as `build` and |
| 162 | + `dist` directories: |
| 163 | + |
| 164 | + invoke clean |
| 165 | + |
| 166 | +3. Create source distribution and universal (i.e. Python 2 and 3 |
| 167 | + compatible) [wheel](http://pythonwheels.com): |
| 168 | + |
| 169 | + python setup.py sdist bdist_wheel --universal |
| 170 | + ls -l dist |
| 171 | + |
| 172 | + Distributions can be tested locally if needed. |
| 173 | + |
| 174 | +4. Upload distributions to PyPI: |
| 175 | + |
| 176 | + twine upload dist/* |
| 177 | + |
| 178 | +5. Verify that project the page at |
| 179 | + [PyPI](https://pypi.org/project/robotframework-pythonlibcore/) looks |
| 180 | + good. |
| 181 | + |
| 182 | +6. Test installation (add `--pre` with pre-releases): |
| 183 | + |
| 184 | + pip install --upgrade robotframework-pythonlibcore |
| 185 | + |
| 186 | +# Post actions |
| 187 | + |
| 188 | +1. Back to master if needed: |
| 189 | + |
| 190 | + git checkout master |
| 191 | + |
| 192 | +2. Set dev version based on the previous version: |
| 193 | + |
| 194 | + invoke set-version dev |
| 195 | + git commit -m "Back to dev version" src/robotlibcore.py |
| 196 | + git push |
| 197 | + |
| 198 | + For example, `1.2.3` is changed to `1.2.4.dev1` and `2.0.1a1` to |
| 199 | + `2.0.1a2.dev1`. |
| 200 | + |
| 201 | +3. Close the [issue tracker |
| 202 | + milestone](https://github.com/robotframework/PythonLibCore/milestones). |
| 203 | + Create also new milestone for the next release unless one exists |
| 204 | + already. |
| 205 | + |
| 206 | +# Announcements |
| 207 | + |
| 208 | +1. [robotframework-users](https://groups.google.com/group/robotframework-users) |
| 209 | + and |
| 210 | + [robotframework-announce](https://groups.google.com/group/robotframework-announce) |
| 211 | + lists. The latter is not needed with preview releases but should be |
| 212 | + used at least with major updates. Notice that sending to it requires |
| 213 | + admin rights. |
| 214 | + |
| 215 | +2. Twitter. Either Tweet something yourself and make sure it\'s |
| 216 | + re-tweeted by [\@robotframework](http://twitter.com/robotframework), |
| 217 | + or send the message directly as [\@robotframework]{.title-ref}. This |
| 218 | + makes the note appear also at <http://robotframework.org>. |
| 219 | + |
| 220 | + Should include a link to more information. Possibly a link to the |
| 221 | + full release notes or an email to the aforementioned mailing lists. |
| 222 | + |
| 223 | +3. Slack community. The `#general` channel is probably best. |
| 224 | + |
| 225 | +4. Possibly also [Robot Framework |
| 226 | + LinkedIn](https://www.linkedin.com/groups/Robot-Framework-3710899) |
| 227 | + group. |
0 commit comments