Skip to content

Commit

Permalink
feat: First developer diary entry
Browse files Browse the repository at this point in the history
TODO:
- Parallelise building
- `meta` context
- Write documentation
  • Loading branch information
emmyoh committed May 29, 2024
1 parent b58b9b6 commit 81347fc
Show file tree
Hide file tree
Showing 31 changed files with 1,392 additions and 353 deletions.
53 changes: 41 additions & 12 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,51 @@ on:
branches: [ "master" ]
env:
CARGO_TERM_COLOR: always
GH_TOKEN: ${{ github.token }}
jobs:
build_documentation:
name: Build documentation
build_site:
name: Build site
runs-on: ubuntu-latest
steps:
- name: Setup Rust toolchain
uses: actions-rs/toolchain@v1
# - name: Setup Rust toolchain
# uses: actions-rs/toolchain@v1
# with:
# toolchain: nightly
# target: x86_64-unknown-linux-gnu
# default: true
# profile: default
- name: Get dependency information
run: |
gh api /repos/emmyoh/vox/commits/master --jq '.sha' > vox_rev
curl https://crates.io/api/v1/crates/grass > grass_rev
- name: Restore Cargo cache
id: cache-cargo
uses: actions/cache@v1
with:
toolchain: nightly
target: x86_64-unknown-linux-gnu
default: true
profile: default
path: ~/.cargo
key: ${{ runner.os }}-cargo-${{ hashFiles('vox_rev', 'grass_rev') }}
restore-keys: |
${{ runner.os }}-cargo-${{ hashFiles('vox_rev', 'grass_rev') }}
- if: ${{ steps.cache-cargo.outputs.cache-hit != 'true' }}
name: Install Grass and Vox
run: |
rm vox_rev
rm grass_rev
rustup update nightly && rustup default nightly
time cargo install grass
time cargo install --git https://github.com/emmyoh/vox --features="cli"
- name: Checkout codebase
uses: actions/checkout@v4
- name: Generate documentation
run: time cargo doc --no-deps -Zrustdoc-map --release --quiet
- name: Build site
run: |
mkdir -p site/output
cp -r target/doc/* site/output/
cd site
./prebuild.sh
vox build -d
cd ../
- name: Fix permissions
run: |
chmod -c -R +rX "target/doc/" | while read line; do
Expand All @@ -28,10 +57,10 @@ jobs:
- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: "target/doc/"
deploy_documentation:
needs: build_documentation
name: Deploy documentation to GitHub Pages
path: "site/output/"
deploy_site:
needs: build_site
name: Deploy to GitHub Pages
permissions:
pages: write
id-token: write
Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,7 @@ Cargo.lock
**/*.rs.bk

# MSVC Windows builds of rustc generate these, which store debugging information
*.pdb
*.pdb

