Skip to content

Conversation

@hoffie
Copy link
Member

@hoffie hoffie commented Mar 7, 2022

This is a small, split-out part of the announced autobuild refactoring.

Short description of changes

  • Autobuild: Drop commented out code and duplicate newlines
  • Autobuild: Shorten branch matching syntax
  • Autobuild: Drop comments which repeat step names
  • Autobuild: Unify identation
  • Autobuild: Reorganize, shorten and strip redundant comments
  • Autobuild: Shorten if expressions
    ${{ ... }} is optional for if: entries. Therefore drop it in order to reduce clutter.
  • Autobuild: Line-wrap long if statements
  • Autobuild: Rename uses_codeql -> run_codeql

CHANGELOG: Autobuild: Refactor for better readability

Context: Fixes an issue?

Improve readability/maintenance.

Does this change need documentation? What needs to be documented and how?

No.

Status of this Pull Request

Ready when CI is green.

What is missing until this pull request can be merged?

Ready when CI is green.

Note: I suggest reading individual commit diffs if unsure. git show -w and Github's whitespace-ignoring diff may also help during review.

Checklist

  • I've verified that this Pull Request follows the general code principles
  • I tested my code and it does what I want
  • My code follows the style guide
  • I waited some time after this Pull Request was opened and all GitHub checks completed without errors.
  • I've filled all the content above

@hoffie hoffie added this to the Release 3.9.0 milestone Mar 7, 2022
@hoffie hoffie requested a review from ann0see March 8, 2022 00:04
Copy link
Member

@ann0see ann0see left a comment

Choose a reason for hiding this comment

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

Are you really sure about removing this many comments? Of course the "can also be warn,…" can be removed but the links to the documentation or blog posts should remain. Some comments might be trivial (Checkout code,…)

@ann0see ann0see self-requested a review March 8, 2022 18:17
@hoffie hoffie force-pushed the autobuild-workflow-cleanup branch from 23cd481 to 1608122 Compare March 8, 2022 20:25
Copy link
Member

@ann0see ann0see left a comment

Choose a reason for hiding this comment

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

I think I'm probably commenting a lot about the structure? But please see below:

NOTARIZATION_PASSWORD: ${{ secrets.NOTARIZATION_PASSWORD }}
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}

- name: "Post-Build for ${{ matrix.config.config_name }}"
Copy link
Member

Choose a reason for hiding this comment

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

Should probably be named something like

Move files... But that's not part of this PR though.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, that could indeed be improved to match what's actually done in the step (in another PR).

Comment on lines 260 to 268
- name: "Notarize macOS Release Build"
if: >-
steps.step_cmd3_postbuild.outputs.artifact_1 != '' &&
steps.step_macos_build.outputs.macos_signed == 'true' &&
contains(needs.create_release.outputs.publish_to_release, 'true')
id: notarize-macOS-app
uses: devbotsxyz/xcode-notarize@d7219e1c390b47db8bab0f6b4fc1e3b7943e4b3b
Copy link
Member

Choose a reason for hiding this comment

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

Why is this done after the upload artifact call? Couldn't there also be signed non-release artifacts?

Copy link
Member Author

Choose a reason for hiding this comment

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

Hm, currently it only runs on release builds. It could probably also be run earlier. Not sure if there are any reasons for not signing dev builds, but as this runs on @emlynmac's fork and not on ours anyway, I'm not sure how deeply we should care...? :)

Maybe open a separate issue for that?

Copy link
Member

Choose a reason for hiding this comment

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

@emlynmac could you please comment why this is here and not before any upload has started?

Copy link
Contributor

Choose a reason for hiding this comment

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

This step is to notarize the build, which has to happen after the build is done and the artifacts created.
The signing of the macOS build is a two-step process; build with certs then notarize the full thing with Apple.

Copy link
Member

Choose a reason for hiding this comment

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

Is this basically a step which transfers something (hashes?) to apple?

Copy link
Contributor

