Skip to content

Commit 85d9157

Browse files
committed
Adjust release procedure and CI system for "trunk-based" development strategy
Previously, releases were always made from a point in the revision history of the `main` branch (typically the tip of the branch at the time of the release). Although the simplicity of this approach is nice, it can be limiting in some cases. For this reason, the project is switching to using a "trunk-based" development strategy, as described here: https://trunkbaseddevelopment.com/ This approach allows making releases at any time that consist of the arbitrary subset of revisions suitable for shipping to the users at that time. The commits that should be included in the release are cherry-picked to a release branch and the tag created on that branch. This means that: - PRs can be merged to the `main` branch as soon as they have passed review rather than having to postpone the merge of changes that are not ready to be included in the next release. - Releases don't need to be postponed if the prior revision history on the `main` branch contains changes that are not ready to be included in the release. The documented release procedure must be adjusted to reflect the new development strategy. CI System Adjustments --------------------- The status of the GitHub Actions workflows should be evaluated before making a release. However, this is not so simple as checking the status of the commit at the tip of the release branch. The reason is that, for the sake of efficiency, the workflows are configured to run only when the processes are relevant to the trigger event (e.g., no need to run unit tests for a change to the readme). In the case of the default branch, you can simply set the workflow runs filter to that branch and then check the result of the latest run of each workflow of interest. However, that was not possible to do with the release branch since it might be that the workflow was never run in that branch. The status of the latest run of the workflow in the default branch might not match the status for the release branch if the release branch does not contain the full history. For this reason, it will be helpful to trigger all relevant workflows on the creation of a release branch. This will ensure that each of those workflows will always have at least one run in the release branch. Subsequent commits pushed to the branch can run based on their usual trigger filters and the status of the latest run of each workflow in the branch will provide an accurate indication of the state of that branch. Branches are created for purposes other than releases, most notably feature branches to stage work for a pull request. Due to the comprehensive nature of this project's CI system, it would not be convenient or efficient to fully run all CI workflows on the creation of every feature branch. Unfortunately, GitHub Actions does not support filters on the `create` event of branch creation like it does for the `push` and `pull_request` events. There is support for a `branches` filter of the `push` event, but that filter is an "AND" to the `paths` filter while this application requires an "OR". For this reason, the workflows must be triggered by the creation of any branch. The unwanted job runs are prevented by adding a `run-determination` job with the branch filter handled by Bash commands. The other jobs of the workflow use this `run-determination` job as a dependency, only running when it indicates they should via a job output. Because this minimal `run-determination` job runs very quickly, it is roughly equivalent to the workflow having been skipped entirely for non-release branch creations.
1 parent d0bce15 commit 85d9157

File tree

4 files changed

+146
-15
lines changed

4 files changed

+146
-15
lines changed

.github/workflows/build.yml

+30
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
name: Arduino IDE
22

33
on:
4+
create:
45
push:
56
branches:
67
- main
8+
- '[0-9]+.[0-9]+.x'
79
paths-ignore:
810
- '.github/**'
911
- '!.github/workflows/build.yml'
@@ -34,8 +36,36 @@ env:
3436
CHANGELOG_ARTIFACTS: changelog
3537

3638
jobs:
39+
run-determination:
40+
runs-on: ubuntu-latest
41+
outputs:
42+
result: ${{ steps.determination.outputs.result }}
43+
permissions: {}
44+
steps:
45+
- name: Determine if the rest of the workflow should run
46+
id: determination
47+
run: |
48+
RELEASE_BRANCH_REGEX="refs/heads/[0-9]+.[0-9]+.x"
49+
TAG_REGEX="refs/tags/.*"
50+
# The `create` event trigger doesn't support `branches` filters, so it's necessary to use Bash instead.
51+
if [[
52+
("${{ github.event_name }}" != "create" ||
53+
"${{ github.ref }}" =~ $RELEASE_BRANCH_REGEX) &&
54+
! "${{ github.ref }}" =~ $TAG_REGEX
55+
]]; then
56+
# Run the other jobs.
57+
RESULT="true"
58+
else
59+
# There is no need to run the other jobs.
60+
RESULT="false"
61+
fi
62+
63+
echo "result=$RESULT" >> $GITHUB_OUTPUT
64+
3765
build:
3866
name: build (${{ matrix.config.os }})
67+
needs: run-determination
68+
if: needs.run-determination.outputs.result == 'true'
3969
strategy:
4070
matrix:
4171
config:

.github/workflows/check-certificates.yml

+42-4
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ name: Check Certificates
33

