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

[Vue] Adding a "build vue" github action to build vue files #18080

Merged
merged 32 commits into from Oct 20, 2021

Conversation

diosmosis
Copy link
Member

Description:

I haven't used github actions before so this is mostly a guess. @sgiehl can you take a look and see if there's anything off? I'm also not entirely sure how to test this. Unless I can invoke the action in this PR w/o merging into 4.x-dev?

Review

@diosmosis diosmosis added this to the 4.6.0 milestone Sep 29, 2021
@diosmosis diosmosis marked this pull request as draft September 29, 2021 21:51
@sgiehl
Copy link
Member

sgiehl commented Sep 30, 2021

It can only be executed/tested when it's in the base branch. But you could create a fork where you add the action in the base branch to test it on the fork.

@diosmosis diosmosis added the Needs Review PRs that need a code review label Oct 12, 2021
@diosmosis diosmosis marked this pull request as ready for review October 12, 2021 01:30
@diosmosis
Copy link
Member Author

@sgiehl / @tsteur this is ready for review. The action will now always run for every PR, build vue files, and if there are changes, will push to the PR so the files are always up to date.

@tsteur
Copy link
Member

tsteur commented Oct 13, 2021

@diosmosis looks overall good to me. Might wait with merging until @sgiehl is back from holidays.

Sometimes there might be merge conflicts when different PR changed files in a same plugin etc. In that case we simply need to rebase 4.x-dev into the branch, possibly resolve merge conflicts manually (probably would need to call the build command ourselves) and commit again?

Not sure if I fully understand what the action does.

@diosmosis
Copy link
Member Author

Not sure if I fully understand what the action does.

It just runs vue:build every time a PR is updated, and if there are changes, commits them (in case a developer forgets to re-compile).

Sometimes there might be merge conflicts when different PR changed files in a same plugin etc. In that case we simply need to rebase 4.x-dev into the branch, possibly resolve merge conflicts manually (probably would need to call the build command ourselves) and commit again?

Mostly, yes. The UMD files don't need to be looked at, other merge conflicts have to be handled, then either run build manually, or push and this command would build again. It doesn't solve the case where the merge is fine except for the UMD files which we just want to build again. Not sure there's a way around that.

.github/workflows/buildvue.yml Outdated Show resolved Hide resolved
.github/workflows/buildvue.yml Show resolved Hide resolved
@diosmosis
Copy link
Member Author

@sgiehl updated the pr

exit 1;
fi

VUE_FILES_MODIFIED=$(git diff HEAD^ --name-only plugins/*/vue/**/* | wc -l)
Copy link
Member

Choose a reason for hiding this comment

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

wouldn't this only look at the last commit? So if someone pushes multiple commits including some vue files, but the last commit doesn't contain any it would abort here?

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok, checking the base branch now. So it will always rebuild even if the last set of commits doesn't modify vue file, but somewhere the PR does.

Copy link
Member Author

Choose a reason for hiding this comment

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

ping @sgiehl

Copy link
Member Author

Choose a reason for hiding this comment

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

actually, nvm, it seems non-trivial to be able to reference commits/branches before the checkout command is run

@diosmosis
Copy link
Member Author

@sgiehl ok, it's working now

@@ -0,0 +1,137 @@
name: Build Vue files

on:
Copy link
Member

Choose a reason for hiding this comment

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

Might make sense to make it possible to manually trigger that action for a branch maybe:

Suggested change
on:
on:
workflow_dispatch:

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think this makes sense, since right now it will always run. I think it's better not to have to think about when it should be run? Especially since this is a safeguard for when people have already forgotten. If the command doesn't work for some reason, we can always build manually until its fixed.

Copy link
Member

@sgiehl sgiehl left a comment

Choose a reason for hiding this comment

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

Left another comment. Otherwise I guess it looks fine. Hard to test though. So guess we should merge and adjust it later if anything doesn't work as expected.

@diosmosis
Copy link
Member Author

@sgiehl left a reply above. @tsteur do you want to take a look at this as well?

@tsteur
Copy link
Member

tsteur commented Oct 20, 2021

@diosmosis had a very quick look and looks all good to me. Looks good to merge to me and we can always change things as needed IMO

@diosmosis diosmosis merged commit 56f885d into 4.x-dev Oct 20, 2021
@diosmosis diosmosis deleted the vue-build-action branch October 20, 2021 20:15
@justinvelluppillai justinvelluppillai added the not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org. label Nov 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Review PRs that need a code review not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants