Skip to content

Commit

Permalink
Test everything!
Browse files Browse the repository at this point in the history
  • Loading branch information
danhunsaker committed Apr 12, 2024
1 parent 47753d2 commit cb8600b
Show file tree
Hide file tree
Showing 11 changed files with 270 additions and 27 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/gremlin.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: 'Gremlin Script Tools'

on:
push:
branches: main
pull_request:
branches: main
workflow_dispatch:

jobs:
test:
name: Test
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: ilammy/msvc-dev-cmd@v1
- uses: leafo/gh-actions-lua@v10
with:
luaVersion: '5.1'
- run: 'mkdir "C:\Program Files\Eagle Dynamics\DCS World"'
- run: '7z x lib\DCS_archive.zip -o"C:\Program Files\Eagle Dynamics\DCS World"'
- run: .\runtests.bat gremlin
32 changes: 22 additions & 10 deletions .github/workflows/mdbook.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,37 @@ jobs:
env:
MDBOOK_VERSION: 0.4.37
steps:
- name: Set up Cargo cache
id: cache
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- uses: actions/checkout@v4
- name: Install mdBook
if: steps.cache.outputs.cache-hit != 'true'
run: |
curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf -y | sh
rustup update
cargo install --version ${MDBOOK_VERSION} mdbook
- name: Setup Lua
uses: leafo/gh-actions-lua@v8
with:
luaVersion: '5.1'
- name: Setup LuaRocks
uses: leafo/gh-actions-luarocks@v4
- name: Setup LDoc
run: luarocks install ldoc
- name: Setup Pages
id: pages
uses: actions/configure-pages@v4
- name: Generate API docs
run:
alias ldoc='docker run -v "$(pwd):/data" ghcr.io/lunarmodules/ldoc:latest'
cd docs/api/
ldoc -c gremlin.ldoc
ldoc -c evac.ldoc
ldoc -c ungency.ldoc
ldoc -c waves.ldoc
- name: Build with mdBook
run: mdbook build
- name: Generate and build docs
run: ./builddocs.sh
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
Expand Down
22 changes: 22 additions & 0 deletions .github/workflows/urgency.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: 'Gremlin Urgency'

on:
push:
branches: main
pull_request:
branches: main
workflow_dispatch:

jobs:
test:
name: Test
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: ilammy/msvc-dev-cmd@v1
- uses: leafo/gh-actions-lua@v10
with:
luaVersion: '5.1'
- run: 'mkdir "C:\Program Files\Eagle Dynamics\DCS World"'
- run: '7z x lib\DCS_archive.zip -o"C:\Program Files\Eagle Dynamics\DCS World"'
- run: .\runtests.bat urgency
22 changes: 22 additions & 0 deletions .github/workflows/waves.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: 'Gremlin Waves'

on:
push:
branches: main
pull_request:
branches: main
workflow_dispatch:

jobs:
test:
name: Test
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: ilammy/msvc-dev-cmd@v1
- uses: leafo/gh-actions-lua@v10
with:
luaVersion: '5.1'
- run: 'mkdir "C:\Program Files\Eagle Dynamics\DCS World"'
- run: '7z x lib\DCS_archive.zip -o"C:\Program Files\Eagle Dynamics\DCS World"'
- run: .\runtests.bat waves
9 changes: 9 additions & 0 deletions builddocs.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
@echo off

cd docs\api\ & ^
ldoc.lua.bat -c gremlin.ldoc . & ^
ldoc.lua.bat -c evac.ldoc . & ^
ldoc.lua.bat -c urgency.ldoc . & ^
ldoc.lua.bat -c waves.ldoc . & ^
cd ..\..\ & ^
mdbook build
10 changes: 10 additions & 0 deletions builddocs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env bash

cd docs/api/
ldoc -c gremlin.ldoc .
ldoc -c evac.ldoc .
ldoc -c urgency.ldoc .
ldoc -c waves.ldoc .

cd ../../
mdbook build
2 changes: 1 addition & 1 deletion docs/api/ldoc.ltp
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ $(ldoc.prettify(kitem.usage[1]))
> end
> end
> for item in items() do
**$(display_name(item))**
$(lev3) `$(display_name(item))`

> if ldoc.prettify_files and ldoc.is_file_prettified[item.module.file.filename] then
[line $(item.lineno)]($(ldoc.source_ref(item)))
Expand Down
8 changes: 5 additions & 3 deletions mocks/DCS.lua
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,11 @@ Unit = {
return mist.DBs.unitsByName[_name]
end

for _, _units in pairs(Evac._state.extractableNow) do
if _units[_name] ~= nil and _units[_name][0] ~= nil then
return _units[_name][0].object or _units[_name][0]
if Evac ~= nil then
for _, _units in pairs(Evac._state.extractableNow) do
if _units[_name] ~= nil and _units[_name][0] ~= nil then
return _units[_name][0].object or _units[_name][0]
end
end
end

Expand Down
Loading

0 comments on commit cb8600b

Please sign in to comment.