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

Publish spec for generic-table-dev branch in CI #436

Open
chrispsommers opened this issue Jun 30, 2023 · 5 comments
Open

Publish spec for generic-table-dev branch in CI #436

chrispsommers opened this issue Jun 30, 2023 · 5 comments
Assignees

Comments

@chrispsommers
Copy link
Collaborator

chrispsommers commented Jun 30, 2023

generic-table-dev branch will be a long-livid working branch with significant specification additions. To facilitate community participation and review, we should publish this version to GitHub pages along with main. We can do this a couple different ways:

Once we get a spec published, we can put a link to it on the main README.

@antoninbas
Copy link
Member

Renaming the workflow to something more generic and adding the new branch as a trigger seems like a good idea to me.
If you want the spec to be accessible under p4.org, you will need @jnfoster to help you out. He came up with a Javascript-based solution to make it possible.
If you're happy with the S3 link, you can just use that directly.

@chrispsommers
Copy link
Collaborator Author

Thanks, Antonin, I can try that. Let's see if @jnfoster has anything to add. Add the workflow and updating the S3 link are separate things which can be in one PR or two.

@antoninbas
Copy link
Member

Sorry I wasn't clear.
You are already getting a S3 link today: https://s3-us-west-2.amazonaws.com/p4runtime/ci/generic-table-dev/P4Runtime-Spec.html
If you update the workflow, you will get another S3 link: https://s3-us-west-2.amazonaws.com/p4runtime/docs/generic-table-dev/P4Runtime-Spec.html (ci/ is replaced with docs/)
But in order to get a p4.org link (e.g., https://p4.org/p4-spec/docs/p4runtime-spec-generic-table-dev-html-version.html) to work and point to the version of the spec stored in Github pages, you will need Nate's help (in addition to modifying the workflow).

Note that the version stored in S3 and the version that would be stored in Github pages is the same. So one could argue that https://s3-us-west-2.amazonaws.com/p4runtime/ci/generic-table-dev/P4Runtime-Spec.html is sufficient.

@jnfoster
Copy link

jnfoster commented Jul 1, 2023

Here's what we did for the P4 language spec.

The p4.org web server has these static pages:

p4-16-working-draft.html:

<!DOCTYPE html>
<html>
<head>
<script>
const url = "https://raw.githubusercontent.com/p4lang/p4-spec/gh-pages/docs/P4-16-working-spec.html";  
const req = new XMLHttpRequest();
req.open("GET", url, true);
req.onload = (_) => {
    const doc = document.open("text/html", "replace");
    doc.write( req.response );
    doc.close();
};
req.send(null)
</script>
</head>
<body></body>
</html>

p4-16-working-draft-pdf.html

<!DOCTYPE html>
<html>
<head>
<script>
const url = "https://raw.githubusercontent.com/p4lang/p4-spec/gh-pages/docs/P4-16-working-spec.pdf";
const req = new XMLHttpRequest();
req.open("GET", url, true);
req.responseType = "arraybuffer";
req.onload = (_) => {
  const blob = new Blob([new Uint8Array(req.response)], { type: "application/pdf" });
  var newUrl = URL.createObjectURL(blob);
  window.location.href = newUrl;
};
req.send(null);
</script>
</head>
<body>
</body>
</html>

And there is a script that automatically builds these GitHub Pages-hosted versions on every commit to the main branch of the repository. The only two downsides I see are (1) it relies on JavaScript, and (2) the URL for the PDF becomes a random string made up by the browser. But I'm not losing sleep over either one...

As @antoninbas said, you could shift to GitHub Pages URLs, or just as well use the S3-hosted URLs... it should work either way.

@chrispsommers
Copy link
Collaborator Author

@jnfoster thanks, I'll look into this once we have a spec to publish!

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

No branches or pull requests

4 participants