Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions .github/workflows/deploy-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Deploy docs to GitHub Pages

on:
push:
branches: [main]
workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

# Skip queued runs, but never interrupt an in-flight deploy: it can leave the site partial.
concurrency:
group: pages
cancel-in-progress: false

jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 30

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Zig
uses: mlugg/setup-zig@v2
with:
version: 0.16.0

- name: Build documentation
run: zig build docs

- name: Setup Pages
uses: actions/configure-pages@v5

- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: zig-out/docs

deploy:
needs: build
runs-on: ubuntu-latest
timeout-minutes: 10
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
67 changes: 67 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Tests

on:
push:
branches: [main, dev]
pull_request:
branches: [main, dev]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build_and_test:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]

runs-on: ${{ matrix.os }}
timeout-minutes: 30

steps:
- uses: actions/checkout@v4

- name: Setup Zig
uses: mlugg/setup-zig@v2
with:
version: 0.16.0

- name: Build library
run: zig build

- name: Build documentation
if: matrix.os == 'ubuntu-latest'
run: zig build docs

- name: Run Zig tests
run: zig test -O ReleaseSafe ./src/test_min.zig

python_tests:
runs-on: ubuntu-latest
timeout-minutes: 30

steps:
- uses: actions/checkout@v4

- name: Reclaim runner disk space
run: |
sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc
df -h /

- name: Setup Zig
uses: mlugg/setup-zig@v2
with:
version: 0.16.0

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Install package
run: pip install .

- name: Run Python tests
run: python -m pytest --pyargs riley.pytests
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ out/
bin/
.*
!.gitignore
!.github/

# Do not keep any large output directories with images or other output in them
out/
Expand Down
28 changes: 26 additions & 2 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ pub fn build(b: *std.Build) void {
optimize,
build_options_module,
);
b.installArtifact(shared_lib);
_ = b.addInstallHeaderFile(
shared_lib.installHeader(
b.path("src/riley/cyth/riley.h"),
"riley.h",
);
b.installArtifact(shared_lib);

const tests = [_]TestEntry{
.{
Expand Down Expand Up @@ -237,6 +237,30 @@ pub fn build(b: *std.Build) void {
install_step.dependOn(&install_artifact.step);
bench_bins_step.dependOn(&install_artifact.step);
}

// Rooted at the public API module, not shared_lib, whose generated wrapper
// root keeps its entry source private where autodoc cannot follow. A
// separate object also keeps doc generation out of normal builds. No
// build_options is injected here, so the -D config options have no effect:
// docs always describe the f64 / SIMD-on / fast-Newton build.
const docs_obj = b.addObject(.{
.name = "riley",
.root_module = b.createModule(.{
.root_source_file = b.path("src/riley/zig/riley.zig"),
.target = target,
.optimize = optimize,
.link_libc = true,
}),
});

const docs_install = b.addInstallDirectory(.{
.source_dir = docs_obj.getEmittedDocs(),
.install_dir = .prefix,
.install_subdir = "docs",
});

const docs_step = b.step("docs", "Generate API documentation");
docs_step.dependOn(&docs_install.step);
}

fn addRileySharedLibrary(
Expand Down
Loading