44
# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows
55
on:
6+
create:
67
push:
78
paths:
89
- '.github/workflows/check-certificates.ya?ml'
@@ -20,12 +21,49 @@ env:
2021
EXPIRATION_WARNING_PERIOD: 30
2122

2223
jobs:
24+
run-determination:
25+
runs-on: ubuntu-latest
26+
outputs:
27+
result: ${{ steps.determination.outputs.result }}
28+
steps:
29+
- name: Determine if the rest of the workflow should run
30+
id: determination
31+
run: |
32+
RELEASE_BRANCH_REGEX="refs/heads/[0-9]+.[0-9]+.x"
33+
REPO_SLUG="arduino/arduino-ide"
34+
if [[
35+
(
36+
# Only run on branch creation when it is a release branch.
37+
# The `create` event trigger doesn't support `branches` filters, so it's necessary to use Bash instead.
38+
"${{ github.event_name }}" != "create" ||
39+
"${{ github.ref }}" =~ $RELEASE_BRANCH_REGEX
40+
) &&
41+
(
42+
# Only run when the workflow will have access to the certificate secrets.
43+
# This could be done via a GitHub Actions workflow conditional, but makes more sense to do it here as well.
44+
(
45+
"${{ github.event_name }}" != "pull_request" &&
46+
"${{ github.repository }}" == "$REPO_SLUG"
47+
) ||
48+
(
49+
"${{ github.event_name }}" == "pull_request" &&
50+
"${{ github.event.pull_request.head.repo.full_name }}" == "$REPO_SLUG"
51+
)
52+
)
53+
]]; then
54+
# Run the other jobs.
55+
RESULT="true"
56+
else
57+
# There is no need to run the other jobs.
58+
RESULT="false"
59+
fi
60+
61+
echo "result=$RESULT" >> $GITHUB_OUTPUT
62+
2363
check-certificates:
2464
name: ${{ matrix.certificate.identifier }}
25-
# Only run when the workflow will have access to the certificate secrets.
26-
if: >
27-
(github.event_name != 'pull_request' && github.repository == 'arduino/arduino-ide') ||
28-
(github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == 'arduino/arduino-ide')
65+
needs: run-determination
66+
if: needs.run-determination.outputs.result == 'true'
2967
runs-on: ubuntu-latest
3068
strategy:
3169
fail-fast: false

.github/workflows/check-i18n-task.yml

+29
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ env:
66

77
# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows
88
on:
9+
create:
910
push:
1011
paths:
1112
- '.github/workflows/check-i18n-task.ya?ml'
@@ -22,7 +23,35 @@ on:
2223
repository_dispatch:
2324

2425
jobs:
26+
run-determination:
27+
runs-on: ubuntu-latest
28+
outputs:
29+
result: ${{ steps.determination.outputs.result }}
30+
permissions: {}
31+
steps:
32+
- name: Determine if the rest of the workflow should run
33+
id: determination
34+
run: |
35+
RELEASE_BRANCH_REGEX="refs/heads/[0-9]+.[0-9]+.x"
36+
TAG_REGEX="refs/tags/.*"
37+
# The `create` event trigger doesn't support `branches` filters, so it's necessary to use Bash instead.
38+
if [[
39+
("${{ github.event_name }}" != "create" ||
40+
"${{ github.ref }}" =~ $RELEASE_BRANCH_REGEX) &&
41+
! "${{ github.ref }}" =~ $TAG_REGEX
42+
]]; then
43+
# Run the other jobs.
44+
RESULT="true"
45+
else
46+
# There is no need to run the other jobs.
47+
RESULT="false"
48+
fi
49+
50+
echo "result=$RESULT" >> $GITHUB_OUTPUT
51+
2552
check:
53+
needs: run-determination
54+
if: needs.run-determination.outputs.result == 'true'
2655
runs-on: ubuntu-latest
2756

2857
steps:

docs/internal/release-procedure.md

+45-11
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Release Procedure
22

