Skip to content

Commit

Permalink
Merge pull request #1887 from alerque/lua-ci
Browse files Browse the repository at this point in the history
  • Loading branch information
alerque authored Oct 11, 2023
2 parents b75b51e + f488643 commit 5cb1d05
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 32 deletions.
39 changes: 21 additions & 18 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ jobs:
fail-fast: false
matrix:
luaVersion:
- [ '5.4', 'MYCFLAGS=-fPIC' ]
- [ '5.3', 'MYCFLAGS=-fPIC' ]
- [ '5.2', 'MYCFLAGS=-fPIC' ]
- [ '5.1', 'CFLAGS="-O2 -Wall -DLUA_USE_LINUX -fPIC"' ]
- [ 'luajit', 'XCFLAGS=-fPIC' ]
# - [ 'luajit-openresty', 'XCFLAGS=-fPIC' ]
- '5.4'
- '5.3'
- '5.2'
- '5.1'
- 'luajit'
- 'luajit-openresty'
runs-on: ubuntu-22.04
name: Test on Lua ${{ matrix.luaVersion[0] }}
name: Test on Lua ${{ matrix.luaVersion }}
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -38,12 +38,15 @@ jobs:
with:
path: |
lua_modules
key: luarocks-${{ matrix.luaVersion[0] }}-${{ hashFiles('Makefile-luarocks', 'sile.rockspec.in') }}
key: luarocks-${{ matrix.luaVersion }}-${{ hashFiles('Makefile-luarocks', 'sile.rockspec.in') }}
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install fonts-sil-gentiumplus libarchive-tools libfontconfig1-dev libharfbuzz-dev libicu-dev libpng-dev poppler-utils
- name: Setup ‘lua’
uses: leafo/gh-actions-lua@v10
with:
luaVersion: ${{ matrix.luaVersion[0] }}
luaCompileFlags: ${{ matrix.luaVersion[1] }}
luaVersion: ${{ matrix.luaVersion }}
- name: Setup ‘luarocks’
uses: leafo/gh-actions-luarocks@v4
- name: Prep system Lua for use
Expand All @@ -58,32 +61,32 @@ jobs:
LUA_INCLUDE=-I$(deepest $PWD/.lua/include)
MAKEFLAGS=-j$(nproc) -Otarget
EOF
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install fonts-sil-gentiumplus libarchive-tools libfontconfig1-dev libharfbuzz-dev libicu-dev libpng-dev poppler-utils
- name: Configure
run: |
./bootstrap.sh
./configure \
--enable-developer LUACHECK=false NIX=false \
--disable-font-variations \
--without-system-luarocks \
--with${{ startsWith(matrix.luaVersion[0], '5') && 'out' || '' }}-luajit \
--with${{ !startsWith(matrix.luaVersion, 'luajit') && 'out' || '' }}-luajit \
--without-manual
- name: Make
run: |
make
- name: Prove SILE runs at all
run: |
make selfcheck
- name: Test Busted
timeout-minutes: ${{ runner.debug && 60 || 6 }}
continue-on-error: ${{ matrix.luaVersion == '5.1' }}
timeout-minutes: ${{ runner.debug && 20 || 2 }}
run: |
make busted
- name: Test Regressions
timeout-minutes: ${{ runner.debug && 60 || 6 }}
timeout-minutes: ${{ runner.debug && 20 || 2 }}
run: |
make regressions
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: test-${{ matrix.luaVersion[0] }}-actuals
name: test-${{ matrix.luaVersion }}-actuals
path: tests/*.actual
10 changes: 6 additions & 4 deletions Makefile-luarocks
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,18 @@ if !SYSTEM_LUAROCKS
LUAMODLOCK := sile-dev-1.rockslock

LOCALLUAROCKS := $(LUAROCKS) --tree lua_modules --lua-version $(LUA_VERSION)
TMPFILE != mktemp
genrockslock := $(LOCALLUAROCKS) $(LUAROCKSARGS) list --porcelain | $(AWK) '{print $$1 " " $$2}'
rocksmatch := ( T=$$(mktemp); trap 'rm -f "$$T"' EXIT HUP TERM; $(genrockslock) > "$$T"; $(CMP) -s $(LUAMODLOCK) "$$T" )

installrocks: $(LUAMODLOCK) $(shell $(rocksmatch) || echo lua_modules)
LUAROCKSMANIFEST := lua_modules/lib/luarocks/rocks-$(LUA_VERSION)/manifest

lua_modules: $(LUAMODSPEC) $(shell $(rocksmatch) || echo force)
installrocks: $(LUAMODLOCK) $(shell $(rocksmatch) || echo $(LUAROCKSMANIFEST))

$(LUAROCKSMANIFEST): $(LUAMODSPEC) $(shell $(rocksmatch) || echo force)
$(LOCALLUAROCKS) $(LUAROCKSARGS) install --only-deps $<
touch $@

$(LUAMODLOCK): lua_modules $(LUAMODSPEC)
$(LUAMODLOCK): $(LUAROCKSMANIFEST) $(LUAMODSPEC)
$(genrockslock) > $@
else
LUAMODLOCK :=
Expand Down
12 changes: 6 additions & 6 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -228,14 +228,14 @@ luacheck:

busted: $(SILE) $(addprefix .fonts/,$(TESTFONTFILES)) $(BUSTEDSPECS)
set -f; IFS=';'
if SYSTEM_LUAROCKS
packagecpath=(./{,core/}?.$(SHARED_LIB_EXT))
packagepath=(./{,lua-libraries/}?{,/init}.lua)
else
packagecpath=(./{,core/,lua_modules/lib/lua/$(LUA_VERSION)/}?.$(SHARED_LIB_EXT))
packagepath=(./{,lua_modules/share/lua/$(LUA_VERSION)/,lua-libraries/}?{,/init}.lua)
packagecpath=(./{,core/,{libtexpdf,justenough}/.libs/}?.$(SHARED_LIB_EXT))
if !SYSTEM_LUAROCKS
packagepath+=(./lua_modules/share/lua/$(LUA_VERSION)/?{,/init}.lua)
packagecpath+=(./lua_modules/lib/lua/$(LUA_VERSION)/?.$(SHARED_LIB_EXT))
endif
$(LOCALTESTFONTS) $(BUSTED) --cpath="$${packagecpath[*]};;" --lpath="$${packagepath[*]};;" $(BUSTEDFLAGS) .
# Note: use of --lua causes this to be passed back through a shell loosing one layer of quoting. Drop single quotes if removing.
$(LOCALFONTS) $(BUSTED) --lua=$(LUA) --lpath="'$${packagepath[*]};;'" --cpath="'$${packagecpath[*]};;'" $(BUSTEDFLAGS) .

coverage: export SILE_COVERAGE=1
coverage: BUSTEDFLAGS = -c
Expand Down
2 changes: 1 addition & 1 deletion packages/footnotes/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ function package:registerCommands ()
-- Apply the font before boxing, so relative baselineskip applies #1027
local material
SILE.call("footnote:font", {}, function ()
material = SILE.call("vbox", {}, function ()
material = SILE.call("vbox", {}, function ()
SILE.call("footnote:atstart", options)
SILE.call("footnote:counter", options)
SILE.process(content)
Expand Down
14 changes: 11 additions & 3 deletions src/justenoughharfbuzz.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,9 @@ int shape (lua_State *L) {
double point_size = luaL_checknumber(L, 6);
const char * featurestring = luaL_checkstring(L, 7);
char * shaper_list_string = luaL_checkstring(L, 8);
char ** shaper_list = NULL;
const char * const* shaper_list = NULL;
if (strlen(shaper_list_string) > 0) {
shaper_list = scan_shaper_list(shaper_list_string);
shaper_list = (const char * const*)scan_shaper_list(shaper_list_string);
}

hb_direction_t direction;
Expand Down Expand Up @@ -185,12 +185,12 @@ int shape (lua_State *L) {
}
glyph_info = hb_buffer_get_glyph_infos(buf, &glyph_count);
glyph_pos = hb_buffer_get_glyph_positions(buf, &glyph_count);
lua_checkstack(L, glyph_count*10);
for (j = 0; j < glyph_count; ++j) {
char namebuf[255];
hb_glyph_extents_t extents = {0,0,0,0};
hb_font_get_glyph_extents(hbFont, glyph_info[j].codepoint, &extents);

lua_checkstack(L, 3);
lua_newtable(L);
lua_pushstring(L, "name");
hb_font_get_glyph_name( hbFont, glyph_info[j].codepoint, namebuf, 255 );
Expand All @@ -206,21 +206,25 @@ int shape (lua_State *L) {
baseline, and we should use that and take out this condition. */
if (direction != HB_DIRECTION_TTB) {
if (glyph_pos[j].x_offset) {
lua_checkstack(L, 2);
lua_pushstring(L, "x_offset");
lua_pushnumber(L, glyph_pos[j].x_offset * point_size / upem);
lua_settable(L, -3);
}

if (glyph_pos[j].y_offset) {
lua_checkstack(L, 2);
lua_pushstring(L, "y_offset");
lua_pushnumber(L, glyph_pos[j].y_offset * point_size / upem);
lua_settable(L, -3);
}
}

lua_checkstack(L, 2);
lua_pushstring(L, "gid");
lua_pushinteger(L, glyph_info[j].codepoint);
lua_settable(L, -3);
lua_checkstack(L, 2);
lua_pushstring(L, "index");
lua_pushinteger(L, glyph_info[j].cluster);
lua_settable(L, -3);
Expand All @@ -240,17 +244,21 @@ int shape (lua_State *L) {
width = glyphAdvance;
glyphAdvance = height;
}
lua_checkstack(L, 2);
lua_pushstring(L, "glyphAdvance");
lua_pushnumber(L, glyphAdvance);
lua_settable(L, -3);

lua_checkstack(L, 2);
lua_pushstring(L, "width");
lua_pushnumber(L, width);
lua_settable(L, -3);

lua_checkstack(L, 2);
lua_pushstring(L, "height");
lua_pushnumber(L, height);
lua_settable(L, -3);
lua_checkstack(L, 2);
lua_pushstring(L, "depth");
lua_pushnumber(L, -tHeight - height);
lua_settable(L, -3);
Expand Down

0 comments on commit 5cb1d05

Please sign in to comment.