Skip to content

Commit 6da3692

Browse files
authored
Adds Docs + workflow utilities (#21)
* Adding documentation * Add docs.yml * Create CompatHelper.yml * Create TagBot.yml * Create ci.yml * Allowing loading without gcc * Fix docs index and link, ignore /build
1 parent 51a2240 commit 6da3692

13 files changed

Lines changed: 239 additions & 3 deletions

File tree

.github/workflows/CompatHelper.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: CompatHelper
2+
3+
on:
4+
schedule:
5+
- cron: '0 1 * * *'
6+
issues:
7+
types: [opened, reopened]
8+
9+
jobs:
10+
build:
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
matrix:
14+
julia-version: [1.3.1]
15+
julia-arch: [x64]
16+
os: [ubuntu-latest]
17+
steps:
18+
- uses: julia-actions/setup-julia@latest
19+
with:
20+
version: ${{ matrix.julia-version }}
21+
- name: Install dependencies
22+
run: julia -e 'using Pkg; Pkg.add(Pkg.PackageSpec(name = "CompatHelper", url = "https://github.com/bcbi/CompatHelper.jl.git"))'
23+
- name: CompatHelper.main
24+
env:
25+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26+
JULIA_DEBUG: CompatHelper
27+
run: julia -e 'using CompatHelper; CompatHelper.main()'

.github/workflows/TagBot.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
name: TagBot
2+
on:
3+
schedule:
4+
- cron: 0 * * * *
5+
jobs:
6+
TagBot:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: JuliaRegistries/TagBot@v1
10+
with:
11+
token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/ci.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: CI
2+
on:
3+
- push
4+
- pull_request
5+
jobs:
6+
test:
7+
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }}
8+
runs-on: ${{ matrix.os }}
9+
strategy:
10+
fail-fast: false
11+
matrix:
12+
version:
13+
- '1.3'
14+
- 'nightly'
15+
os:
16+
- ubuntu-latest
17+
# - macOS-latest
18+
- windows-latest
19+
arch:
20+
- x64
21+
steps:
22+
- uses: actions/checkout@v2
23+
- uses: julia-actions/setup-julia@latest
24+
with:
25+
version: ${{ matrix.version }}
26+
arch: ${{ matrix.arch }}
27+
- uses: julia-actions/julia-buildpkg@latest
28+
- uses: julia-actions/julia-runtest@latest

.github/workflows/docs.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Documentation
2+
3+
on:
4+
push:
5+
branches:
6+
- 'master'
7+
- 'release-'
8+
tags: '*'
9+
pull_request:
10+
11+
jobs:
12+
build:
13+
runs-on: ${{ matrix.os }}
14+
strategy:
15+
matrix:
16+
julia-version: [1.3.1]
17+
julia-arch: [x64]
18+
os: [ubuntu-latest]
19+
steps:
20+
- uses: actions/checkout@v2
21+
- uses: julia-actions/setup-julia@latest
22+
with:
23+
version: ${{ matrix.julia-version }}
24+
- name: Install dependencies
25+
run: julia --project=docs -e 'using Pkg; Pkg.instantiate()'
26+
- name: Build and deploy
27+
env:
28+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
29+
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }}
30+
run: julia --project=docs --color=yes docs/make.jl

README.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,24 @@
11
# StaticCompiler
22

