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

Use GitHubActionsLogger when building docs #16

Merged
merged 10 commits into from
Sep 28, 2021

Conversation

ericphanson
Copy link
Member

@ericphanson ericphanson commented Aug 28, 2021

This lets us get inline annotations for doctest errors:

Screenshot 2021-08-28 at 15 01 50

(well, that requires a small fix in Documenter and in GitHubActions.jl as well).

Tested here: https://github.com/ericphanson/VisualStringDistances.jl/runs/3450753006?check_suite_focus=true

Not sure if this should behind a setting (or opt-out), and if the use of the global env is the right way to go. (One way to opt-out though is to just set whatever logger you want yourself inside docs/make.jl -- so I think it kind of makes sense that the default should be a GitHubActionsLogger rather than a ConsoleLogger).

@ericphanson ericphanson requested a review from a team as a code owner August 28, 2021 14:26
@ericphanson
Copy link
Member Author

bump

Copy link
Member

@SaschaMann SaschaMann left a comment

Choose a reason for hiding this comment

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

I don't know if using the global env is ideal either. Using the GHA logger seems like a sensible default to me, I'd say we can add an opt out if someone complains? :D

@ericphanson
Copy link
Member Author

Yeah-- I think probably the global env is better than messing with the users local environment, though maybe we could do something like make a new environment in a tempdir, install the logger there, and then put that env in the JULIA_LOAD_PATH, and run the docs build with that? Then maybe even if the user is doing something with the global env elsewhere in the workflow we aren't messing with that either.

@SaschaMann
Copy link
Member

Sounds good to me though I don't know pkg workflows like that well enough to understand if there are any potential side effects.

@SaschaMann
Copy link
Member

Should we merge this as is or switch to the temporary env like you suggested? I'm happy with either

@ericphanson
Copy link
Member Author

I was thinking about that too— I think merging is fairly safe in that it’s unlikely folks are using the global env in a way in other steps of their job that will clash with us installing the low-dependency GitHubActions.jl, and that the fancier solution (temp env pushed into the load path) has the risk of bugs since it is more complex and I understand it less.

However I’m pretty sure it’s the more “correct” approach in that it’s more isolated.

so… I’m in favor of just merging because I think it’ll be fine and we can address problems if they arise. But if other people would prefer the more isolated approach I can do that.

@DilumAluthge
Copy link
Member

I don't feel particularly strongly, but I would lean towards "temp environment pushed to the load path".

@DilumAluthge
Copy link
Member

Instead of pushing to the load path, you could just Pkg.activate the temp environment while you build the docs.

@ericphanson
Copy link
Member Author

The most isolated thing would be to do what VSCode does and vendor the code of GitHubActions.jl (and it's dependency, JSON.jl) to avoid participating in the package environment altogether. But that seems a bit extreme...

@ericphanson
Copy link
Member Author

Instead of pushing to the load path, you could just Pkg.activate the temp environment while you build the docs.

We need to activate the docs environment though

@DilumAluthge
Copy link
Member

Instead of pushing to the load path, you could just Pkg.activate the temp environment while you build the docs.

We need to activate the docs environment though

Ah fair enough.

@DilumAluthge
Copy link
Member

The most isolated thing would be to do what VSCode does and vendor the code of GitHubActions.jl (and it's dependency, JSON.jl) to avoid participating in the package environment altogether. But that seems a bit extreme...

That's not a bad idea.

@ericphanson
Copy link
Member Author

ericphanson commented Sep 27, 2021

Ok, I pushed a commit to use a separate environment for GitHubActions.jl. Now I'll try and test this (ericphanson/VisualStringDistances.jl#16).

@ericphanson
Copy link
Member Author

It works! See https://github.com/ericphanson/VisualStringDistances.jl/pull/16/files to see the beautiful annotation (press a if you don't see it), and https://github.com/ericphanson/VisualStringDistances.jl/runs/3726060940?check_suite_focus=true#step:5:14 to confirm we are using our own environment.

action.yml Outdated Show resolved Hide resolved
action.yml Outdated
- run: |
# The Julia command that will be executed
julia_cmd=( julia --color=yes --project=docs/ docs/make.jl )
julia_cmd=( julia --color=yes --code-coverage --project=docs/ -e '
Copy link
Member Author

Choose a reason for hiding this comment

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

oh, I should call out the --code-coverage flag is a separate addition here. I can split that into a separate PR if desired. The reason I think it's really useful is that it means you can get coverage from doctests just running the process-coverage action after.

Copy link
Member

Choose a reason for hiding this comment

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

A separate PR or two separate commits would be nice so that we can link to them in the release notes.

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, I took it out here so this one can be squash-merged and then I’ll make a separate PR to add it

action.yml Outdated Show resolved Hide resolved
Co-authored-by: Fredrik Ekre <[email protected]>
action.yml Outdated Show resolved Hide resolved
Co-authored-by: Fredrik Ekre <[email protected]>
@ericphanson
Copy link
Member Author

ericphanson commented Sep 27, 2021

Arg, I wasn't testing on julia 1.0 like I thought I was (because I wasn't quoting the version number like the docs say to do). In particular I don't think Pkg.add(; shared=true) is supported (https://github.com/ericphanson/VisualStringDistances.jl/runs/3726570300?check_suite_focus=true). Hm...

action.yml Outdated Show resolved Hide resolved
action.yml Show resolved Hide resolved
Co-authored-by: Fredrik Ekre <[email protected]>
@ericphanson
Copy link
Member Author

Things seem to be working on 1.0 (https://github.com/ericphanson/VisualStringDistances.jl/runs/3726621915), and with @fredrikekre's suggestions, our addition of the logger is pretty well isolated from the docs script, so this is good to go from my end.

action.yml Outdated Show resolved Hide resolved
@SaschaMann SaschaMann merged commit 87af678 into julia-actions:master Sep 28, 2021
@ericphanson ericphanson deleted the eph/gha_logger branch September 28, 2021 10:26
@SaschaMann
Copy link
Member

Tagged a release: https://github.com/julia-actions/julia-docdeploy/releases/tag/v1.2.0

Thanks everyone :)

@ericphanson
Copy link
Member Author

We are getting close to fulfulling all my doctest ambitions 😄 https://github.com/users/ericphanson/projects/1

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.

4 participants