Skip to content

Commit eaa9335

Browse files
committed
Adding CI to diff generated lexer
1 parent 09736b0 commit eaa9335

File tree

5 files changed

+83
-4
lines changed

5 files changed

+83
-4
lines changed

.github/workflows/lexer.yml

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Lexer up-to-date
2+
3+
on:
4+
push:
5+
branches: ['master', 'installPackage']
6+
pull_request:
7+
workflow_dispatch:
8+
9+
jobs:
10+
check-lexer:
11+
runs-on: ${{ matrix.os }}
12+
timeout-minutes: 30
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
julia-version: ['1.6']
17+
julia-arch: ['x64']
18+
os: ['ubuntu-latest']
19+
20+
steps:
21+
- uses: actions/checkout@v4
22+
23+
- name: "Set up Julia"
24+
uses: julia-actions/setup-julia@v2
25+
with:
26+
version: ${{ matrix.julia-version }}
27+
arch: ${{ matrix.julia-arch }}
28+
29+
- name: Cache Julia
30+
uses: julia-actions/cache@v2
31+
32+
- name: Install dependencies
33+
run: julia --project=bin/ -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()'
34+
35+
- name: Build Lexer
36+
run: julia --project=bin/ -e 'include("bin/generate_lexer.jl")'
37+
38+
- name: Check for changes in src/lexer.jl
39+
id: changed-lexer
40+
uses: tj-actions/changed-files@v44
41+
with:
42+
since_last_remote_commit: true
43+
files: |
44+
src/lexer.jl
45+
46+
- name: Archive changed lexer.jl
47+
if: steps.changed-lexer.outputs.any_modified == 'true'
48+
uses: actions/upload-artifact@v4
49+
with:
50+
name: lexer.jl
51+
path: ${{ steps.changed-markdown-files.outputs.all_changed_files }}

.github/workflows/regressionTests.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ jobs:
5454
run: julia --project=regression-tests/. -e 'include("regression-tests/regressionTests.jl"); runTests(libraries, models)'
5555

5656
- name: Archive FMUs
57-
uses: actions/upload-artifact@v3
57+
uses: actions/upload-artifact@v4
5858
with:
5959
name: fmu-export
6060
path: regression-tests/temp/**/*.fmu

bin/Project.toml

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[deps]
2+
Automa = "67c07d97-cdcb-5c2c-af73-a7f9c32a568b"
3+
MacroTools = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09"
4+
OMJulia = "0f4fe800-344e-11e9-2949-fb537ad918e1"
5+
6+
[compat]
7+
Automa = "0.7"
8+
MacroTools = "0.5.4"
9+
julia = "1.6"

bin/README.md

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Lexer for OpenModelica outputs
2+
3+
Builds lexer [src/lexer.jl](../src/lexer.jl) using
4+
[Automa.jl](https://github.com/BioJulia/Automa.jl).
5+
6+
## Build
7+
8+
Change into `bin/` directory and run:
9+
10+
```julia
11+
import Pkg;
12+
Pkg.activate(".")
13+
include("generate_lexer.jl")
14+
```
15+
16+
## Additional notes
17+
18+
- [src/memory.jl](../src/memory.jl) defines Automa.jl types, so Automa.jl
19+
isn't a dependency for OMJulia.jl.

src/sendExpression.jl

+3-3
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,13 @@ for a complete list of all functions.
3737
Some characters in argument `expr` need to be escaped.
3838
E.g. `"` becomes `\\"`.
3939
For example scripting API call
40-
40+
4141
```modelica
4242
loadFile("/path/to/M.mo")
4343
```
44-
44+
4545
will translate to
46-
46+
4747
```julia
4848
sendExpression(omc, "loadFile(\\"/path/to/M.mo\\")")
4949
```

0 commit comments

Comments
 (0)