Skip to content

Commit

Permalink
[CI] add CI
Browse files Browse the repository at this point in the history
  • Loading branch information
inkydragon committed Jul 17, 2021
1 parent 0b4e577 commit 35fe21d
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 24 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/ci.yml
@@ -0,0 +1,36 @@
name: SML/NJ Build

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:
strategy:
matrix:
os: [macos-latest]
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v2
- name: Install deps (macOS)
if: ${{ matrix.os == 'macos-latest' }}
run: |
brew install basictex smlnj
dvipdfmx --version
sml @SMLversion
- name: Gen DVI
run: sml CI.sml
- name: Gen PDF
run: |
dvipdfmx test1.dvi
dvipdfmx test2.dvi
- name: Upload DVI & PDF
uses: actions/upload-artifact@v2
with:
name: dvi-pdf
path: |
*.dvi
*.pdf
10 changes: 10 additions & 0 deletions CI.sml
@@ -0,0 +1,10 @@
(* load proj *)
use "edit.m";
U "all";

(* gen dvi *)
test1 ();
test2 ();

(* exit REPL *)
exit ();
39 changes: 21 additions & 18 deletions README.md
Expand Up @@ -13,32 +13,35 @@ You can use those code in 2-clause BSD license: [reduce-algebra/reduce-algebra/c
git clone https://github.com/TeX-host/formulae
cd formulae

# generate dvi files
# for Win: `SMLNJ\bin\sml.bat`
sml CI.sml
```

+ 4 simple equtions in `test1.dvi`
![](img/test1.png)
+ 4 complex equtions in `test2.dvi`
![](img/test2.png)


**explore**

```sh
# start SML in project dir
# for Win: `E:\proj\tex\SMLNJ\bin\sml.bat`
# for Win: `SMLNJ\bin\sml.bat`
sml

# run project in SML repl
use "edit.m";
U "all";
```

if there is no error and it print:
```
...
val out = fn : BoxTypes.hlist list -> unit
val test1 = fn : unit -> unit
val test2 = fn : unit -> unit
val it = () : unit
val it = () : unit
-
```

Then you can run tests:
# gen test1.dvi
test1 ()
# gen test2.dvi
test2 ()

+ `test1 ();` it generate 4 simple equtions in `das.dvi`
![](img/test1.png)
+ `test2 ();` it generate 4 complex equtions in `das.dvi`
![](img/test2.png)
# explore the project in REPL
```


## [Overview](OVERVIEW.md)
Expand Down
6 changes: 3 additions & 3 deletions ShipOut.sml
@@ -1,7 +1,7 @@
(* Open a dvi file, output a list of lines, and close it. *)
signature SHIP_OUT =
sig
val shipOut: BoxTypes.hlist list -> unit
val shipOut: string -> BoxTypes.hlist list -> unit
end

structure ShipOut: SHIP_OUT =
Expand All @@ -18,9 +18,9 @@ struct
| lines [l] = ( setHList l )
| lines (h :: t) = ( setHList h; Down lineSkip; lines t )

fun shipOut hlists =
fun shipOut dviName hlists =
(
startOut "das.dvi";
startOut dviName;
Pre mag;
Bop ();
lines hlists;
Expand Down
11 changes: 8 additions & 3 deletions test.sml
Expand Up @@ -8,7 +8,7 @@ fun test f x = (f x) handle (ex as BasicTypes.NotImplemented s)
val disp = test Formula.displayFormula
val line = test Formula.inlineFormula

fun form formula = ShipOut.shipOut [disp formula, line formula]
fun form dviName formula = ShipOut.shipOut dviName [disp formula, line formula]

val bigop = sum (SOME (trans "i=1")) (SOME (trans "n"))

Expand All @@ -28,5 +28,10 @@ val mlss' = fss sum @ fss int @ scr "a" @ scr "b" @ scr "aa" @ scr "ab"
val overmlss' = [overline mlss']

val out = ShipOut.shipOut
fun test1 () = out [disp mlar, line mlar, disp mleq, line mleq]
fun test2 () = out [disp mlss', disp overmlss', line mlss', line overmlss']
(* generate 4 simple equtions *)
fun test1 () = out "test1.dvi" [disp mlar, line mlar, disp mleq, line mleq]
(* generate 4 complex equtions *)
fun test2 () = out "test2.dvi" [disp mlss', disp overmlss', line mlss', line overmlss']

(* exit REPL *)
fun exit () = OS.Process.exit OS.Process.success;

0 comments on commit 35fe21d

Please sign in to comment.