Skip to content

Build docs action #378

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

Merged
merged 2 commits into from
Sep 24, 2024
Merged

Conversation

jbourassa
Copy link
Collaborator

@jbourassa jbourassa commented Sep 24, 2024

In #375, I tried re-enabling doc generation on releases by calling the "publish doc" action in the release workflow. That didn't work: the "publish doc" action requires doc to be built beforehand in the CI workflow, but the CI workflow does not run on release.

I'm fixing it by moving the documentation generation from the CI workflow to its own workflow. The new doc workflow runs on push and commit, just like CI. It's desirable that doc generation runs on any commit to catch issues, e.g. this script that ensures documented constants and methods indeed exist:

t.after = -> do
$LOAD_PATH.unshift File.expand_path("../../lib", __FILE__)
require "wasmtime"
errors = []
YARD::Registry.each do |yard_object|
case yard_object.type
when :module
mod = Object.const_get(yard_object.path)
errors << "Not a module: #{mod}" unless mod.is_a?(::Module)
when :class
klass = Object.const_get(yard_object.path)
errors << "Not a class: #{klass}" unless klass.is_a?(::Class)
when :method
namespace = Object.const_get(yard_object.namespace.path)
case yard_object.scope
when :class
namespace.singleton_method(yard_object.name)
when :instance
namespace.instance_method(yard_object.name.to_s)
else
# Unknown scope, we should improve this script
errors << "unknown method scope '#{yard_object.scope}' for #{yard_object.path}"
end
end
rescue NameError => e
errors << "Documented `#{yard_object.path}` not found: \n #{e.message.split("\n").first}"
end
if errors.any?
errors.each { |error| log.warn(error) }
exit 1
end

I tested the workflow by pushing new tags in a fork; it should work this time.

Fixes #377

@@ -94,4 +94,4 @@ namespace :doc do
end
end

task doc: ["compile", "doc:default"]
task doc: ["env:dev", "compile", "doc:default"]
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Unrelated to the issue but that shaved off a few minutes.

bundler-cache: false
bundler-cache: true
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Also unrelated, but that sped up things and I can't see a reason not to use it. It's set to true elsewhere.

@jbourassa jbourassa marked this pull request as ready for review September 24, 2024 14:39
@jbourassa jbourassa merged commit e8f19a9 into bytecodealliance:main Sep 24, 2024
11 checks passed
@jbourassa jbourassa deleted the build-docs-action branch September 24, 2024 21:06
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.

Publish doc and Post Publish doc actions consistently failing
2 participants