-
Notifications
You must be signed in to change notification settings - Fork 39
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
Set up documentation website generation and deployment #253
Changes from 27 commits
a2c547c
1d73f70
0d95718
964ec64
45f7703
087f520
378bfff
7d384f1
1033164
c9eae04
e800d23
2521fe5
f62b632
8b1f2ab
4ba8dd2
471bb6f
9890367
a0619f6
e2adb4a
d295e60
aa045b5
67e2f07
ed33906
baee39a
db0dc5d
1b5220a
ade5782
5a0c65e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: Update `error-prone.picnic.tech` website content | ||
on: | ||
pull_request: | ||
push: | ||
branches: [$default-branch] | ||
permissions: | ||
contents: read | ||
pages: write | ||
id-token: write | ||
concurrency: | ||
group: pages | ||
cancel-in-progress: true | ||
jobs: | ||
build: | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Check out code | ||
uses: actions/[email protected] | ||
- name: Configure Github Pages | ||
uses: actions/[email protected] | ||
- name: Generate documentation | ||
run: ./generate-docs.sh | ||
- name: Build website with Jekyll | ||
uses: actions/[email protected] | ||
with: | ||
source: website/ | ||
destination: ./_site | ||
- name: Validate HTML output | ||
uses: anishathalye/[email protected] | ||
with: | ||
directory: ./_site | ||
check_external_hash: false | ||
- name: Upload website as artifact | ||
uses: actions/[email protected] | ||
deploy: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it would be clearer to have a newline between these two parts. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Indentation already takes care of that. We also don't do that above, or in |
||
if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch) | ||
needs: build | ||
runs-on: ubuntu-22.04 | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
steps: | ||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/[email protected] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
<div align="center"> | ||
|
||
<picture> | ||
<source media="(prefers-color-scheme: dark)" srcset="logo-dark.svg"> | ||
<source media="(prefers-color-scheme: light)" srcset="logo.svg"> | ||
<img alt="Error Prone Support logo" src="logo.svg" width="50%"> | ||
</picture> | ||
<picture> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A pity, but when using the readme for our website, you can't mix HTML and Markdown. That is normal behaviour, but apparently was okay on GitHub's flavoured Markdown before. |
||
<source media="(prefers-color-scheme: dark)" srcset="website/assets/images/logo-dark.svg"> | ||
<source media="(prefers-color-scheme: light)" srcset="website/assets/images/logo.svg"> | ||
<img alt="Error Prone Support logo" src="website/assets/images/logo.svg" width="50%"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Changed the path to the website assets for the logo, s.t. we only store it in 1 place, |
||
</picture> | ||
</div> | ||
|
||
# Error Prone Support | ||
|
||
|
@@ -24,8 +24,6 @@ focussing on maintainability, consistency and avoidance of common pitfalls. | |
[Developing Error Prone Support](#-developing-error-prone-support) • | ||
[How it works](#-how-it-works) • [Contributing](#%EF%B8%8F-contributing) | ||
|
||
</div> | ||
|
||
--- | ||
|
||
## ⚡ Getting started | ||
|
@@ -201,9 +199,9 @@ Want to report or fix a bug, suggest or add a new feature, or improve the | |
documentation? That's awesome! Please read our [contribution | ||
guidelines][contributing]. | ||
|
||
[bug-checks]: error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/ | ||
[bug-checks-identity-conversion]: error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/IdentityConversion.java | ||
[contributing]: CONTRIBUTING.md | ||
[bug-checks]: https://github.com/PicnicSupermarket/error-prone-support/blob/master/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/ | ||
[bug-checks-identity-conversion]: https://github.com/PicnicSupermarket/error-prone-support/blob/master/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/IdentityConversion.java | ||
[contributing]: https://github.com/PicnicSupermarket/error-prone-support/blob/master/CONTRIBUTING.md | ||
[error-prone-bugchecker]: https://github.com/google/error-prone/blob/master/check_api/src/main/java/com/google/errorprone/bugpatterns/BugChecker.java | ||
[error-prone-fork-jitpack]: https://jitpack.io/#PicnicSupermarket/error-prone | ||
[error-prone-fork-repo]: https://github.com/PicnicSupermarket/error-prone | ||
|
@@ -215,7 +213,7 @@ guidelines][contributing]. | |
[google-java-format]: https://github.com/google/google-java-format | ||
[idea-288052]: https://youtrack.jetbrains.com/issue/IDEA-288052 | ||
[license-badge]: https://img.shields.io/github/license/PicnicSupermarket/error-prone-support | ||
[license]: LICENSE.md | ||
[license]: https://github.com/PicnicSupermarket/error-prone-support/blob/master/LICENSE.md | ||
[maven-central-badge]: https://img.shields.io/maven-central/v/tech.picnic.error-prone-support/error-prone-support?color=blue | ||
[maven-central-search]: https://search.maven.org/artifact/tech.picnic.error-prone-support/error-prone-support | ||
[maven]: https://maven.apache.org | ||
|
@@ -224,5 +222,5 @@ guidelines][contributing]. | |
[pitest-maven]: https://pitest.org/quickstart/maven | ||
[pr-badge]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg | ||
[refaster]: https://errorprone.info/docs/refaster | ||
[refaster-templates-bigdecimal]: error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/BigDecimalTemplates.java | ||
[refaster-templates]: error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/ | ||
[refaster-templates-bigdecimal]: https://github.com/PicnicSupermarket/error-prone-support/blob/master/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/BigDecimalTemplates.java | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Absolute paths are required, as the same page is used to service our website. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Clear! (I should probably just test this, but) will the build fail if we accidentally reintroduce a relative URL? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Exactly why I introduced There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Certainly! (And we shouldn't stop there. I made a note to also introduce |
||
[refaster-templates]: https://github.com/PicnicSupermarket/error-prone-support/blob/master/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/usr/bin/env bash | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll push some suggestions for this file. (Not relying on the side-effect of |
||
|
||
set -e -u -o pipefail | ||
|
||
WEBSITE_FOLDER="website" | ||
HOMEPAGE="${WEBSITE_FOLDER}/index.md" | ||
|
||
configure() { | ||
cd "$(git rev-parse --show-toplevel || echo .)" || exit | ||
} | ||
|
||
generate_homepage() { | ||
echo "Generating ${HOMEPAGE}" | ||
cat > "${HOMEPAGE}" << EOF | ||
--- | ||
layout: default | ||
title: Home | ||
nav_order: 1 | ||
--- | ||
EOF | ||
|
||
cat "README.md" >> ${HOMEPAGE} | ||
|
||
SEDOPTION="-i" | ||
if [[ "$OSTYPE" == "darwin"* ]]; then | ||
SEDOPTION="-i .bak" | ||
fi | ||
sed $SEDOPTION 's/src="website\//src="/g' ${HOMEPAGE} | ||
sed $SEDOPTION 's/srcset="website\//srcset="/g' ${HOMEPAGE} | ||
} | ||
|
||
# Generate the website. | ||
configure | ||
generate_homepage |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Generated by Bundler and Jekyll. | ||
.bundle/ | ||
Gemfile.lock | ||
.jekyll-cache/ | ||
.jekyll-metadata | ||
Comment on lines
+4
to
+5
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't see these Can we drop them? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These, however, are standard practice. See also For example, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay, so it aids certain dev flows. Fine to keep then. |
||
.sass-cache/ | ||
_site/ | ||
vendor/ | ||
|
||
# Generated by `../generate-docs.sh`. | ||
*.bak | ||
index.md |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
layout: default | ||
title: Page not found | ||
permalink: /404 | ||
nav_exclude: true | ||
search_exclude: true | ||
--- | ||
|
||
## Page not found :( | ||
|
||
The requested page could not be found. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
source "https://rubygems.org" | ||
gem "github-pages", "227" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we also fix the Ruby version used? See https://bundler.io/guides/gemfile_ruby.html#specifying-a-ruby-version. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would like to make part of the larger initiative, see #253 (comment) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, I didn't read all of the comments so was just a drive-by comment. SGTM 👍 |
||
gem "html-proofer", "4.4.1" | ||
gem "jekyll-remote-theme", "0.4.3" | ||
gem "rake", "13.0.6" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Error Prone Support website | ||
|
||
This directory contains the majority of the source code that powers | ||
[error-prone.picnic.tech][error-prone-support-website]. The website is | ||
statically generated using [Jekyll][jekyll]. | ||
|
||
# Local development | ||
|
||
To view the website on `localhost`, first follow the [Jekyll installation | ||
instructions][jekyll-docs-installation]. Once done, in this directory execute: | ||
|
||
```sh | ||
bundle install | ||
../generate-docs.sh && bundle exec jekyll serve --livereload | ||
``` | ||
|
||
The website will now be [available][localhost-port-4000] on port 4000. Source | ||
code modifications (including the result of rerunning `../generate-docs.sh`) | ||
will automatically be reflected. (An exception is `_config.yml`: changes to | ||
this file require a server restart.) Subsequent server restarts do not require | ||
running `bundle install`, unless `Gemfile` has been updated in the interim. | ||
|
||
If you are not familiar with Jekyll, be sure to check out its | ||
[documentation][jekyll-docs]. It is recommended to follow the provided | ||
step-by-step tutorial. | ||
|
||
# Deployment | ||
|
||
The website is regenerated and deployed using the | ||
[`deploy-website.yaml`][error-prone-support-website-deploy-workflow] GitHub | ||
Actions workflow any time a change is merged to `master`. | ||
|
||
[error-prone-support-website]: https://error-prone.picnic.tech | ||
[error-prone-support-website-deploy-workflow]: https://github.com/PicnicSupermarket/error-prone-support/actions/workflows/deploy-website.yaml | ||
[jekyll]: https://jekyllrb.com | ||
[jekyll-docs]: https://jekyllrb.com/docs/ | ||
[jekyll-docs-installation]: https://jekyllrb.com/docs/installation/ | ||
[localhost-port-4000]: http://127.0.0.1:4000 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# General configuration. | ||
title: Error Prone Support | ||
logo: assets/images/favicon.svg | ||
url: https://error-prone.picnic.tech | ||
description: >- | ||
japborst marked this conversation as resolved.
Show resolved
Hide resolved
|
||
Error Prone extensions: extra bug checkers and a large battery of Refaster | ||
templates. | ||
|
||
# XXX: Investigate dropping the remote theme by instead managing just-the-docs | ||
# using Bundler. This requires changes to the build setup. The upshot is that | ||
# local and CI build environments would then be in sync. | ||
# https://github.com/PicnicSupermarket/error-prone-support/pull/253#discussion_r982709523 | ||
remote_theme: just-the-docs/[email protected] | ||
plugins: | ||
- jekyll-remote-theme | ||
- jekyll-sitemap | ||
|
||
# Files and directories not to be deployed through GitHub pages. | ||
exclude: | ||
- Gemfile | ||
- Gemfile.lock | ||
- README.md | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I had to add There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Interesting... I did not have that issue 🤔 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't have this issue either. And I also don't see the |
||
- vendor | ||
|
||
# See https://jekyllrb.com/docs/permalinks/#built-in-formats. | ||
permalink: pretty | ||
|
||
# Theme (just-the-docs) configuration. | ||
# See | ||
# https://just-the-docs.github.io/just-the-docs/docs/navigation-structure/#external-navigation-links. | ||
nav_external_links: | ||
- title: Error Prone Support on GitHub | ||
url: https://github.com/PicnicSupermarket/error-prone-support | ||
hide_icon: false | ||
|
||
# SEO configuration. | ||
# See https://jekyll.github.io/jekyll-seo-tag/usage. | ||
social: | ||
name: Picnic | ||
links: | ||
- https://github.com/PicnicSupermarket | ||
- https://twitter.com/picnic | ||
- https://www.linkedin.com/company/picnictechnologies | ||
twitter: | ||
username: picnic | ||
card: summary |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<img src="/assets/images/[email protected]" alt="Picnic Logo" id="logo" /> | ||
|
||
<p align="center"> | ||
Copyright © 2017-2022 Picnic Technologies BV | ||
</p> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<!-- Generated from https://realfavicongenerator.net/ --> | ||
<link rel="apple-touch-icon" sizes="180x180" href="/assets/images/apple-touch-icon.png"> | ||
<link rel="icon" type="image/png" sizes="32x32" href="/assets/images/favicon-32x32.png"> | ||
<link rel="icon" type="image/png" sizes="16x16" href="/assets/images/favicon-16x16.png"> | ||
<link rel="manifest" href="/assets/images/site.webmanifest"> | ||
<link rel="mask-icon" href="/assets/images/safari-pinned-tab.svg" color="#5bbad5"> | ||
<link rel="shortcut icon" href="/favicon.ico"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess this one is not inside There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yep, some (older) browsers assume it's in the root. Also, some scrapers make this assumption. See also https://realfavicongenerator.net/faq#why_icons_in_root If we really don't want to have in the root, we could move it and disable the favicon check for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, I mean "is there a way to convince Jekyll to put it into the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Personally, I'm not sure if that's any better. We're already in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ack, I'll not make a further point of it then. |
||
<meta name="msapplication-TileColor" content="#da532c"> | ||
<meta name="msapplication-config" content="/assets/images/browserconfig.xml"> | ||
<meta name="theme-color" content="#ffffff"> | ||
|
||
<!-- Support light and dark mode, as it's not natively supported. | ||
See https://github.com/just-the-docs/just-the-docs/issues/234. --> | ||
<link rel="stylesheet" href="{{ '/assets/css/just-the-docs-light.css' | relative_url }}" | ||
media="(prefers-color-scheme: light)"> | ||
<link rel="stylesheet" href="{{ '/assets/css/just-the-docs-dark.css' | relative_url }}" | ||
media="(prefers-color-scheme: dark)"> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// XXX: We should override `$nav-width(-md)`, but this breaks code highlighting | ||
// and other styles. See | ||
// https://github.com/just-the-docs/just-the-docs/issues/982. | ||
// Once the fix for the above issue is released, replace this section with the | ||
// approach recommended at | ||
// https://just-the-docs.github.io/just-the-docs/docs/customization/#custom-schemes. | ||
@include mq(lg) { | ||
.side-bar { | ||
min-width: 400px; | ||
} | ||
japborst marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
.site-nav, .site-header { | ||
width: 400px; | ||
} | ||
} | ||
|
||
footer > img#logo { | ||
width: 2rem; | ||
margin: 0 auto; | ||
display: block; | ||
} | ||
japborst marked this conversation as resolved.
Show resolved
Hide resolved
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<browserconfig> | ||
<msapplication> | ||
<tile> | ||
<square150x150logo src="/assets/images/mstile-150x150.png"/> | ||
<TileColor>#da532c</TileColor> | ||
</tile> | ||
</msapplication> | ||
</browserconfig> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In some websites a hash is used for JS routing, which is done after loading. Disabling this to reduce false-positives.