Skip to content

Commit

Permalink
Merge branch 'feature-hooks-rewrite'
Browse files Browse the repository at this point in the history
The init of DCT is moved to a hook script which will only run when a
specific named flag is set to true in the mission.
  • Loading branch information
jtoppins committed Sep 2, 2023
2 parents ec3f44e + a7cd78f commit e17b6fd
Show file tree
Hide file tree
Showing 17 changed files with 693 additions and 794 deletions.
53 changes: 21 additions & 32 deletions .github/workflows/check-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,43 +3,32 @@ name: check pull request
on:
pull_request:
branches:
- master
- master
push:
branches:
- master
- master

env:
PACKAGES: lua5.1 lua-md5 lua-filesystem lua-check
PACKAGES: lua5.1 lua-md5 lua-filesystem lua-check make

jobs:
luacheck:
make-check:
runs-on: ubuntu-latest
steps:
- name: Install Packages
run: sudo apt-get install $PACKAGES

- name: Checkout DCT
uses: actions/checkout@v2

- name: Run luacheck
run: luacheck hooks mission scripts src tests

runtests:
runs-on: ubuntu-latest
steps:
- name: Install Packages
run: sudo apt-get install $PACKAGES

- name: Checkout DCT
uses: actions/checkout@v2
with:
path: dct

- name: Checkout lua-libs
uses: actions/checkout@v2
with:
repository: jtoppins/lua-libs
path: lua-libs

- name: Run Tests
run: ./dct/tests/runtests
- name: Install Packages
run: sudo apt-get install $PACKAGES

- name: Checkout DCT
uses: actions/checkout@v2
with:
path: dct

- name: Checkout lua-libs
uses: actions/checkout@v2
with:
repository: jtoppins/lua-libs
path: lua-libs

- name: Run Tests
run: make check
working-directory: dct
3 changes: 0 additions & 3 deletions .luacheckrc
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@ read_globals = {
"dct",
}

files["mission/dct-mission-init.lua"] = {
globals = {"dctsettings", "luapath", "dct",},
}
files["src/dct/settings.lua"] = { globals = {"dctserverconfig",} }
files["src/dct/Theater.lua"] = { globals = {"theatergoals", "dct"} }
files["src/dcttestlibs/dcsstubs.lua"] = {
Expand Down
7 changes: 3 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ LUALIBSDIR := lua-libs-$(LUALIBSVER)

.PHONY: check check-syntax tests build
check-syntax:
luacheck -q hooks mission scripts src tests
luacheck -q hooks scripts src tests

tests:
rm -f "$(SRCPATH)"/data/*.state
Expand All @@ -20,13 +20,13 @@ check: check-syntax tests

build:
mkdir -p "$(BUILDPATH)"/Mods/Tech/DCT/lua
cp -a "$(SRCPATH)"/src/dct.lua "$(SRCPATH)"/src/dct/ "$(BUILDPATH)"/Mods/Tech/DCT/lua
cp -a "$(SRCPATH)"/src/dct/ "$(SRCPATH)"/src/dcthooks.lua \
"$(BUILDPATH)"/Mods/Tech/DCT/lua
sed -e "s:%VERSION%:$(VERSION):" "$(SRCPATH)"/entry.lua.tpl > \
"$(BUILDPATH)"/Mods/Tech/DCT/entry.lua
sed -e "s:%VERSION%:$(VERSION):" "$(SRCPATH)"/src/dct.lua > \
"$(BUILDPATH)"/Mods/Tech/DCT/lua/dct.lua
mkdir -p "$(BUILDPATH)"/Scripts/Hooks
cp -a "$(SRCPATH)"/mission/* "$(BUILDPATH)"/Scripts/
cp -a "$(SRCPATH)"/hooks/* "$(BUILDPATH)"/Scripts/Hooks/
mkdir -p "$(BUILDPATH)"/Config/
cp -a "$(SRCPATH)"/data/Config/dct.cfg "$(BUILDPATH)"/Config/dct.cfg
Expand All @@ -36,7 +36,6 @@ build:
(mkdir -p "$(BUILDPATH)"/demomiz; \
cd "$(BUILDPATH)"/demomiz; \
cp -a "$(SRCPATH)"/data/mission/* .; \
cp "$(SRCPATH)"/mission/* l10n/DEFAULT/; \
zip -r "../Missions/dct-demo-mission.miz" .)
cp "$(SRCPATH)"/README.md "$(BUILDPATH)"/
mkdir -p "$(BUILDPATH)"/temp
Expand Down
Loading

0 comments on commit e17b6fd

Please sign in to comment.