-
Notifications
You must be signed in to change notification settings - Fork 59
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
Make clean respect githubWorkflowOSes #167
Make clean respect githubWorkflowOSes #167
Conversation
0982965
to
68a9ffa
Compare
} finally { | ||
src.close() | ||
} | ||
private def generateCleanContents(runsOnOs: String) = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It can be argued that having one single giant string is easier to work with (due to Scala's string interpolation) rather than splitting it up into multiple variables as its done in this PR however since $
is a reserved character for string interpolation and its very commonly used in github workflow .yml
files all of the escaping of $
would be tedious/somewhat confusing so I opted to do it this way.
409d63a
to
6f3db0e
Compare
| ghapi() { curl --silent --location --user _:$GITHUB_TOKEN "$@"; } | ||
| | ||
| # A temporary file which receives HTTP response headers. | ||
| TMPFILE=$(mktemp) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is another change which is rather than using a hardcoded file location (as was done before) instead we use mktemp
which should work properly under Windows.
As a minor bonus mktemp
is more secure when it comes to the permissions of the created file.
|
8feb0ea
to
d08a3fe
Compare
d08a3fe
to
25cdd44
Compare
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| steps: | ||
| - name: Delete artifacts | ||
| shell: bash {0} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an addition which ensures that the script runs in bash under windows. The {0}
part is here because by default github actions uses set -e
(causing any fail to immediately kill the whole step) and grep on Windows will return an error status code if it cannot find anything causing the entire script to fail, see https://stackoverflow.com/a/73069669
@eed3si9n Do you by any chance have time to look into this? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Okay I am going to go ahead and merge this and then cut a release for |
Resolves: #159
This PR makes it so that the
clean.yml
uses the head value ingithubWorkflowOSes
allowing the clean step to run in environments that only have windows (typically hosted environments and/or projects that only target windows) by putting windows as the first entry ingithubWorkflowOSes
.Thankfully github actions already provides a bash/*nix environment under Windows so only a couple of modifications were needed to make the
clean.yml
script to run on Windows. Unfortunately testing that this script actually runs on a Windows CI is a difficult because you would not only have to merge this PR first to see if it passes but you would also have to change the target of https://github.com/sbt/sbt-github-actions/blob/main/build.sbt#L24 which is not desirable.Instead to test that this PR works, I made a completely separate repo at https://github.com/mdedetrich/test-sbt-github-actions and added a commit so we can at least see that the
clean.yml
is running under Windows.The result can be seen at https://github.com/mdedetrich/test-sbt-github-actions/actions/runs/6350853600 and as you can see it appears to be working fine however @djspiewak if you have time I would look at the changes, particularly #167 (comment) since you wrote the original
clean.yml
just to make sure I didn't miss anything.