## Vox
site/output/
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ notify-debouncer-full = { version = "0.3.1", default-features = false, optional
actix-files = { version = "0.6.5", optional = true }
actix-web = { version = "4.6.0", optional = true }
layout-rs = "0.1.2"
html-escape = "0.2.13"

[features]
default = []
Expand Down
10 changes: 10 additions & 0 deletions site/404.vox
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
layout = "default"
title = "Page not found"
permalink = "404.html"
---

<div class="page">
<h1 class="page-title">Page not found</h1>
<p class="lead">Return to the <a href="{{ global.url }}/">home page</a>.</p>
</div>
70 changes: 70 additions & 0 deletions site/assets/style/_base.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
// Body resets
//
// Update the foundational and global aspects of the page.

* {
box-sizing: border-box;
}

body {
margin: 0;
font-family: var(--body-font);
font-size: var(--body-font-size);
line-height: var(--body-line-height);
color: var(--body-color);
background-color: var(--body-bg);
-webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%;
}

// No `:visited` state is required by default (browsers will use `a`)
a {
color: var(--link-color);

// `:focus` is linked to `:hover` for basic accessibility
&:hover,
&:focus {
color: var(--link-hover-color);
}

strong {
color: inherit;
}
}

img {
display: block;
max-width: 100%;
margin-bottom: var(--spacer);
border-radius: var(--border-radius);
}

table {
margin-bottom: 1rem;
width: 100%;
border: 0 solid var(--border-color);
border-collapse: collapse;
}

td,
th {
padding: .25rem .5rem;
border-color: inherit;
border-style: solid;
border-width: 0;
border-bottom-width: 1px;
}

th {
text-align: left;
}

thead th {
border-bottom-color: currentColor;
}

mark {
padding: .15rem;
background-color: var(--yellow-100);
border-radius: .125rem;
}
58 changes: 58 additions & 0 deletions site/assets/style/_code.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
// Code
//
// Inline and block-level code snippets. Includes tweaks to syntax highlighted
// snippets from Pygments/Rouge and Gist embeds.

code,
pre {
font-family: var(--code-font);
}

code {
font-size: 85%;
}

pre {
display: block;
margin-top: 0;
margin-bottom: var(--spacer-3);
overflow: auto;
}

.highlight {
padding: var(--spacer);
margin-bottom: var(--spacer);
background-color: var(--code-bg);
border-radius: var(--border-radius);

pre {
margin-bottom: 0;
}

// Triple backticks (code fencing) doubles the .highlight elements
.highlight {
padding: 0;
}
}

.rouge-table {
margin-bottom: 0;
font-size: 100%;

&,
td,
th {
border: 0;
}

.gutter {
vertical-align: top;
user-select: none;
opacity: .25;
}
}

// Gist via GitHub Pages
.gist .markdown-body {
padding: 15px !important;
}
16 changes: 16 additions & 0 deletions site/assets/style/_layout.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Layout
//
// Styles for managing the structural hierarchy of the site.

.container {
max-width: 45rem;
padding-left: var(--spacer-2);
padding-right: var(--spacer-2);
margin-left: auto;
margin-right: auto;
}

footer {
margin-top: var(--spacer-3);
margin-bottom: var(--spacer-3);
}
23 changes: 23 additions & 0 deletions site/assets/style/_masthead.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Masthead
//
// Super small header above the content for site name and short description.

.masthead {
padding-top: var(--spacer);
padding-bottom: var(--spacer);
margin-bottom: var(--spacer-3);
}

.masthead-title {
margin-bottom: 0;

a {
color: inherit;
text-decoration: none;
}

small {
font-weight: 400;
opacity: .5;
}
}
12 changes: 12 additions & 0 deletions site/assets/style/_message.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Messages
//
// Show alert messages to users. You may add it to single elements like a `<p>`,
// or to a parent if there are multiple elements to show.

.message {
padding: var(--spacer);
margin-bottom: var(--spacer);
color: var(--gray-900);
background-color: var(--yellow-100);
border-radius: var(--border-radius);
}
52 changes: 52 additions & 0 deletions site/assets/style/_pagination.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
// Pagination
//
// Super lightweight (HTML-wise) blog pagination. `span`s are provide for when
// there are no more previous or next posts to show.

.pagination {
display: flex;
margin: 0 -1.5rem var(--spacer);
color: var(--gray-500);
text-align: center;
}

// Pagination items can be `span`s or `a`s
.pagination-item {
display: block;
padding: var(--spacer);
text-decoration: none;
border: solid var(--border-color);
border-width: 1px 0;

&:first-child {
margin-bottom: -1px;
}
}

// Only provide a hover state for linked pagination items
a.pagination-item:hover {
background-color: var(--border-color);
}

@media (min-width: 30em) {
.pagination {
margin: var(--spacer-3) 0;
}

.pagination-item {
float: left;
width: 50%;
border-width: 1px;

&:first-child {
margin-bottom: 0;
border-top-left-radius: var(--border-radius);
border-bottom-left-radius: var(--border-radius);
}
&:last-child {
margin-left: -1px;
border-top-right-radius: var(--border-radius);
border-bottom-right-radius: var(--border-radius);
}
}
}
Loading

0 comments on commit 81347fc

Please sign in to comment.