Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automate release #480

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open

Automate release #480

wants to merge 10 commits into from

Conversation

Mightyjo
Copy link
Contributor

@Mightyjo Mightyjo commented Mar 27, 2021

Migrate the CI workflow to Github Actions.
Automate the release workflow based on the Milestone system. Closes #337
Automate artifact signing with detached GPG subkeys in Github repository secrets (not in the repo).

@Mightyjo
Copy link
Contributor Author

Forgot to mention, you can safely leave out commit 5e21333 if you want. It fixes a file permission oddity that was stopping distcheck on my WSL2 VM's tortured filesystem.

If I'd thought about it, I'd have tested the build without that commit on Github Actions before sending the PR.

@westes
Copy link
Owner

westes commented Jun 5, 2021

This is my next priority. Thank you for submiting this. I'll comb through and make sure it does what we want.

@Mightyjo
Copy link
Contributor Author

Mightyjo commented Jun 5, 2021

Coolness. There's a bit of setup for the release workflow with the pgp keys and your git secrets. The push and PR workflows are easy though.

@GitMensch
Copy link
Contributor

@westes wrote:

This is my next priority. Thank you for submiting this. I'll comb through and make sure it does what we want.

That's quite cool, I suggest linking #337 to this PR to auto-close the issue on pull.

Even more cool as #337 was specified as "release is very likely to get done and published once this is available" and it is really hard to follow all the changes since the last release (more than 4 years ago) [and only very few people use a snapshot build - and a new release will also be taken up by the package maintainers].

@Mightyjo
Copy link
Contributor Author

I've been leaving the linking keyword out of my PR messages. Thanks for getting me to look that up!

Copy link
Owner

@westes westes left a comment

Choose a reason for hiding this comment

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

it's not just all about the milestones; sometimes patches come in via email or things can get commited directly to master.

How do you anticipate handling those cases?

I'm willing to enforce commit message formates if that helps make something automate-able.

But what are your thoughts?

