Skip to content

Commit d4b3a29

Browse files
authored
Merge pull request #145 from rust3ds/feature/gh-pages-docs
Initial docs workflow for Github Pages
2 parents 727d594 + 6f8f204 commit d4b3a29

File tree

6 files changed

+92
-2
lines changed

6 files changed

+92
-2
lines changed

.github/workflows/docs.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: GitHub Pages
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
container: devkitpro/devkitarm
13+
steps:
14+
- name: Checkout branch
15+
uses: actions/checkout@v4
16+
17+
- name: Setup Pages
18+
uses: actions/configure-pages@v3
19+
20+
- name: Build with Jekyll
21+
uses: actions/jekyll-build-pages@v1
22+
23+
- uses: rust3ds/test-runner/setup@v1
24+
with:
25+
toolchain: nightly
26+
27+
- name: Build workspace docs
28+
run: cargo 3ds --verbose doc --verbose --no-deps --workspace
29+
env:
30+
RUSTDOCFLAGS: --enable-index-page
31+
32+
# https://github.com/actions/upload-pages-artifact#file-permissions
33+
- name: Fix file permissions
34+
run: |
35+
chmod -c -R +rX "target/armv6k-nintendo-3ds/doc" | while read line; do
36+
echo "::warning title=Invalid file permissions automatically fixed::$line"
37+
done
38+
39+
- name: Copy generated docs to _site
40+
# Note: this won't include proc-macro crate, but macros are re-exported
41+
# by the crate docs so there will still be some documentation.
42+
run: cp -R ./target/armv6k-nintendo-3ds/doc ./_site/crates
43+
44+
- name: Upload docs
45+
uses: actions/upload-pages-artifact@v2
46+
47+
deploy:
48+
runs-on: ubuntu-latest
49+
needs: build
50+
permissions:
51+
pages: write
52+
id-token: write
53+
54+
environment:
55+
name: github-pages
56+
url: ${{ steps.deployment.outputs.page_url }}
57+
58+
steps:
59+
- name: Deploy to GitHub Pages
60+
id: deployment
61+
uses: actions/deploy-pages@v2
62+

README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,20 @@ This repository is home of the `ctru-rs` project, which aims to bring full contr
66

77
This repository is organized as follows:
88

9-
* [`ctru-rs`](./ctru-rs/) - Safe, idiomatic wrapper around [`ctru-sys`](./ctru-sys/).
10-
* [`ctru-sys`](./ctru-sys/) - Low-level, unsafe bindings to [`libctru`](https://github.com/devkitPro/libctru).
9+
* [`ctru-rs`](./ctru-rs) - Safe, idiomatic wrapper around [`ctru-sys`](./ctru-sys).
10+
* [`ctru-sys`](./ctru-sys) - Low-level, unsafe bindings to [`libctru`](https://github.com/devkitPro/libctru).
1111

1212
## Getting Started
1313

1414
Specific information about how to use the crates is present in the individual README for each package.
1515
Have a look at `ctru-rs`' [README.md](./ctru-rs/README.md) for a broad overview.
1616

17+
## Documentation
18+
19+
Cargo-generated [documentation](https://rust3ds.github.io/ctru-rs/crates) is available
20+
via GitHub Pages, because the <https://docs.rs> build environment does not have `libctru`
21+
installed.
22+
1723
## Original version
1824

1925
This project is based on the efforts of the original authors:

_config.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Configuration for GitHub Pages (Jekyll)
2+
theme: jekyll-theme-midnight

assets/css/style.scss

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
---
3+
4+
// https://github.com/pages-themes/midnight#stylesheet
5+
@import "{{ site.theme }}";
6+
7+
// Give code links a color that matches regular links
8+
a code {
9+
color: inherit;
10+
}
11+
12+
// Remove weird extra padding and spaces from inline code blocks
13+
code {
14+
padding: 0;
15+
}

ctru-rs/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
Safe and idiomatic Rust wrapper around [`libctru`](https://github.com/devkitPro/libctru).
44

5+
Documentation for the `master` branch can be found [here](https://rust3ds.github.io/ctru-rs/crates/ctru).
6+
57
## Getting Started
68

79
Thoroughly read the [`ctru-rs` wiki](https://github.com/rust3ds/ctru-rs/wiki/Getting-Started) to meet the requirements

ctru-sys/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
Raw Rust bindings over the [`libctru`](https://github.com/devkitPro/libctru) C library.
44

5+
Documentation for the latest devkitPro release can be found
6+
[here](https://rust3ds.github.io/crates/ctru_sys).
7+
58
## Requirements
69

710
To use the bindings provided by this crate you will need to link against the [`libctru`](https://github.com/devkitPro/libctru) library.

0 commit comments

Comments
 (0)