Skip to content

Commit 2897679

Browse files
authored
Release process fix & major/minor/rev macro addition (#8126)
* update release process to the new CI * generate ARDUINO_ESP8266_{MAJOR,MINOR,REVISION} in core_version.h * makecorever: new option `-r` for release
1 parent ff04194 commit 2897679

File tree

4 files changed

+75
-31
lines changed

4 files changed

+75
-31
lines changed

cores/esp8266/core_version.h

+12
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,18 @@
66
#define ARDUINO_ESP8266_GIT_DESC unspecified
77
#endif
88

9+
#ifndef ARDUINO_ESP8266_MAJOR
10+
#define ARDUINO_ESP8266_MAJOR 0
11+
#endif
12+
13+
#ifndef ARDUINO_ESP8266_MINOR
14+
#define ARDUINO_ESP8266_MINOR 0
15+
#endif
16+
17+
#ifndef ARDUINO_ESP8266_REVISION
18+
#define ARDUINO_ESP8266_REVISION 0
19+
#endif
20+
921
// ARDUINO_ESP8266_RELEASE is defined for released versions as a string containing the version name, i.e. "2_3_0_RC1"
1022
// ARDUINO_ESP8266_RELEASE is used in the core internally. Please use ESP.getCoreVersion() function instead.
1123

package/README.md

+18-20
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ Here is a rough overview of the effective release process. See the section below
7676
* Prepare release notes in Markdown format.
7777

7878
* For changes that are breaking, duplicate those changes and put the duplicate lines into a separate group called Breaking Changes. That group should go at the top of the Changelog. The original lines for the breaking changes should be marked by appending "(Breaking change)" to the line. Example:
79-
79+
8080
```
8181
Breaking Changes
8282
================
@@ -141,7 +141,7 @@ The following points assume work in a direct clone of the repository, and not in
141141
8. Wait for Travis CI build for the tag to pass, see https://travis-ci.org/esp8266/Arduino/builds,
142142
143143
144-
9. Check that the new (draft) release has been created (no editing at this point!), see https://github.com./esp8266/Arduino/releases.
144+
9. Check that the new (draft) release has been created (no editing at this point!), see https://github.com./esp8266/Arduino/releases.
145145
146146
10. Check that the boards manager package .zip file has been successfully uploaded as a release artifact.
147147
@@ -167,41 +167,39 @@ The following points assume work in a direct clone of the repository, and not in
167167
--------------COPY BELOW THIS LINE--------------
168168
[Reference](https://github.com./esp8266/Arduino/tree/master/package#creating-a-release-for-maintainers) for details.
169169

170-
- [ ] 1. Open a new issue to track activities.
170+
- [ ] 1. Make sure that no issues or PRs are assigned to the milestone to be released.
171171

172-
- [ ] 2. Make sure that no issues or PRs are assigned to the milestone to be released.
172+
- [ ] 2. Open a new issue to track activities.
173173

174174
- [ ] 3. Assemble release notes.
175175

176-
- [ ] 4. Make a PR with the following, [wait for Travis CI](https://travis-ci.org/github/esp8266/Arduino/builds/), and merge.
176+
- [ ] 4. Make a PR with the following, [wait for CI](https://github.com./esp8266/Arduino/pull/8034/checks), and merge.
177177

178178
* [platform.txt](https://github.com./esp8266/Arduino/blob/master/platform.txt)
179179
* [package.json](https://github.com./esp8266/Arduino/blob/master/package.json)
180-
* [cores/esp8266/TZ.h](https://github.com./esp8266/Arduino/blob/master/cores/esp8266/TZ.h)
181-
182-
- [ ] 5. Wait until the release notes have been checked by other maintainers
183-
184-
- [ ] 6. Navigate to [Travis CI options](https://travis-ci.org/esp8266/Arduino/settings), enable ´Build pushed branches´ (before tagging in next step)
180+
* [TZ.h](https://github.com./esp8266/Arduino/blob/master/cores/esp8266/TZ.h) (<= `cd tools; ./TZupdate.sh`)
185181

186-
- [ ] 7. Tag the latest commit on the master branch, then push it to esp8266/Arduino
182+
- [ ] 5. Wait until the release notes have been checked by other maintainers (can be changed afterwards anyway)
187183

188-
- [ ] 8. Wait for Travis CI build for the tag to pass, see https://travis-ci.org/esp8266/Arduino/builds,
184+
- [ ] 6. Tag the latest commit on the master branch, then push it to esp8266/Arduino
185+
add: `git tag -a -m "Release 3.0.0" 3.0.0; git push origin 3.0.0`
186+
remove: `git tag -d X.Y.Z; git push --delete origin X.Y.Z`
189187

190-
- [ ] 9. Check that the new (draft) release has been created (no editing at this point!), see https://github.com./esp8266/Arduino/releases.
188+
- [ ] 7. Wait for CI build for the tag to pass (in `Actions` menu)
191189

192-
- [ ] 10. Check that the boards manager package .zip file has been successfully uploaded as a release artifact.
190+
- [ ] 8. Check that the new (draft) release has been created (no editing at this point!), see https://github.com./esp8266/Arduino/releases.
193191

194-
- [ ] 11. Check that the package index downloaded from https://arduino.esp8266.com/stable/package_esp8266com_index.json contains an entry for the new version (it may not be the first one).
192+
- [ ] 9. Check that the boards manager package .zip file has been successfully uploaded as a release artifact.
195193

196-
- [ ] 12. Return to the [Travis CI options](https://travis-ci.org/esp8266/Arduino/settings) and disable `Build pushed branches`.
194+
- [ ] 10. Check that the package index downloaded from https://arduino.esp8266.com/stable/package_esp8266com_index.json contains an entry for the new version (it may not be the first one).
197195

198-
- [ ] 13. Navigate to [release list in Github](https://github.com./esp8266/Arduino/releases), press "Edit" button to edit release description, paste release notes, and publish it.
196+
- [ ] 11. Navigate to [release list in Github](https://github.com./esp8266/Arduino/releases), press "Edit" button to edit release description, paste release notes, and publish it.
199197

200-
- [ ] 14. In the issue tracker, remove "staged-for-release" label for all issues which have it, and close them. Close the milestone associated with the released version (the milestone should be empty per point 2 above)
198+
- [ ] 12. In the issue tracker, remove "staged-for-release" label for all issues which have it, and close them. Close the milestone associated with the released version (the milestone should be empty per point 1 above)
201199

202-
- [ ] 15. Check that https://arduino-esp8266.readthedocs.io/en/latest/ has a new doc build for the new tag, and that "stable" points to that build. If a new build did not trigger, log into readthedoc's home here https://readthedocs.org/ (account must have been added to project as maintainer) and trigger it manually.
200+
- [ ] 13. Check that https://arduino-esp8266.readthedocs.io/en/latest/ has a new doc build for the new tag, and that "stable" points to that build. If a new build did not trigger, log into readthedoc's home here https://readthedocs.org/ (account must have been added to project as maintainer) and trigger it manually.
203201

204-
- [ ] 16. Create a commit to the master branch, updating:
202+
- [ ] 14. Create a commit to the master branch, updating:
205203

206204
* The version in platform.txt and package.json files. This should correspond to the version of the *next* milestone, plus `-dev` suffix. E.g. `3.1.0-dev`.
207205
* In main README.md go to "Latest release" section, change version number in the readthedocs link to the version which was just released, and verify that all links work.

package/build_boards_manager_package.sh

+7-6
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,13 @@ $SED -E "s/name=([a-zA-Z0-9\ -]+).*/name=\1(${ver})/g"\
109109
> ${outdir}/platform.txt
110110

111111
# Put core version and short hash of git version into core_version.h
112-
ver_define=`echo "${plain_ver}" | tr "[:lower:]." "[:upper:]_"`
113-
echo "ver_define: ${ver_define} (plain_ver: ${plain_ver})"
114-
echo "#define ARDUINO_ESP8266_GIT_VER 0x`git rev-parse --short=8 HEAD 2>/dev/null`" >${outdir}/cores/esp8266/core_version.h
115-
echo "#define ARDUINO_ESP8266_GIT_DESC `git describe --tags 2>/dev/null`" >>${outdir}/cores/esp8266/core_version.h
116-
echo "#define ARDUINO_ESP8266_RELEASE_${ver_define}" >>${outdir}/cores/esp8266/core_version.h
117-
echo "#define ARDUINO_ESP8266_RELEASE \"${ver_define}\"" >>${outdir}/cores/esp8266/core_version.h
112+
#ver_define=`echo "${plain_ver}" | tr "[:lower:]." "[:upper:]_"`
113+
#echo "ver_define: ${ver_define} (plain_ver: ${plain_ver})"
114+
#echo "#define ARDUINO_ESP8266_GIT_VER 0x`git rev-parse --short=8 HEAD 2>/dev/null`" >${outdir}/cores/esp8266/core_version.h
115+
#echo "#define ARDUINO_ESP8266_GIT_DESC `git describe --tags 2>/dev/null`" >>${outdir}/cores/esp8266/core_version.h
116+
#echo "#define ARDUINO_ESP8266_RELEASE_${ver_define}" >>${outdir}/cores/esp8266/core_version.h
117+
#echo "#define ARDUINO_ESP8266_RELEASE \"${ver_define}\"" >>${outdir}/cores/esp8266/core_version.h
118+
python3 ${srcdir}/tools/makecorever.py -b ${outdir} -i cores/esp8266 -p ${srcdir} -v ${plain_ver} -r
118119

119120
# Zip the package
120121
pushd package/versions/${visiblever}

tools/makecorever.py

+38-5
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,52 @@
2222
import subprocess
2323

2424

25-
def generate(path, platform_path, git_ver="ffffffff", git_desc="unspecified"):
25+
def generate(path, platform_path, version="unspecified", release = False):
2626
def git(*args):
2727
cmd = ["git", "-C", platform_path]
2828
cmd.extend(args)
2929
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, universal_newlines=True, stderr=subprocess.DEVNULL)
3030
return proc.stdout.readlines()[0].strip()
3131

32+
text = ""
33+
3234
try:
33-
git_ver = git("rev-parse", "--short=8", "HEAD")
35+
text = "#define ARDUINO_ESP8266_GIT_VER 0x{}\n".format(git("rev-parse", "--short=8", "HEAD"))
36+
except Exception:
37+
pass
38+
39+
# version is
40+
# - using Arduino-CLI:
41+
# - blah-5.6.7 (official release, coming from platform.txt)
42+
# - blah-5.6.7-dev (intermediate / unofficial / testing release)
43+
# - using git:
44+
# - 5.6.7 (from release script, official release)
45+
# - 5.6.7-42-g00d1e5 (from release script, test release)
46+
git_desc = version
47+
try:
48+
# in any case, get a better version when git is around
3449
git_desc = git("describe", "--tags")
3550
except Exception:
3651
pass
3752

38-
text = "#define ARDUINO_ESP8266_GIT_VER 0x{}\n".format(git_ver)
39-
text += "#define ARDUINO_ESP8266_GIT_DESC {}\n".format(git_desc)
53+
text += "#define ARDUINO_ESP8266_GIT_DESC {}\n".format(git_desc)
54+
text += "\n"
55+
56+
version_split = version.split(".")
57+
# major: if present, skip "unix-" in "unix-3"
58+
text += "#define ARDUINO_ESP8266_MAJOR {}\n".format(version_split[0].split("-")[-1])
59+
text += "#define ARDUINO_ESP8266_MINOR {}\n".format(version_split[1])
60+
# revision can be ".n" or ".n-dev" or ".n-42-g00d1e5"
61+
revision = version_split[2].split("-")
62+
text += "#define ARDUINO_ESP8266_REVISION {}\n".format(revision[0])
63+
text += "\n"
64+
65+
# release or dev
66+
if release:
67+
text += "#define ARDUINO_ESP8266_RELEASE \"{}\"\n".format(git_desc)
68+
text += "#define ARDUINO_ESP8266_RELEASE_{}\n".format(git_desc.replace("-","_").replace(".","_"))
69+
else:
70+
text += "#define ARDUINO_ESP8266_DEV 1 // developpment version\n"
4071

4172
try:
4273
with open(path, "r") as inp:
@@ -67,6 +98,7 @@ def git(*args):
6798
"-v", "--version", action="store", required=True, help="version variable"
6899
)
69100
parser.add_argument("-i", "--include_dir", default="core")
101+
parser.add_argument("-r", "--release", action="store_true", default=False)
70102

71103
args = parser.parse_args()
72104

@@ -79,5 +111,6 @@ def git(*args):
79111
generate(
80112
os.path.join(include_dir, "core_version.h"),
81113
args.platform_path,
82-
git_desc=args.version,
114+
version=args.version,
115+
release=args.release
83116
)

0 commit comments

Comments
 (0)