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 befadea
Show file tree
Hide file tree
Showing 21 changed files with 377 additions and 43 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
4 changes: 2 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
"file": "${workspaceFolder}/test/run.lua"
},
"env": {
"LUA_PATH": "C:/Program Files/Eagle Dynamics/DCS World OpenBeta/?.lua;${workspaceFolder}/src/?.lua;${workspaceFolder}/lib/?.lua;${workspaceFolder}/?.lua;;"
"LUA_PATH": "C:/Program Files/Eagle Dynamics/DCS World/?.lua;${workspaceFolder}/src/?.lua;${workspaceFolder}/lib/?.lua;${workspaceFolder}/?.lua;;"
},
"cwd": "C:/Program Files/Eagle Dynamics/DCS World OpenBeta"
"cwd": "C:/Program Files/Eagle Dynamics/DCS World"
}
]
}
20 changes: 14 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,32 @@ This is the Gremlin Scripts repo! Everything you need to succeed with DCS missio

## Installation

Simply copy the contents of the `src` directory to your `Missions` folder in `Saved Games`. If you like, you can also grab MiST from this project's `lib` folder, though it's usually best to grab the latest version [directly from GitHub](https://github.com/mrSkortch/MissionScriptingTools).
Simply copy the contents of the `src` directory to your `Missions` folder in `Saved Games`. If you like, you can also grab MiST from this project's `lib` folder, though it's usually best to grab the latest version [directly from GitHub](https://github.com/mrSkortch/MissionScriptingTools). **NOTE THAT MiST WILL BE REMOVED FROM THIS REPO SOON, AS WE ARE MOVING AWAY FROM IT!**

Once you have the files in place, add a trigger to load MiST (follow its documentation for the best ways to do this), a second to load Gremlin Script Tools, and then a third to load the exact script you wish to use, such as Gremlin Evac. Once all three are loaded, the final step is to fully set up the script(s) to do their thing - see the relevant Configuration section, below, for more on this.
Once you have the files in place, add a trigger to load MiST (follow its documentation for the best ways to do this), a second to load Gremlin Script Tools, and then a third to load the exact script you wish to use, such as Gremlin Evac. Once all three are loaded, the final step is to fully set up the script(s) to do their thing - see the relevant Configuration section in the docs for more on this.

And that's it! The scripts are installed and working from this point on.

## Components

### gremlin.lua

The Gremlin Script Tools file provides common features that all Gremlin Scripts use to do their thing. It must be loaded after MiST, and before any other Gremlin Scripts components.
The Gremlin Script Tools file provides common features that all Gremlin Scripts use to do their thing. It must be loaded after MiST, and before any other Gremlin Scripts components. [Full documentation is here](https://ilsystems.github.io/GremlinScripts/gremlin.html).

### evac.lua

The Gremlin Evac script sets up your missions to include evacuation scenarios. Simply call `Evac:setup()` to get sane defualts, or customize everything by filling out the available options you wish to override. [Full documentation is here](https://ilsystems.github.io/GremlinScripts/evac/).
The Gremlin Evac script sets up your missions to include evacuation scenarios. Simply call `Evac:setup()` to get sane defaults, or customize everything by filling out the available options you wish to override. [Full documentation is here](https://ilsystems.github.io/GremlinScripts/evac.html).

### urgency.lua

The Gremlin Urgency script sets up your missions to include countdowns. Simply call `Urgency:setup()` to get sane defaults, or customize everything by filling out the available options you wish to override. [Full documentation is here](https://ilsystems.github.io/GremlinScripts/urgency.html).

### waves.lua

The Gremlin Waves script sets up your missions to include AI reinforcements - for either or both sides. Simply call `Waves:setup()` to get sane defaults, or customize everything by filling out the available options you wish to override. [Full documentation is here](https://ilsystems.github.io/GremlinScripts/waves.html).

## Development and Testing

Gremlin Scripts are fully tested before release. You can run these tests yourself by simply running `runtests.bat` at the top level of this project. It will run _all_ defined tests, at the moment, but that's fine since only Gremlin Evac is available today.
Gremlin Scripts are fully tested before release. You can run these tests yourself by simply running `runtests.bat all` at the top level of this project.

Development follows standard project rules for Git - create a fork, make your changes on a new branch, submit a PR on GitHub, and we'll review and do our best to merge. If none of these words make any sense to you, let us know and we'll help you figure something out.
Development follows standard project rules for Git - create a fork, make your changes on a new branch, submit a PR on GitHub, and we'll review and do our best to merge. If none of these words make any sense to you, let us know and we'll help you figure something out!
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
8 changes: 4 additions & 4 deletions docs/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@

# API

- [Gremlin](./api/gremlin.md)
- [Evac](./api/evac.md)
- [Urgency](./api/urgency.md)
- [Waves](./api/waves.md)
- [Gremlin](./api/Gremlin.md)
- [Evac](./api/Evac.md)
- [Urgency](./api/Urgency.md)
- [Waves](./api/Waves.md)
2 changes: 1 addition & 1 deletion docs/api/evac.ldoc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ description = 'Documenting Gremlin Evac'
template = true
template_escape = '>'
dir = '.'
output = 'evac'
output = 'Evac'
ext = 'md'
merge = true
sort = true
Expand Down
2 changes: 1 addition & 1 deletion docs/api/gremlin.ldoc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ description = 'Documenting Gremlin Script Tools'
template = true
template_escape = '>'
dir = '.'
output = 'gremlin'
output = 'Gremlin'
ext = 'md'
merge = true
sort = true
Expand Down
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
2 changes: 1 addition & 1 deletion docs/api/urgency.ldoc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ description = 'Documenting Gremlin Urgency'
template = true
template_escape = '>'
dir = '.'
output = 'urgency'
output = 'Urgency'
ext = 'md'
merge = true
sort = true
Expand Down
2 changes: 1 addition & 1 deletion docs/api/waves.ldoc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ description = 'Documenting Gremlin Waves'
template = true
template_escape = '>'
dir = '.'
output = 'waves'
output = 'Waves'
ext = 'md'
merge = true
sort = true
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
4 changes: 3 additions & 1 deletion src/evac.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
--[[--
DO NOT EDIT THIS FILE! Things WILL break that way.
Gremlin Evac
DO NOT EDIT THIS SCRIPT DIRECTLY! Things WILL break that way.
Instead!
Expand Down
Loading

0 comments on commit befadea

Please sign in to comment.