Skip to content

Conversation

@ann0see
Copy link
Member

@ann0see ann0see commented Jul 17, 2021

This was done to avoid running the ci if it's unneeded.

Short description of changes

Avoid running autobuild if only .md files are changed.

Context: Fixes an issue?

Fixes: #1806

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

Internal: Do not run CI if .md files are changed. This was done to avoid unneeded runs of the CI.

Status of this Pull Request

Working implementation

What is missing until this pull request can be merged?
Review from two maintainers.

Checklist

This was done to avoid running the ci if it's unneeded.

Fixes: jamulussoftware#1806
@ann0see ann0see requested a review from hoffie July 17, 2021 20:18
@pljones
Copy link
Collaborator

pljones commented Jul 17, 2021

See comment on #1806.

Copy link
Member

@hoffie hoffie 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 this is fine to do and may speed up PRs which update in-repo documentation (such as COMPILING.md) or Github configs (such as .github/pull_request_template.md).

Before merging, @pljones's concern should be addressed. IMO, it would mainly be a problem if those files are excluded from the build (which I don't think is the case), they are just excluded as a trigger for requiring/starting checks on PRs.

@pljones
Copy link
Collaborator

pljones commented Jul 17, 2021

Looking at the timings, I was going to ask for every commit to trigger the Clang Format check, as it's so fast compared with the builds. So skipping that and running the builds seems counter-intuitive. The CodeQL checks could, perhaps, be skipped - but I don't know how easy it would be to get the scripts to skip just that.

@ann0see
Copy link
Member Author

ann0see commented Jul 25, 2021

I think that's not related to this PR? I'm only excluding the run of Auto-Build on the change of .md files.

@pljones
Copy link
Collaborator

pljones commented Jul 27, 2021

I think that's not related to this PR? I'm only excluding the run of Auto-Build on the change of .md files.

Yes, but that's wrong. The auto-build needs to run if the md files change. Code quality and Jamulus build may not, but the other parts of the run should be needed. So I'd rather this change didn't happen as it gives the wrong direction to the auto-build.

@ann0see
Copy link
Member Author

ann0see commented Jul 27, 2021

Ok. Currently autobuild = create release (is requested by git tag) + build assets and check the build process via CodeQL. All of this only needs to run if changes are made to the jamulus code, not .md files.

What should autobuild do if we change .md files?

@pljones
Copy link
Collaborator

pljones commented Jul 27, 2021

Basically, if the md files don't contribute to what auto build builds, they shouldn't be under change control at all. (At least, not under jamulussoftware/jamulus.)

What do they contribute to the build?

@ann0see
Copy link
Member Author

ann0see commented Jul 27, 2021

What do they contribute to the build?

As far as I know they do not contribute to the build process. That's why I am suggesting not to run auto build if there's a change in these files. That's exactly what this PR is doing. It is not stopping clang-format though.

@pljones
Copy link
Collaborator

pljones commented Jul 28, 2021

the build process.

I said the build, not the process.

@ann0see
Copy link
Member Author

ann0see commented Jul 28, 2021

Ok. So what’s the "build" and what’s the "process" for you?

Just build = just compiling (qmake && make) or from a broader view compiling + packaging?
Process = creating a release, CodeQl, compiling, packaging, uploading binaries?

@pljones
Copy link
Collaborator

pljones commented Jul 29, 2021

The build is what the process of building produces.

@ann0see
Copy link
Member Author

ann0see commented Jul 30, 2021

Ok. So for you the build is the binary file which gets uploaded at the end. .md files don’t contribute to these files.

Could you please exactly clarify what you want not to be changed. What should still run if you e.g. only fix a typo in README.md? Certainly not the CodeQL scanning, building of binaries, packaging,…

@pljones
Copy link
Collaborator

pljones commented Jul 30, 2021

.md files don’t contribute to these files.

OK, so there a some files that should not trigger the autobuild process as they're not in the artifacts the build process produces.

However, I'd rather see an explicitly list of the files than a blanket ban on *.md, as it presumes we will never want to distribute an *.md file with the built artifacts.

If we can base the exclusion on the content of a file (that's under change control and is itself excluded), then that also makes it easier, in future, to add other files.

@ann0see
Copy link
Member Author

ann0see commented Aug 1, 2021

Yes. Good idea.

I think we could use https://github.com/MarceloPrado/has-changed-path

@pljones
Copy link
Collaborator

pljones commented Aug 1, 2021

Mmm... What @MarceloPrado/has-changed-path does is

peter@fs-peter:~/git/Jamulus-wip$ git diff --quiet HEAD~ HEAD ChangeLog; echo $?
1
peter@fs-peter:~/git/Jamulus-wip$ git diff --quiet HEAD~ HEAD '**.md'; echo $?
0
peter@fs-peter:~/git/Jamulus-wip$ git diff --quiet HEAD~ HEAD '**.md' ChangeLog; echo $?
1

So that tells me something...

Let's say I change COMPILING.md, Jamulus.pro and ChangeLog. I'm still going to get told that my commit changed **.md files. But I definitely, definitely, without question, need to run the build because I changed the basic definition of Jamulus - Jamulus.pro - in some way.

OK, so say I have a .buildignore file like (grep extended RE syntax):

^.buildignore$
^ChangeLog$
^.*\.md$

and then I run

$ git diff --name-only a8bcd385..HEAD | wc -l
46
$ git diff --name-only a8bcd385..HEAD | grep -E --file=.buildignore
.github/pull_request_template.md
COMPILING.md
ChangeLog
$ git diff --name-only a8bcd385..HEAD | grep -v -E --file=.buildignore | wc -l
43
$ git diff --name-only a8bcd385..HEAD | grep -q -v -E --file=.buildignore; echo $?
0

0 (true) meaning there were matches - i.e. those 43 lines not excluded.

The actual check would be

$ git diff --name-only HEAD~..HEAD | grep -E --file=.buildignore
ChangeLog
$ git diff --name-only HEAD~..HEAD | grep -q -v -E --file=.buildignore; echo $?
1

1 (false) meaning no files from the last commit were not excluded.

So we could fork has-changed-path and make it do that, instead, I guess (without the echo $? of course). Or add our own.

Or maybe it could just run before the repo checkout step somehow and stop the run (with a "success" value).

@ann0see
Copy link
Member Author

ann0see commented Aug 1, 2021

Or maybe it could just run before the repo checkout step somehow and stop the run (with a "success" value).

Probably that's the easiest option?

TODO:

  • Clarify which files can be excluded (CONTRIBUTING.md, COMPILING.md, SECURITY.md, README.md, RELEASE-PROCESS.md TRANSLATING.md, COPYING (?), /tools/* [at least for now], .gitignore)
  • Research how to successfully stop CI
  • Write a shell script which aborts the build process if these files were changed
  • Close this PR and open a new one

@ann0see
Copy link
Member Author

ann0see commented Sep 5, 2021

Closing since #1974 should be used as discussion

@ann0see ann0see closed this Sep 5, 2021
@ann0see ann0see deleted the feature/no-run-ci-on-md branch February 27, 2022 09:59
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.

Don’t run CI if only .md files are pushed

3 participants