Choose a reason for hiding this comment

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

There's a bunch of information about how notarization works here: https://developer.apple.com/documentation/security/notarizing_macos_software_before_distribution

Copy link
Member

@ann0see ann0see Mar 10, 2022

Choose a reason for hiding this comment

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

@hoffie sorry for the small modification request: Could you please add a comment here that this needs to be done after the build is created?

As far as I understand, in theory it could also be put above (but below the build, since it needs the artifact to be somehow sent to Apple)

Copy link
Member Author

Choose a reason for hiding this comment

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

Not sure I understand.
Do you mean that the binaries can only be signed once they're built? That would be rather obvious to me (similar for other instances: We don't explicitly highlight that the build dependencies have to be prepared before the build can start).

Or do you mean that the binaries can only be signed once the artifact has been uploaded to the job? I don't think this is the case (or if it is, I don't understand why). The Notarize step references product-path: deploy/${{ steps.step_cmd3_postbuild.outputs.artifact_1 }}. This looks like a filesystem path to me and not like a job artifact path. So I guess the order could be turned around. Adding a comment which states the contrary would seem strange then :)

Maybe you could send a follow-up PR with a suggested wording?

(In general, I think a PR which touches specific code should leave the code in better state than it was before. However, we should be cautious to avoid trying to push to much additional things which could or should be improved into PRs. PRs are getting large and take lots of iterations until they can get merged...)

Copy link
Member

Choose a reason for hiding this comment

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

Yes sure. @emlynmac should open a PR then since he knows what to do. I think we can move it around - at least from my readings.

NOTARIZATION_PASSWORD: ${{ secrets.NOTARIZATION_PASSWORD }}
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}

- name: "Post-Build for ${{ matrix.config.config_name }}"
Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, that could indeed be improved to match what's actually done in the step (in another PR).

@hoffie hoffie force-pushed the autobuild-workflow-cleanup branch from 1608122 to 5b09e0a Compare March 9, 2022 11:24
outputs:
# Check if we are doing a release or just a normal build.
# This must be done before actually building the app to find out where to upload the binaries and if we need to create a Github release.
name: Create Github release if this is a release build
Copy link
Member Author

@hoffie hoffie Mar 9, 2022

Choose a reason for hiding this comment

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

Looking at the workflow, I think the new name is slightly misleading. This step happens first, before the builds, so it isn't actually creating the Github release, just setting up variables to tell later steps to generate one. So "Prepare" or "Setup" is better, but happy for the rest of the name to be made clearer.

@softins By new name you are referring to the line which this comment is attached to, right?

This job does indeed create the Github release (although without the artifacts, of course). The step some lines below is also named like that.

Example: https://github.com/jamulussoftware/jamulus/runs/5265414702?check_suite_focus=true#step:5:1

Maybe this would be better:

Suggested change
name: Create Github release if this is a release build
name: Create empty Github release if this is a release build

Copy link
Member Author

Choose a reason for hiding this comment

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

Addition: I just realized that the changelog is generated by anaylze_git_references.py. Generating a file in an "analyze_" script certainly violates the principle of least surprise...

As this is both related to this PR and #2471, I think I'll open a separate Issue to track this and work on it when both PRs are merged. I've adjust the name of the analyse_git_reference.py step for now.

Copy link
Member

Choose a reason for hiding this comment

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

Looking at the workflow, I think the new name is slightly misleading. This step happens first, before the builds, so it isn't actually creating the Github release, just setting up variables to tell later steps to generate one. So "Prepare" or "Setup" is better, but happy for the rest of the name to be made clearer.

@softins By new name you are referring to the line which this comment is attached to, right?

This job does indeed create the Github release (although without the artifacts, of course). The step some lines below is also named like that.

Example: https://github.com/jamulussoftware/jamulus/runs/5265414702?check_suite_focus=true#step:5:1

Ah, ok, I misunderstood. I thought it was just preparing variables for later use. So it's actually creating a release container that will later receive the assets.