3+
The ["trunk-based" development strategy](https://trunkbaseddevelopment.com/) is used for releases of Arduino IDE. A branch named `<major>.<minor>.x` (where `<major>.<minor>` is the major and minor version numbers), is created for each minor version series. Release tags (both pre-release and production) are created from these branches. This allows a release to be created from a select subset of the commits in the `main` branch, [cherry-picked](https://git-scm.com/docs/git-cherry-pick) to the release branch.
4+
35
## Steps
46

57
The following are the steps to follow to make a release of Arduino IDE:
@@ -39,28 +41,60 @@ If the version number of the previous release was `2.0.1`:
3941
- If this is considered a minor release (non-breaking changes to the "API"), the `version` values must be changed to `2.1.0`.
4042
- If this is considered a major release (breaking changes to the "API"), the `version` values must be changed to `3.0.0`.
4143

42-
### 4. 🚢 Create the release on GitHub
44+
### 4. 🍒 Prepare release branch
45+
46+
#### Create
47+
48+
A new release branch must be created on every minor version bump. For example, if you are making the `2.2.0` release, then it is necessary to create a branch named `2.2.x`. That branch will be used for all subsequent releases in the `2.2` minor version series (e.g., `2.2.1`, `2.2.2`).
49+
50+
#### Update
51+
52+
Push all commits that are to be included in the release to the release branch. This can be a [cherry-picked](https://git-scm.com/docs/git-cherry-pick) subset of the commits from the `main` branch if not all the work from `main` is ready for release.
53+
54+
### 5. ✅ Validate release
55+
56+
#### Evaluate CI status
57+
58+
The checks run by the continuous integration system might provide an indication of a problem that should block the release. Since the code in the release branch doesn't necessarily match to that of the `main` branch, it is essential to check the status of the release branch even when everything is passing in the `main` branch.
59+
60+
1. Open the following URL in your browser:<br />
61+
https://github.com/arduino/arduino-ide/actions
62+
1. Type `branch:<release branch>` (where `<release branch>` is the name of the release branch for this release) in the "**Filter workflow runs**" field of the "**Actions**" page.
63+
1. Press the <kbd>**Enter**</kbd> key.
64+
1. Wait for all in progress workflow runs to finish.
65+
1. Click on the first workflow name on the list at the left side of the page.
66+
1. Check the status of the latest run. If it was not successful, investigate the cause and determine if it is of significance to the release.
67+
1. Repeat the above steps for each of the listed workflows.
68+
69+
#### Beta testing
70+
71+
The "**Arduino IDE**" workflow run that was triggered by the branch creation will contain artifacts that can be used for beta testing.
72+
73+
[More information about beta testing](../contributor-guide/beta-testing.md)
74+
75+
### 6. 🚢 Create the release on GitHub
4376

4477
Then, you need to **create and push the new tag** and wait for the release to appear on [the "**Releases**" page](https://github.com/arduino/arduino-ide/releases).
4578

4679
⚠ Doing this will create a new release and users who already have the IDE installed will be notified from the automatic updater that a new version is available. Do not push the tag if you don't want that.
4780

48-
```text
49-
git checkout main
50-
git pull
51-
git tag -a <YOUR_VERSION> -m "<YOUR_VERSION>"
52-
git push origin <YOUR_VERSION>
53-
```
81+
1. Checkout the release branch in the repository.
82+
1. Run the following commands:
83+
```text
84+
git pull
85+
git tag -a <YOUR_VERSION> -m "<YOUR_VERSION>"
86+
git push origin <YOUR_VERSION>
87+
```
5488

5589
Pushing a tag will trigger a **GitHub Actions** workflow on the `main` branch. Check the "**Arduino IDE**" workflow and see that everything goes right. If the workflow succeeds, a new release will be created automatically and you should see it on the ["**Releases**"](https://github.com/arduino/arduino-ide/releases) page.
5690

57-
### 5. ⬆️ Bump version metadata of packages
91+
### 7. ⬆️ Bump version metadata of packages
5892

5993
In order for the version number of the tester and nightly builds to have correct precedence compared to the release version, the `version` field of the project's `package.json` files must be given a patch version bump (e.g., `2.0.1` -> `2.0.2`) **after** the creation of the release tag.
6094

6195
Follow the instructions for updating the version metadata [**here**](#update-version-metadata).
6296

63-
### 6. 📄 Create the changelog
97+
### 8. 📄 Create the changelog
6498

6599
**Create GitHub issues for the known issues** that we haven't solved in the current release:
66100

@@ -79,7 +113,7 @@ Add a list of mentions of GitHub users who contributed to the release in any of
79113

80114
Add a "**Known Issues**" section at the bottom of the changelog.
81115

82-
### 7. ✎ Update the "**Software**" Page
116+
### 9. ✎ Update the "**Software**" Page
83117

84118
Open a PR on the [bcmi-labs/wiki-content](https://github.com/bcmi-labs/wiki-content) repository to update the links and texts.
85119

@@ -96,7 +130,7 @@ When the deploy workflow is done, check if links on the "**Software**" page are
96130

97131
https://www.arduino.cc/en/software#future-version-of-the-arduino-ide
98132

99-
### 8. 😎 Brag about it
133+
### 10. 😎 Brag about it
100134

101135
- Ask in the `#product_releases` **Slack** channel to write a post for the social media and, if needed, a blog post.
102136
- Post a message on the forum (ask @per1234).<br />

0 commit comments

Comments
 (0)