Skip to content
This repository has been archived by the owner on Apr 14, 2023. It is now read-only.

Use docker run instead of extra docker build #5

Merged
merged 23 commits into from
Jan 12, 2022
Merged

Conversation

Xuanwo
Copy link
Collaborator

@Xuanwo Xuanwo commented Jan 10, 2022

This PR is a try to remove the docker build steps.

Signed-off-by: Xuanwo <[email protected]>
Signed-off-by: Xuanwo <[email protected]>
Signed-off-by: Xuanwo <[email protected]>
Signed-off-by: Xuanwo <[email protected]>
Signed-off-by: Xuanwo <[email protected]>
@pengx17
Copy link
Owner

pengx17 commented Jan 10, 2022

I am not sure if the steps in GitHub Action can be cached? Logseq build itself will take around 12 minutes, which means if use native workflow a single publish will take at least 12 minutes, compared to ~2 min with the dockerized approach.

@Xuanwo
Copy link
Collaborator Author

Xuanwo commented Jan 10, 2022

I am not sure if the steps in GitHub Action can be cached?

Yes.

GHA supports cache some specified paths, is it enough? Maybe we can cache the build result of logseq?

@pengx17
Copy link
Owner

pengx17 commented Jan 10, 2022

I think one approach is to have two workflows which are similar to the two docker file approach:

  • one is to pre-build Logseq and save the static artifacts with their version as the tag
  • the other one is the executable/shared action workflow, which will download the required artifacts and then run the script

@Xuanwo
Copy link
Collaborator Author

Xuanwo commented Jan 10, 2022

Maybe it's better for us to just docker run directly.

@pengx17
Copy link
Owner

pengx17 commented Jan 10, 2022

Ah, in some of my early attempts I did not manage to run the script outside of a docker build. 😂

@Xuanwo
Copy link
Collaborator Author

Xuanwo commented Jan 10, 2022

I didn't have a good idea on how to handle different versions of logseq/logseq-publish/logsq-publish-action so far.

Here are some quick ideas:

  • Do we need to build a image for every logseq versions?
    • Or just master, nightly and releases versions?
  • How to map the logseq versions to docker image tag?
    • One to one map looks good to you?

Signed-off-by: Xuanwo <[email protected]>
Signed-off-by: Xuanwo <[email protected]>
@Xuanwo Xuanwo changed the title Use native workflows instead Use docker run instead of extra docker build Jan 10, 2022
Signed-off-by: Xuanwo <[email protected]>
@pengx17
Copy link
Owner

pengx17 commented Jan 10, 2022

I think we can keep it simple for now.

  • The Docker build (logseq-publish) can be triggered manually without polling new upstream changes. This is because the published version (web only) is very stable compared to the app. So that there is no need to build it that often.
  • We can also build Logseq version as well, e.g., by building a "0.5.8" tag (however this tag is not buildable because of the colors.js issue recently), when a new version is cut & published.

The user can choose which version of Logseq in his workflow but I guess it does not make much difference though. So I guess we can choose a version for them.

Signed-off-by: Xuanwo <[email protected]>
Signed-off-by: Xuanwo <[email protected]>
Signed-off-by: Xuanwo <[email protected]>
@Xuanwo
Copy link
Collaborator Author

Xuanwo commented Jan 10, 2022

The build result of test can be downloaded here: https://github.com/pengx17/logseq-publish/suites/4886440556/artifacts/139968121

I think this PR is almost ready for review!

PTAL @pengx17

@Xuanwo Xuanwo marked this pull request as ready for review January 10, 2022 16:32
Signed-off-by: Xuanwo <[email protected]>
Signed-off-by: Xuanwo <[email protected]>
@Xuanwo
Copy link
Collaborator Author

Xuanwo commented Jan 10, 2022

image

Signed-off-by: Xuanwo <[email protected]>
@Xuanwo
Copy link
Collaborator Author

Xuanwo commented Jan 10, 2022

I try to add pages for test, but the result is empty. Can you help debug it?

@pengx17
Copy link
Owner

pengx17 commented Jan 11, 2022

I try to add pages for test, but the result is empty. Can you help debug it?

Great! I will take a look today

@pengx17 pengx17 self-requested a review January 11, 2022 02:22
@pengx17
Copy link
Owner

pengx17 commented Jan 11, 2022

I think your approach works fine. I have tested to load a graph with a single pages/contents.md file. The exported www does not show contents in the page. Maybe you can try it again with your notes instead?

pages/contents.md Outdated Show resolved Hide resolved
Signed-off-by: Xuanwo <[email protected]>
@Xuanwo
Copy link
Collaborator Author

Xuanwo commented Jan 11, 2022

It's quiet strange that the output index.html is empty.

action.yml Show resolved Hide resolved
@pengx17
Copy link
Owner

pengx17 commented Jan 11, 2022

I have successfully published my graph using your refactored solution
https://github.com/pengx17/knowledge-garden/runs/4776296332?check_suite_focus=true

@Xuanwo
Copy link
Collaborator Author

Xuanwo commented Jan 12, 2022

All reviews have been addressed. @pengx17 PTAL.

@pengx17
Copy link
Owner

pengx17 commented Jan 12, 2022

:shipit:

@pengx17 pengx17 closed this Jan 12, 2022
@Xuanwo Xuanwo deleted the refactor branch January 12, 2022 07:10
@Xuanwo
Copy link
Collaborator Author

Xuanwo commented Jan 12, 2022

Oops, closed?

@pengx17
Copy link
Owner

pengx17 commented Jan 12, 2022

Sorry, miss clicked the wrong button ... Can you reopen a new PR?

@Xuanwo Xuanwo restored the refactor branch January 12, 2022 07:28
@Xuanwo Xuanwo reopened this Jan 12, 2022
@Xuanwo
Copy link
Collaborator Author

Xuanwo commented Jan 12, 2022

Thanks to git 😆

@pengx17 pengx17 merged commit 097745f into pengx17:main Jan 12, 2022
@Xuanwo Xuanwo deleted the refactor branch January 14, 2022 06:21
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants