Skip to content

Commit b6396e9

Browse files
jonmeowchandlerc
andauthored
Build a website. (#4189)
Demo site: https://jonmeow.carbon-lang.dev/ I'm trying to keep work under the `/website` subdirectory so that the misc files don't interfere with unrelated views of the repository. The `prebuild.py` script does some work to move things around and add frontmatter, helping the jekyll generation. I'm using the "just-the-docs" theme because I think it's a decent match for what we want, and getting jekyll up and running with it wasn't too difficult. Note #1526 proposed using Docusaurus; I started out there, but was having trouble getting it working with newer versions. The plugins in particular I got stuck trying to make work, which sent me looking for options that we could have working with less customization. I do lean towards jekyll though, because it's what GH uses so hopefully we can get a more consistent experience. Having a website has been approved for a while under #1492, but hasn't been a priority. I'm mainly doing this because I want to just be able to point people to carbon-lang.dev and have easy links that way. --------- Co-authored-by: Chandler Carruth <[email protected]>
1 parent 61e87c3 commit b6396e9

24 files changed

+688
-4
lines changed

.codespell_ignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@ inout
1616
parameteras
1717
pullrequest
1818
rightt
19+
rouge
1920
statics

.github/workflows/gh_pages_ci.yaml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Part of the Carbon Language project, under the Apache License v2.0 with LLVM
2+
# Exceptions. See /LICENSE for license information.
3+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4+
5+
name: GitHub Pages CI
6+
7+
on:
8+
pull_request:
9+
10+
# Cancel previous workflows on the PR when there are multiple fast commits.
11+
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#concurrency
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
14+
cancel-in-progress: true
15+
16+
permissions:
17+
contents: read
18+
19+
jobs:
20+
# Build job
21+
build:
22+
runs-on: ubuntu-latest
23+
steps:
24+
- name: Harden Runner
25+
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1
26+
with:
27+
egress-policy: audit
28+
29+
- name: Checkout
30+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
31+
- name: Prebuild actions
32+
run: ./website/prebuild.py
33+
- name: Setup Ruby
34+
uses: ruby/setup-ruby@a6e6f86333f0a2523ece813039b8b4be04560854 # v1.190.0
35+
with:
36+
# Runs 'bundle install' and caches installed gems automatically.
37+
bundler-cache: true
38+
# Increment this number if you need to re-download cached gems.
39+
cache-version: 0
40+
- name: Build with Jekyll
41+
run: bundle exec jekyll build
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Part of the Carbon Language project, under the Apache License v2.0 with LLVM
2+
# Exceptions. See /LICENSE for license information.
3+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4+
5+
name: GitHub Pages deploy
6+
7+
on:
8+
# Runs on pushes targeting the default branch.
9+
push:
10+
branches: ['trunk']
11+
12+
# Allows you to run this workflow manually from the Actions tab.
13+
workflow_dispatch:
14+
15+
# Cancel previous workflows on the PR when there are multiple fast commits.
16+
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#concurrency
17+
concurrency:
18+
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
19+
cancel-in-progress: true
20+
21+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages.
22+
permissions:
23+
contents: read
24+
pages: write
25+
id-token: write
26+
27+
jobs:
28+
build:
29+
runs-on: ubuntu-latest
30+
steps:
31+
- name: Harden Runner
32+
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1
33+
with:
34+
egress-policy: audit
35+
36+
- name: Checkout
37+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
38+
- name: Prebuild actions
39+
run: ./website/prebuild.py
40+
- name: Setup Pages
41+
uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5.0.0
42+
- name: Setup Ruby
43+
uses: ruby/setup-ruby@a6e6f86333f0a2523ece813039b8b4be04560854 # v1.190.0
44+
with:
45+
# Runs 'bundle install' and caches installed gems automatically.
46+
bundler-cache: true
47+
# Increment this number if you need to re-download cached gems.
48+
cache-version: 0
49+
- name: Build with Jekyll
50+
env:
51+
JEKYLL_ENV: production
52+
run: |
53+
bundle exec jekyll build --verbose \
54+
--source ./ \
55+
--destination ./_site \
56+
--baseurl "${{ steps.pages.outputs.base_path }}"
57+
- name: Upload artifact
58+
# Automatically uploads an artifact from the './_site' directory by
59+
# default.
60+
uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3.0.1
61+
62+
deploy:
63+
environment:
64+
name: github-pages
65+
url: ${{ steps.deployment.outputs.page_url }}
66+
runs-on: ubuntu-latest
67+
needs: build
68+
steps:
69+
- name: Harden Runner
70+
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1
71+
with:
72+
egress-policy: audit
73+
74+
- name: Deploy to GitHub Pages
75+
id: deployment
76+
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5

.pre-commit-config.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ repos:
180180
Exceptions. See /LICENSE for license information.
181181
SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
182182
- --custom_format
183-
- '\.(carbon|c|json|proto|ypp)(\.tmpl)?$'
183+
- '\.(carbon|c|json|proto|scss|ypp)(\.tmpl)?$'
184184
- ''
185185
- '// '
186186
- ''
@@ -216,6 +216,8 @@ repos:
216216
compile_flags.txt|
217217
github_tools/requirements.txt|
218218
third_party/.*|
219+
website/.ruby-version|
220+
website/Gemfile.lock|
219221
.*\.def|
220222
.*\.svg|
221223
.*/fuzzer_corpus/.*|

SECURITY.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1+
# Security policy
2+
13
<!--
24
Part of the Carbon Language project, under the Apache License v2.0 with LLVM
35
Exceptions. See /LICENSE for license information.
46
SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
57
-->
68

7-
# Security policy
8-
99
It's important to us that the Carbon Language provides a secure implementation.
1010
Thank you for taking the time to report vulnerabilities.
1111

1212
The Carbon Language is still an
1313
[experimental project](/README.md#project-status), so please be careful if using
1414
it in security-sensitive environments.
1515

16-
# Reporting a vulnerability
16+
## Reporting a vulnerability
1717

1818
Please use
1919
<https://github.com/carbon-language/carbon-lang/security/advisories/new> to

docs/images/snippets.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ Exceptions. See /LICENSE for license information.
66
SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
77
-->
88

9+
<!--
10+
{% raw %}
11+
Hides `{{` from jekyll's liquid parsing. Note endraw at the bottom.
12+
-->
13+
914
## Images
1015

1116
Images are managed in
@@ -138,3 +143,7 @@ auto main() -> int {
138143
return 0;
139144
}
140145
```
146+
147+
<!--
148+
{% endraw %}
149+
-->

explorer/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ Exceptions. See /LICENSE for license information.
66
SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
77
-->
88

9+
<!--
10+
{% raw %}
11+
Hides `{{` from jekyll's liquid parsing. Note endraw at the bottom.
12+
-->
13+
914
`explorer` is an implementation of Carbon whose primary purpose is to act as a
1015
clear specification of the language. As an extension of that goal, it can also
1116
be used as a platform for prototyping and validating changes to the language.
@@ -334,3 +339,7 @@ information and provide visual separation for different sections.
334339
- - - - - Sub Heading - - - - -
335340
--------------------------------
336341
```
342+
343+
<!--
344+
{% endraw %}
345+
-->

explorer/ast/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Explorer AST
2+
13
<!--
24
Part of the Carbon Language project, under the Apache License v2.0 with LLVM
35
Exceptions. See /LICENSE for license information.

explorer/syntax/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Explorer Syntax
2+
13
<!--
24
Part of the Carbon Language project, under the Apache License v2.0 with LLVM
35
Exceptions. See /LICENSE for license information.

testing/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Testing
2+
3+
<!--
4+
Part of the Carbon Language project, under the Apache License v2.0 with LLVM
5+
Exceptions. See /LICENSE for license information.
6+
SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7+
-->
8+
9+
Testing-specific libraries.

testing/file_test/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ Exceptions. See /LICENSE for license information.
66
SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
77
-->
88

9+
<!--
10+
{% raw %}
11+
Hides `{{` from jekyll's liquid parsing. Note endraw at the bottom.
12+
-->
13+
914
## BUILD
1015

1116
A typical BUILD target will look like:
@@ -156,3 +161,7 @@ Supported comment markers are:
156161
Tips like this are added by autoupdate, for example providing commands to
157162
run the test directly. Tips have no impact on validation; the marker informs
158163
autoupdate that it can update or remove them as needed.
164+
165+
<!--
166+
{% endraw %}
167+
-->

website/.ruby-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.3

website/404.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
title: 404
3+
nav_exclude: true
4+
---
5+
6+
# 404: File not found
7+
8+
<!--
9+
Part of the Carbon Language project, under the Apache License v2.0 with LLVM
10+
Exceptions. See /LICENSE for license information.
11+
SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
12+
-->

website/Gemfile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Part of the Carbon Language project, under the Apache License v2.0 with LLVM
2+
# Exceptions. See /LICENSE for license information.
3+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4+
5+
source 'https://rubygems.org'
6+
7+
gem "jekyll", "4.3.3"
8+
gem "just-the-docs", "0.8.2"
9+
10+
group :jekyll_plugins do
11+
gem "jekyll-default-layout", "0.1.5"
12+
gem "jekyll-readme-index", "0.3.0"
13+
gem "jekyll-relative-links", "0.7.0"
14+
end

website/Gemfile.lock

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
GEM
2+
remote: https://rubygems.org/
3+
specs:
4+
addressable (2.8.7)
5+
public_suffix (>= 2.0.2, < 7.0)
6+
bigdecimal (3.1.8)
7+
colorator (1.1.0)
8+
concurrent-ruby (1.3.4)
9+
em-websocket (0.5.3)
10+
eventmachine (>= 0.12.9)
11+
http_parser.rb (~> 0)
12+
eventmachine (1.2.7)
13+
ffi (1.17.0)
14+
forwardable-extended (2.6.0)
15+
google-protobuf (4.27.3-arm64-darwin)
16+
bigdecimal
17+
rake (>= 13)
18+
google-protobuf (4.27.3-x86_64-linux)
19+
bigdecimal
20+
rake (>= 13)
21+
http_parser.rb (0.8.0)
22+
i18n (1.14.5)
23+
concurrent-ruby (~> 1.0)
24+
jekyll (4.3.3)
25+
addressable (~> 2.4)
26+
colorator (~> 1.0)
27+
em-websocket (~> 0.5)
28+
i18n (~> 1.0)
29+
jekyll-sass-converter (>= 2.0, < 4.0)
30+
jekyll-watch (~> 2.0)
31+
kramdown (~> 2.3, >= 2.3.1)
32+
kramdown-parser-gfm (~> 1.0)
33+
liquid (~> 4.0)
34+
mercenary (>= 0.3.6, < 0.5)
35+
pathutil (~> 0.9)
36+
rouge (>= 3.0, < 5.0)
37+
safe_yaml (~> 1.0)
38+
terminal-table (>= 1.8, < 4.0)
39+
webrick (~> 1.7)
40+
jekyll-default-layout (0.1.5)
41+
jekyll (>= 3.0, < 5.0)
42+
jekyll-include-cache (0.2.1)
43+
jekyll (>= 3.7, < 5.0)
44+
jekyll-readme-index (0.3.0)
45+
jekyll (>= 3.0, < 5.0)
46+
jekyll-relative-links (0.7.0)
47+
jekyll (>= 3.3, < 5.0)
48+
jekyll-sass-converter (3.0.0)
49+
sass-embedded (~> 1.54)
50+
jekyll-seo-tag (2.8.0)
51+
jekyll (>= 3.8, < 5.0)
52+
jekyll-watch (2.2.1)
53+
listen (~> 3.0)
54+
just-the-docs (0.8.2)
55+
jekyll (>= 3.8.5)
56+
jekyll-include-cache
57+
jekyll-seo-tag (>= 2.0)
58+
rake (>= 12.3.1)
59+
kramdown (2.4.0)
60+
rexml
61+
kramdown-parser-gfm (1.1.0)
62+
kramdown (~> 2.0)
63+
liquid (4.0.4)
64+
listen (3.9.0)
65+
rb-fsevent (~> 0.10, >= 0.10.3)
66+
rb-inotify (~> 0.9, >= 0.9.10)
67+
mercenary (0.4.0)
68+
pathutil (0.16.2)
69+
forwardable-extended (~> 2.6)
70+
public_suffix (6.0.1)
71+
rake (13.2.1)
72+
rb-fsevent (0.11.2)
73+
rb-inotify (0.11.1)
74+
ffi (~> 1.0)
75+
rexml (3.3.5)
76+
strscan
77+
rouge (4.3.0)
78+
safe_yaml (1.0.5)
79+
sass-embedded (1.77.8)
80+
google-protobuf (~> 4.26)
81+
rake (>= 13)
82+
strscan (3.1.0)
83+
terminal-table (3.0.2)
84+
unicode-display_width (>= 1.1.1, < 3)
85+
unicode-display_width (2.5.0)
86+
webrick (1.8.1)
87+
88+
PLATFORMS
89+
arm64-darwin
90+
x86_64-linux
91+
92+
DEPENDENCIES
93+
jekyll (= 4.3.3)
94+
jekyll-default-layout (= 0.1.5)
95+
jekyll-readme-index (= 0.3.0)
96+
jekyll-relative-links (= 0.7.0)
97+
just-the-docs (= 0.8.2)
98+
99+
BUNDLED WITH
100+
2.5.17

0 commit comments

Comments
 (0)