My only other comment there would be that the name is getting rather long, and becoming more like a comment or description. Can it be made more concise but still accurate?

Copy link
Member

@softins softins Mar 9, 2022

Choose a reason for hiding this comment

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

In fact, another comment. I've just looked at a run and specifically at the Prepare Auto-Build/Release job. It looks like it does more than creating an empty Github release, but also does required steps for non-releases, but skipping the Remove Release and Create Release steps. So I think the chosen job name needs to reflect that. Or am I completely misunderstanding? (still learning about workflows, I admit!)

Copy link
Member Author

@hoffie hoffie Mar 9, 2022

Choose a reason for hiding this comment

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

My only other comment there would be that the name is getting rather long, and becoming more like a comment or description. Can it be made more concise but still accurate?

Hrm, you are right. I struggle to find good wording though. Maybe we should drop the imperative for job-level names.

I've just adjusted it like that:

Suggested change
name: Create Github release if this is a release build
name: Build vars & Github release (if required)

@hoffie hoffie force-pushed the autobuild-workflow-cleanup branch from 1925fa0 to f62af89 Compare March 9, 2022 21:28
@ann0see
Copy link
Member

ann0see commented Mar 9, 2022

BTW: See the nightly: https://github.com/jamulussoftware/jamulus/runs/5487103016?check_suite_focus=true

The Create Release step doesn't even output RELEASE_TITLE

@hoffie hoffie force-pushed the autobuild-workflow-cleanup branch from f62af89 to 149e24a Compare March 9, 2022 22:01
@hoffie hoffie force-pushed the autobuild-workflow-cleanup branch from 149e24a to a9421f2 Compare March 9, 2022 22:17
@ann0see
Copy link
Member

ann0see commented Mar 9, 2022

I think I‘m happy now. It has probably blown up a bit

@hoffie
Copy link
Member Author

hoffie commented Mar 9, 2022

Currently still cleaning up the git history. As @softins had some comments as well I'll wait with merging until tomorrow (or explicit feedback).

@hoffie hoffie force-pushed the autobuild-workflow-cleanup branch 2 times, most recently from 68bfdb2 to 0f970a2 Compare March 9, 2022 22:57
Copy link
Member

@softins softins left a comment

Choose a reason for hiding this comment

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

Looking good. I left a couple of comments regarding step naming, but they are only suggestions, not deal-breakers :)

Approving anyway.

@hoffie hoffie force-pushed the autobuild-workflow-cleanup branch from 0f970a2 to 6d369d4 Compare March 10, 2022 20:19
hoffie and others added 8 commits March 10, 2022 21:20
${{ ... }} is optional for if: entries. Therefore drop it in order to
reduce clutter.

https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idif
Co-authored-by: ann0see <20726856+ann0see@users.noreply.github.com>
Although the build step is only referenced later by Mac-specific steps
it should not be called "step_mac_build" as that suggests that this step
was Mac-only. It isn't, it's the generic step used by all platforms.

Therefore, rename accordingly.
@hoffie hoffie force-pushed the autobuild-workflow-cleanup branch from 6d369d4 to d31bda0 Compare March 10, 2022 20:21
@ann0see
Copy link
Member

ann0see commented Mar 10, 2022

Ok. Ready to merge after Android build is finished.

@ann0see
Copy link
Member

ann0see commented Mar 11, 2022

@hoffie please merge (squash merge?) this if it's finished.

@hoffie
Copy link
Member Author

hoffie commented Mar 11, 2022

squash merge?

Although the PR contains more than a few commits, I'd like to keep it separate to keep the information what was changed for what reasons. I've already squashed all the same-type adjustments (wording improvements are a single commit, for example).

@hoffie hoffie merged commit 7c1c1e9 into jamulussoftware:master Mar 11, 2022
@hoffie hoffie deleted the autobuild-workflow-cleanup branch March 19, 2022 20:23
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.

5 participants