3+
[![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://tshort.github.io/StaticCompiler.jl/dev)
34
[![Build Status](https://travis-ci.com/tshort/StaticCompiler.jl.svg?branch=master)](https://travis-ci.com/tshort/StaticCompiler.jl)
45
[![Build Status](https://ci.appveyor.com/api/projects/status/github/tshort/StaticCompiler.jl?svg=true)](https://ci.appveyor.com/project/tshort/StaticCompiler-jl)
56
[![Codecov](https://codecov.io/gh/tshort/StaticCompiler.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/tshort/StaticCompiler.jl)
67
[![Coveralls](https://coveralls.io/repos/github/tshort/StaticCompiler.jl/badge.svg?branch=master)](https://coveralls.io/github/tshort/StaticCompiler.jl?branch=master)
78

89
This is an experimental package to compile Julia code to standalone libraries. A system image is not needed. It is also meant for cross compilation, so Julia code can be compiled for other targets, including WebAssembly and embedded targets.
910

10-
Long term, a better approach may be to use Julia's standard compilation techniques with "tree shaking" to generate a reduced system image (see [here](https://github.com/JuliaLang/julia/issues/33670)).
11+
## Installation and Usage
12+
```julia
13+
using Pkg
14+
Pkg.add(PackageSpec( url = "https://github.com/tshort/StaticCompiler.jl", rev = "master"))
15+
```
16+
```julia
17+
using StaticCompiler
18+
```
19+
**Documentation**: [![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://tshort.github.io/StaticCompiler.jl/dev)
1120

21+
## Approach
1222
This package uses the [LLVM package](https://github.com/maleadt/LLVM.jl) to generate code in the same fashion as [CUDAnative](https://github.com/JuliaGPU/CUDAnative.jl).
1323

1424
Some of the key details of this approach are:
@@ -19,6 +29,9 @@ Some of the key details of this approach are:
1929

2030
* **Initialization** -- If libjulia is used, some init code needs to be run to set up garbage collection and other things. For this, a basic `blank.ji` file is used to feed `jl_init_with_image`.
2131

32+
Long term, a better approach may be to use Julia's standard compilation techniques with "tree shaking" to generate a reduced system image (see [here](https://github.com/JuliaLang/julia/issues/33670)).
33+
34+
## Example
2235
The API still needs work, but here is the general approach right now:
2336

2437
```julia

docs/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Manifest.toml
2+
build/*

docs/Project.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[deps]
2+
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
3+
StaticCompiler = "81625895-6c0f-48fc-b932-11a18313743c"

docs/make.jl

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
using StaticCompiler
2+
using Documenter
3+
4+
makedocs(;
5+
modules=[StaticCompiler],
6+
authors="Tom Short",
7+
repo="https://github.com/tshort/StaticCompiler.jl/blob/{commit}{path}#L{line}",
8+
sitename="StaticCompiler.jl",
9+
format=Documenter.HTML(;
10+
prettyurls = prettyurls = get(ENV, "CI", nothing) == "true",
11+
# canonical="https://tshort.github.io/StaticCompiler.jl",
12+
# assets=String[],
13+
),
14+
pages=[
15+
"Home" => "index.md",
16+
"Backend Syntax Reference" => "backend.md",
17+
"Helpers Syntax Reference" => "helpers.md",
18+
],
19+
)
20+
21+
deploydocs(;
22+
repo="github.com/tshort/StaticCompiler.jl",
23+
)

docs/src/backend.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Backend Syntax Reference
2+
```@index
3+
Modules = [StaticCompiler]
4+
Pages = ["backend.md"]
5+
```
6+
7+
```@autodocs
8+
Modules = [StaticCompiler]
9+
Pages = readdir("../src")
10+
```

docs/src/helpers.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Helpers
2+
Note that the helpers defined here are used in tests, and they are useful to test out code in the REPL.
3+
4+
```julia
5+
twox(x) = 2x
6+
# run code in the REPL
7+
@jlrun twox(3)
8+
# compile to an executable in a `standalone` directory
9+
exegen([ (twox, Tuple{Int}, 4) ])
10+
```
11+
12+
These are not meant to be a permanent part of the API. They are just for testing.
13+
14+
15+
```@index
16+
Modules = [StaticCompiler]
17+
Pages = ["helpers.md"]
18+
```
19+
20+
```@autodocs
21+
Modules = [StaticCompiler]
22+
Pages = readdir("../src/helpers")
23+
```

0 commit comments

Comments
 (0)