ver=${ver#v}
ver=${ver%-*}
echo "::set-output name=version::$ver"
sed "s/^\(AC_INIT.*generator\],\)\(.*\)\(,\[flex-help.*\)$/\1[$ver]\3/" $GITHUB_WORKSPACE/configure.ac >> $GITHUB_WORKSPACE/configure.ac.new
Copy link
Owner

Choose a reason for hiding this comment

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

Since this is running under Ubuntu, we know that sed is GNU sed. why not use sed -i here instead of sed+mv?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am but an egg. I forgot you could do that.

jobs:
build:

runs-on: ubuntu-18.04

Choose a reason for hiding this comment

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

Suggested change
runs-on: ubuntu-18.04
strategy:
fail-fast: false
matrix:
arch: [x64, x86]
os: [ubuntu-18.04, ubuntu-latest]
compiler: [gcc, clang]
runs-on: ${{ matrix.os }}

I was just browsing through and thought I'd suggest some type of matrix... though not necessarily this one. :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Point taken. I'm focusing on the release machinery in this PR but more extensive matrix testing is a good thing. I'd like the matrix test workflow to run early in the integration pipeline so the release workflow can stay streamlined. I'm having to repeat a lot of build code between workflows, though. Ready to learn.

Copy link

@andy5995 andy5995 Jul 21, 2021

Choose a reason for hiding this comment

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

I'm having to repeat a lot of build code between workflows, though. Ready to learn.

I'm not too great with Actions yet... your yml looks pretty good though, a lot more advanced than I have done.

Of course one way to prevent code repetition in these workflow files is using shell scripts, but I didn't see where you could do that in the use-cases you need (I noted one example below where you could).

One thing that might help trim a few lines is to combine some of the name/run lines. You don't need a "name" for every "run". Example:

      - run: ./autogen
      - run: ./configure
      - run: make
      - run: make check
      - run: make distcheck

or

      - run:  |
         ./autogen
         ./configure
         make
         make check
         make distcheck

Or because that sequence of commands is used in build.yml and milestones.yml, put them in a shell script.

- run: sh .github/scripts/build.sh

Choose a reason for hiding this comment

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

Oh, you could probably actually remove the make check since make distcheck does that automatically.

Also, I find that using make V=1 can be handy sometimes

@Mightyjo
Copy link
Contributor Author

it's not just all about the milestones; sometimes patches come in via email or things can get commited directly to master.

How do you anticipate handling those cases?

True enough. Starting with the milestone messages kept the demo manageable. I looked at using git2cl at first but the result seemed too fine-grained for the NEWS file.

I'm willing to enforce commit message formates if that helps make something automate-able.

Some kind of commit message formatting could help. I've been practicing the semantic-release formats on my own work. Their repo has some tools and hooks that can help with adoption and automation.

But what are your thoughts?

I started off trying to summarize the commit log but that got out of hand quickly. At this point I'm imagining the milestones as a release backlog and the NEWS file as a snapshot of the finished board. I should be able to augmenting the milestone issues with some specially-formatted commits within the release window to cover emailed patches and similar cases.

I also preserve any text that's already in NEWS so we could add custom entries to the top before running the release workflow. This was this simplest thing that could possibly work.

Anywho, I expected this would need discussion. I'm all ears.

@nightlark nightlark mentioned this pull request Nov 1, 2021
@Croydon
Copy link

Croydon commented Feb 18, 2022

I think this PR tries to do too much stuff at once and hence is staled.
First introducing CI builds at all would be already a major step forward.
Release automation could be the next step afterwards.

@Mightyjo
Copy link
Contributor Author

Mightyjo commented Feb 18, 2022 via email

@Croydon
Copy link

Croydon commented Mar 27, 2022

I (obviously) can't speak for @westes, but I think this pull request would be easier to grasp/review when the migration of the CI from Travis to GitHub Actions would be split out in an own pull request

Right now, no CI is running at all, since Travis requires regularly to ask for more free credits. Getting CI builds back would be nice

@Mightyjo
Copy link
Contributor Author

I've split the migration to Github Actions out to PR #523. I'll rebase or replace this PR once that one is dealt with.

@Mightyjo Mightyjo force-pushed the automate-release branch from 80d60a5 to cbaa930 Compare May 19, 2022 22:54
@Mightyjo
Copy link
Contributor Author

Rebased the automated release actions after splitting out the codeQL and distcheck actions. Also switched to 'sed -i' as suggested. (I'll handle matrix builds in the build action a little later on.)

The outstanding question from before was here.

it's not just all about the milestones; sometimes patches come in via email or things can get commited directly to master.

How do you anticipate handling those cases?

My milestone_close.rb preserves the existing contents of the NEWS file, so it's feasible to add one-off messages to the top before starting the release. They'll just end up out of order with respect to the Issues.

We could also do something completely different. I mentioned before that I tried several things before hitting on the idea of using Milestones and Issues as progress markers. The trouble is mostly in getting the commit messages for a new release from the GitHub API in a coherent order. I don't think I found the best solution, but I needed more brains to think about it before iterating down a hole.

I'm willing to enforce commit message formats if that helps make something automate-able.

Yeah, this will help. I'm using loosely using this format. If we did adopt that format, we could use semantic-release workflows to build the NEWS and/or ChangeLog.

@GitMensch
Copy link
Contributor

There's currently no CI generated tarball, is it?

If not then can we get it first (making the result of passing make distcheck available (and before running the tests just update the version string to contain the commit date, similar as it is done here)?

@Mightyjo
Copy link
Contributor Author

There's currently no CI generated tarball, is it?

If not then can we get it first (making the result of passing make distcheck available (and before running the tests just update the version string to contain the commit date, similar as it is done here)?

Like unsigned nightlies? That's doable.

I haven't learned to save build products for use by other workflows so I've had to run 'make distcheck' in both the test and release flows. I welcome help on that.

@GitMensch
Copy link
Contributor

Like unsigned nightlies? That's doable.

Yes, that would be very useful for all the peoples visiting this page and don't know enough about the build system and dependencies - just downloading a nightly distribution tarball always helps a lot.
Some people use one key for nightly builds and another for releases, the first used for manual verification, the second also in distributions.

And ideally the same step would be executed and only extended for the milestone closed one - did @westes already decided that this would be the last step before an automated release? [I'm personally a fan of "tagging with a defined name = release"].

Note: I really like automated releases as good as it can be done, but personally think a NEWS entry should consist of user-visible adjustments and deserve entries (from time to time, so it doesn't need to be done all directly before the release) written by a human. All other entries of this workflow seem very good to me.

Maybe the "generate NEWS stub" code could be just committed to the repository and be manually executed as "starter" for a human to check which entries to include in which way if that part is found to be necessary?

@Mightyjo
Copy link
Contributor Author

Some people use one key for nightly builds and another for releases, the first used for manual verification, the second also in distributions.

Totally supportable. Just looks like a second subordinate GPG key in this process.

And ideally the same step would be executed and only extended for the milestone closed one - did @westes already decided that this would be the last step before an automated release? [I'm personally a fan of "tagging with a defined name = release"].

Yep, it's just a different trigger condition at the top of the script. @westes didn't pick the milestone close as the trigger. I guessed at his release process knowing it's easy to change the condition later.

Note: I really like automated releases as good as it can be done, but personally think a NEWS entry should consist of user-visible adjustments and deserve entries (from time to time, so it doesn't need to be done all directly before the release) written by a human. All other entries of this workflow seem very good to me.

Maybe the "generate NEWS stub" code could be just committed to the repository and be manually executed as "starter" for a human to check which entries to include in which way if that part is found to be necessary?

Same. Maybe the automated part should go in the ChangeLog? It's really hard to write/maintain two-part workflows, do I'm reluctant to include commit-pause-resume patterns to get human input. Anywhere we can pull the input from a ready made database is great. Places like the issues and milestone databases seemed perfect.

@GitMensch
Copy link
Contributor

@Croydon just re-asking for a review, because it was missing after the split of the merged CI actions.

@Croydon
Copy link

Croydon commented Mar 3, 2023

@Croydon just re-asking for a review, because it was missing after the split of the merged CI actions.

I'm not entirely sure why you ask me for a review. I don't have any repository rights here or something like that. So my opinion here is just as relevant or irrelevant as that of any other random person here.

But if you ask me, I'm wondering if the amount of automatization is worth the complexity. IMHO adjusting version numbers in the code, writing the changelog and stuff like closing milestones could happen manually, then you add a new git tag for the new version and the CI is creating a GitHub release, the official release downloads and uploads them to the GitHub release (and other targets if desired).

It would still automate the actual publishing part, but no complex magic how useful changelogs can be auto-generated and what changes need to be automatically created and pushed to git.

@Mightyjo
Copy link
Contributor Author

@Croydon fair points about complexity.

I demoed everything I could find a way to automate. I don't expect us to keep it all. For example, I'm satisfied that the ChangeLog and the NEWS file serve different purposes. I can automate collection of the ChangeLog, but writing a good NEWS update is a whole research problem (or we could get a Large Language Model to do it).

Amusingly, if we start producing nightly builds it will be less complicated to update the version numbers because the automatic parts will only touch a date or hashcode at the very end. More thoughts later.

@gruenich
Copy link

@westes What do you think? What steps needs automation and what better remain manual?
I am very egoistic, as I want to see this pull request reviewed and merged in any form as soon as possible. Fingers crossed that we get a flex release in a not too distant future. 💟

@westes
Copy link
Owner

westes commented Apr 30, 2024

Amusingly, if we start producing nightly builds it will be less complicated to update the version numbers because the automatic parts will only touch a date or hashcode at the very end. More thoughts later.

Could you submit a pr for nightly builds then? It would be particularly helpful since we've had a number of recent changes and clearly a release is in the offing.

@Mightyjo
Copy link
Contributor Author

Amusingly, if we start producing nightly builds it will be less complicated to update the version numbers because the automatic parts will only touch a date or hashcode at the very end. More thoughts later.

Could you submit a pr for nightly builds then? It would be particularly helpful since we've had a number of recent changes and clearly a release is in the offing.

Yeah, I'll give it a shot.

@westes
Copy link
Owner

westes commented Apr 30, 2024

Yeah, I'll give it a shot.

Thank you. Just the tar ball that make distcheck would build. Make any assumptions you need to make it easier to do.

@Mightyjo
Copy link
Contributor Author

Mightyjo commented Jun 9, 2024

Quick update to say I'm almost there. This has been interesting. Pretty much every API changed since I wrote the milestone version.

You can see how it's working on my fork. The tarballs are attached to the action runs for Nightly. They persist for 90 days right now. I plan to attach them to tags. Still figuring out that API and the needed token permissions.

@Croydon
Copy link

Croydon commented Jun 9, 2024

I plan to attach them to tags.

In my personal opinion, I wouldn't do that. Nightly builds that create tags or even GitHub Releases just spam everyone watching them in some way (e.g. via notifications)

@Mightyjo
Copy link
Contributor Author

Mightyjo commented Jun 9, 2024

Fair point. I was thinking about how to announce successful nightlies and keep their links together. Ideas welcome!

@westes
Copy link
Owner

westes commented Jun 9, 2024

I'd suggest making a nightly release and replacing files upon successive nightly releases. (There is an action that does that if you wanna go that route.)

@Croydon
Copy link

Croydon commented Jun 9, 2024

I'd suggest making a nightly release and replacing files upon successive nightly releases. (There is an action that does that if you wanna go that route.)

Sounds good and avoids spam :D

Alternatively, it could be a way to create some new nightly/index.html file (or so) with a list of the nightlies for the GitHub Page in the gh-pages. It would then be accessible via https://westes.github.io/flex/nightly/

@Mightyjo
Copy link
Contributor Author

Mightyjo commented Jul 7, 2024

That took longer than I expected.

Nightly builds are working in my fork and uploading to a release/tag called "nightlies". Please take a look at my nightly-build branch, currently my default, over the next couple of days to see the files build up. I'm uploading both "Source" and distro tarballs right now. I'll probably drop the "source" stuff since it's just duplicating what's in git at the named commit hash.

I have a bit more work planned to remove duplicated script chunks from the three workflow files. I'll also refactor/squash a sequence of commits from tonight in which I was chasing my tail over a token permissions SNAFU.

@gruenich
Copy link

What is needed to advance this topic and get it finally merged? A rebase? More feedback? Some reviews?

@westes
Copy link
Owner

westes commented Oct 16, 2024

@gruenich the issues are time and money. I'm working on them both.

@westes westes closed this Oct 16, 2024
@westes westes reopened this Oct 16, 2024
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.

Automate flex release
6 participants