Skip to content

Commit

Permalink
Set up documentation website generation and deployment (#253)
Browse files Browse the repository at this point in the history
Generating the website is done by Jekyll with a theme called `just-the-docs`. 
Deployment of the website is done via GitHub Pages.

See:
- https://github.com/jekyll/jekyll
- https://github.com/just-the-docs/just-the-docs
  • Loading branch information
japborst authored Oct 4, 2022
1 parent 9204ef0 commit 5ca95eb
Show file tree
Hide file tree
Showing 28 changed files with 406 additions and 16 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ name: Build and verify
on:
pull_request:
push:
branches:
- 'master'
branches: [$default-branch]
permissions:
contents: read
jobs:
Expand Down
45 changes: 45 additions & 0 deletions .github/workflows/deploy-website.yaml
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
id-token: write
pages: 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:
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]
26 changes: 12 additions & 14 deletions README.md
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>
<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%">
</picture>
</div>

# Error Prone Support

Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
[refaster-templates]: https://github.com/PicnicSupermarket/error-prone-support/blob/master/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/
27 changes: 27 additions & 0 deletions generate-docs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env bash

set -e -u -o pipefail

REPOSIORY_ROOT="$(git rev-parse --show-toplevel)"
WEBSITE_ROOT="${REPOSIORY_ROOT}/website"

generate_homepage() {
local homepage="${WEBSITE_ROOT}/index.md"

echo "Generating ${homepage}..."
cat - "${REPOSIORY_ROOT}/README.md" > "${homepage}" << EOF
---
layout: default
title: Home
nav_order: 1
---
EOF

local macos_compat=""
[[ "${OSTYPE}" == "darwin"* ]] && macos_compat="yes"
sed -i ${macos_compat:+".bak"} 's/src="website\//src="/g' "${homepage}"
sed -i ${macos_compat:+".bak"} 's/srcset="website\//srcset="/g' "${homepage}"
}

# Generate the website.
generate_homepage
12 changes: 12 additions & 0 deletions website/.gitignore
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
.sass-cache/
_site/
vendor/

# Generated by `../generate-docs.sh`.
*.bak
index.md
11 changes: 11 additions & 0 deletions website/404.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.
5 changes: 5 additions & 0 deletions website/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
source "https://rubygems.org"
gem "github-pages", "227"
gem "html-proofer", "4.4.1"
gem "jekyll-remote-theme", "0.4.3"
gem "rake", "13.0.6"
38 changes: 38 additions & 0 deletions website/README.md
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
46 changes: 46 additions & 0 deletions website/_config.yml
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: >-
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
- 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
5 changes: 5 additions & 0 deletions website/_includes/footer_custom.html
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 &copy; 2017-2022 Picnic Technologies BV
</p>
18 changes: 18 additions & 0 deletions website/_includes/head_custom.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!-- Generated using 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">
<meta name="msapplication-TileColor" content="#da532c">
<meta name="msapplication-config" content="/assets/images/browserconfig.xml">
<meta name="theme-color" content="#ffffff">

<!-- XXX: The theme does not natively support both light and dark mode. Drop
this section once https://github.com/just-the-docs/just-the-docs/issues/234 is
resolved. -->
<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)">
21 changes: 21 additions & 0 deletions website/_sass/custom/custom.scss
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;
}

.site-nav, .site-header {
width: 400px;
}
}

footer > img#logo {
width: 2rem;
margin: 0 auto;
display: block;
}
Binary file added website/assets/images/android-chrome-192x192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added website/assets/images/android-chrome-512x512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added website/assets/images/apple-touch-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions website/assets/images/browserconfig.xml
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>
Binary file added website/assets/images/favicon-16x16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added website/assets/images/favicon-32x32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 33 additions & 0 deletions website/assets/images/favicon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
Binary file added website/assets/images/mstile-150x150.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added website/assets/images/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 5ca95eb

Please sign in to comment.