Skip to content

Commit

Permalink
Builds kernel docs (#1098)
Browse files Browse the repository at this point in the history
  • Loading branch information
ultimaweapon authored Nov 16, 2024
1 parent 78f3029 commit 3d23765
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 12 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/ci-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: CI (Docs)
on:
workflow_call:
jobs:
build:
name: Documentation
runs-on: ubuntu-24.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Build kernel documentation
run: |
import json
import os
from os.path import dirname
from subprocess import Popen, PIPE
import sys
# Build.
args = [
'cargo', 'doc',
'-p', 'obkrnl',
'--all-features',
'--document-private-items',
'--no-deps',
'--message-format', 'json-render-diagnostics'
]
with Popen(args, env=dict(os.environ, RUSTDOCFLAGS='-D warnings'), stdout=PIPE) as proc:
for line in proc.stdout:
line = json.loads(line)
reason = line['reason']
if reason == 'build-finished':
if line['success']:
break
else:
sys.exit(1)
elif reason == 'compiler-artifact':
if line['target']['name'] == 'obkrnl':
out = dirname(line['filenames'][0])
# Set docs location.
with open(os.environ['GITHUB_OUTPUT'], 'a') as f:
print(f'location={out}', file=f)
shell: python
id: kernel
- name: Upload artifacts
uses: actions/upload-pages-artifact@v3
with:
path: ${{ steps.kernel.outputs.location }}
5 changes: 1 addition & 4 deletions .github/workflows/ci-mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ name: CI (Mac)
on:
workflow_call:
inputs:
name:
type: string
required: true
macos:
type: string
required: true
Expand All @@ -18,7 +15,7 @@ env:
CMAKE_BUILD_PARALLEL_LEVEL: "3"
jobs:
build:
name: ${{ inputs.name }}
name: Mac M1
runs-on: ${{ inputs.macos }}
env:
CMAKE_PREFIX_PATH: qt/6.7.2/macos
Expand Down
20 changes: 18 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,27 @@ jobs:
name: Build
uses: ./.github/workflows/ci-mac.yml
with:
name: Mac M1
macos: macos-14
kernel-target: aarch64-unknown-none-softfloat
artifact-name: obliteration-mac-m1
pr:
build-docs:
name: Build
uses: ./.github/workflows/ci-docs.yml
deploy-docs:
name: Deploy documentation
runs-on: ubuntu-24.04
needs: build-docs
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
permissions:
pages: write
id-token: write
steps:
- name: Deploy to GitHub Pages
uses: actions/deploy-pages@v4
id: deployment
update-prs:
name: Update PRs
runs-on: ubuntu-24.04
steps:
Expand Down
13 changes: 8 additions & 5 deletions .github/workflows/pr-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ concurrency: pr-${{ github.ref }}
jobs:
prebuild:
name: Pre build
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
steps:
- name: Checkout source
- name: Checkout repository
uses: actions/checkout@v4
- name: Check Rust styles
run: cargo fmt --check
Expand All @@ -26,14 +26,17 @@ jobs:
uses: ./.github/workflows/ci-mac.yml
needs: prebuild
with:
name: Mac M1
macos: macos-14
kernel-target: aarch64-unknown-none-softfloat
artifact-name: obliteration-mac-m1
build-docs:
name: Build
uses: ./.github/workflows/ci-docs.yml
needs: prebuild
postbuild:
name: Post build
runs-on: ubuntu-latest
needs: [build-windows, build-linux, build-mac]
runs-on: ubuntu-24.04
needs: [build-windows, build-linux, build-mac, build-docs]
steps:
- name: Generate build information
run: |
Expand Down
2 changes: 1 addition & 1 deletion kernel/src/context/arc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub struct BorrowedArc<T>(*const T); // A pointer make this type automatically !

impl<T> BorrowedArc<T> {
/// # Safety
/// `v` must be owned by [Arc].
/// `v` must be owned by [Arc](alloc::sync::Arc).
pub(super) unsafe fn new(v: *const T) -> Self {
Self(v)
}
Expand Down

0 comments on commit 3d23765

Please sign in to comment.