-
Notifications
You must be signed in to change notification settings - Fork 10
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
Using MkDocs from Github Actions with Material - Plugins not enabled? #466
Comments
Yeah, you just need to put them in your requirements.txt file This action reads the requirements.txt file and installs all packages listed in there before running (see entrypoint.sh called in the action Dockerfile) (1) shows all of the plugins that were installed into the action from requirements.txt (2) It seems like you have The action doesn't currently support another file/name for requirements, but that would be a pretty easy change. There shouldn't be any need to "enable" a plugin - once it's installed it should be findable by mkdocs. The plugins need to be installed within the action container, which is why your pip install lines aren't working the way you expect. That installs things into the github workflow instance, but that's isolated from the action. |
Thanks Allison, So remove my "BS" from the actions, and just revert to using the Requirements.txt as the only place to call PLugins to be installed? I have been back and forth trying to troubleshoot why I can get Plugins "installed" - but not "enabled" - this is why some parts are commented out. From what you're saying I don't need to enable the plugins via my mkdocs.yml file? |
Yes, the plugin should read from A simple workflow should look something like this
Ah, yes. You do need to add it to |
Maybe a tip for testing: The image published to docker is the same one as the action. You can run it locally for testing docker run --rm -it --network=host -v ${PWD}:/docs --user $(id -u):$(id -g) althack/mkdocs-simple-plugin It should build and serve the site locally through the container |
So this is where I have been seeing the error come thru - not the actual install of the Plugins - but the "call to the hooks" and the subsequent detailed config has been the typical error point. I've now cleaned out the PIP calls and kept it clean in the workflow - testing that now. |
So after the numpy error - rolled back to 2.1.3 and now for some reason it's taking an age to try and complete, instead of under 2 mins it's not 13mins plus and I simply cancelled... It just keeps going: https://github.com/dcaddick/gsd_public/actions/runs/3936269907/jobs/6732667943 So now still scratching my head on how to troubleshoot this correctly - even if I did pull it down local via Docker image (great call though - thanks for the tip) |
WTF needs pandas? That's a rather heavy-weight requirement for document building. The image I use for the action is based on apk to keep it light/quick, maybe pandas needs to be built from source because it's not available as a pre-built? You might be better served with your own workflow instead of using the action? jobs:
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.x
cache: pip
- name: Setup
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Deploy docs
run: |
git fetch origin gh-pages --depth=1 || echo -e "skipping fetch"
mkdocs gh-deploy |
I'm glad you said that - cause this is doing my head in - looks like it's now going round in circles... ;-) |
So I can only assume at this stage I'm disappearing down some almighty rabbit hole? I'm quite happy to reset back to basics and simply see if I can get the Plugins working using any other method - I certainly didn't want to become a monumental "time suck" that this has started to become ;-( Invalid workflow file: .github/workflows/MakeDocsAction.yaml#L11 So this appears to be cache: pip?
|
It's more likely the spacing errors on the lines below it. jobs:
docs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.x
cache: pip
- name: Setup
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Deploy docs
run: |
git fetch origin gh-pages --depth=1 || echo -e "skipping fetch"
mkdocs_simple_gen --deploy I'm also pretty sure those git-xx plugins aren't compatible with this one. This plugin builds docs in a tmp directory which would strip all of the git info. You may be better served just doing what mkdocs expects and placing everything in a /docs folder. And yes, it's likely a rabbit hole. I'd try to build it locally if you can. |
Thanks, stripped it all back & removed all PIP commands + removed all non-essential Plug-ins from reqs.txt BTW - this is without enabling the plugins - just installing them. |
Hi, author of
For document building yes, but I'm assuming when you're working with CSVs / table data and python that you are using pandas anyway. Also re-implementing all those table readers with all the supported options from scratch is not worth the effort for a lighter build..
Would it be possible to copy the |
It's already possible to copy any folder directly into the output.
I'm not positive that just doing that will work appropriately though. I've already updated the docker to use ubuntu instead of alpine which should solve the compile issue #468 |
I've just given that a try - but might have the syntax incorrect? Deploying docs to gh-pages What I used was:
I've also tried this based on the docs here:
Same error :( But by playing around with the spacing (instead of using Tab) I managed to get it to this error, so figuring I'm getting closer? ERROR - Config value 'plugins': Plugin 'simple' option 'include_extensions': Expected type: <class 'list'> but received: <class 'str'>
|
hm, I'll check it out |
I have this set in mkdocs.yml as:
This now flows thru without error at Build time - however I'm not sure it's fixed the original problem? Have I managed to do something wrong?
|
Yeah, I'm pretty sure the copy into tmp is not going to work with the git plugin. I have an experimental branch that uses on_files instead of changing the docs directory https://github.com/athackst/mkdocs-simple-plugin/tree/feat/on-files You can try it in an action by pointing to the commit jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Build and push docs
uses: athackst/mkdocs-simple-plugin@11e81727cdfac8b224da1bb486d7072da6c5cd5d |
Thanks, tested and run the action here https://github.com/dcaddick/gsd_public/actions/runs/4213295511/jobs/7312919312 It does appear to use the git, before having an error, looks like I need to step into trying to run this locally as a docker image later today |
You should remove the include_extensions: [".git/**"] line from your mkdocs.yml file. With this branch you shouldn't need it. |
Doh! Apologies Rerun without error, but there does appear to be some indications that the git didn't come thru? https://github.com/dcaddick/gsd_public/actions/runs/4213383482 |
Checking further in the published pages I can now see that at the bottom of each page it is not correctly reporting the "last update" date of each individual page. It's still a little early on Sunday morning here in Perth, but will dive in a bit deeper today to have a look, thanks for your persistence |
Looks like there's a deprecation warning on the git-authors-plugin. That is probably triggered by python 3.11. You could see if the author has an update for that one. I'm not sure why the other one says it can't find git. Git should be installed in the dockerfile and accessible. None of the files are being moved so git should be reporting the correct status. My best guess is that it might be looking for the git folder a folder above where the docs folder is located? You might want to try adding 'docs_dir: docs' to your mkdocs.yml file. |
Hi Allison, Just checking as still pointing at the experimental branch - looks like you are testing Debian? Regards, |
Hi, first time posting here in Github Issues.
I have managed to use MkDocs & Material via Github Actions to publish a website to Github pages.
And I will freely admit that I'm very dangerous and chiefly code with a chainsaw and sledge hammer...
What I'm finding difficult to understand is how the Plugins work?
In my Github workflow I have understood enough to install plugins via pip here:
MakeDocsAction.yaml
But also curious as to whether or not I should be just able to "add" these to the list via the requirements.txt file?
requirements.txt
Anyway - getting them installed is one thing, easy enough, the hard part that I'm struggling with is getting them enabled?
See here for the mkdocs.yml in root:
mydocs.yml
The only ones I can get running are Search, Simple & Macros - am I doing something really dumb?
Snippet:
I've commented out the Plugins that keep erroring - here is an example of the error "Action"
Action run - with error
I've simply not worried about the Plugins errors and got on with creating the content and figured I'd get around to this at some stage.
Using pip I can consistently get the plugin to "install" but getting it enabled has consistently shown an error similar to this with just the name of the plug-in changing.
I figured it was just me doing something dumb?
The text was updated successfully, but these errors were encountered: