Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 76 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Test

on: [push, pull_request]

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
lua-version:
- 5.1
- 5.2
- 5.3
- 5.4
- 5.5
- luajit
- openresty
os:
- ubuntu-latest
- macos-latest
- windows-latest
steps:
- name: Checkout
uses: actions/checkout@v6

- name: Setup Lua and LuaRocks
uses: luau-project/setup-lua@8f6d85e7d2cb9cdc47188dce050f05143ab7a8e6 # v1.1.1
with:
lua-version: ${{ matrix.lua-version }}

- name: Print Lua version
run: lua -v

- name: Print LuaRocks version
run: luarocks --version

- name: Print LuaRocks config
run: luarocks config

- name: Install ljsyscall (Unix)
if: ${{ runner.os != 'Windows' && (matrix.lua-version == 'luajit' || matrix.lua-version == 'openresty') }}
run: luarocks install ljsyscall

- name: Install LuaFileSystem
run: luarocks install luafilesystem

- name: Install lunitx
run: luarocks install lunitx

- name: Install LuaCov
run: luarocks install luacov

- name: Install lua-path using the development rockspec
run: luarocks make "rockspecs/lua-path-scm-0.rockspec"

- name: Run tests (Windows)
if: ${{ runner.os == 'Windows' }}
working-directory: test
run: |
lua run.lua
lua -lluacov test_lfs.lua

- name: Run tests (Unix)
if: ${{ runner.os != 'Windows' }}
working-directory: test
run: |
lunit.sh run.lua
lua -lluacov test_lfs.lua

- name: Install LuaCov-coveralls
run: luarocks install luacov-coveralls

- name: Upload coverage report
working-directory: test
run: luacov-coveralls -t "${{ secrets.GITHUB_TOKEN }}"
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# lua-path

[![Licence](http://img.shields.io/badge/Licence-MIT-brightgreen.svg)](LICENCE.txt)
[![Test](https://github.com/moteus/lua-path/actions/workflows/test.yml/badge.svg)](https://github.com/moteus/lua-path/actions/workflows/test.yml)
[![Build Status](https://travis-ci.org/moteus/lua-path.png?branch=master)](https://travis-ci.org/moteus/lua-path)
[![Build Status](https://ci.appveyor.com/api/projects/status/okrhcb519rldjhn4?svg=true)](https://ci.appveyor.com/project/moteus/lua-path)
[![Coverage Status](https://coveralls.io/repos/moteus/lua-path/badge.png)](https://coveralls.io/r/moteus/lua-path)
Expand Down
47 changes: 47 additions & 0 deletions rockspecs/lua-path-0.3.1-3.rockspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package = "lua-path"
version = "0.3.1-3"
source = {
url = "https://github.com/moteus/lua-path/archive/v0.3.1.zip",
dir = "lua-path-0.3.1",
}

description = {
summary = "File system path manipulation library",
detailed = [[
]],
homepage = "https://github.com/moteus/lua-path",
license = "MIT/X11",
}

dependencies = {
"lua >= 5.1, < 5.6",
-- "luafilesystem >= 1.4",
-- "alien >= 0.7.0", -- instead lfs on windows
}

build = {
type = "builtin",
copy_directories = {
"doc",
"examples",
"test",
},
modules = {
["path" ] = "lua/path.lua",
["path.fs" ] = "lua/path/fs.lua",
["path.findfile" ] = "lua/path/findfile.lua",
["path.lfs.fs" ] = "lua/path/lfs/fs.lua",
["path.syscall.fs" ] = "lua/path/syscall/fs.lua",
["path.lfs.impl.fs" ] = "lua/path/lfs/impl/fs.lua",
["path.module" ] = "lua/path/module.lua",
["path.win32.alien.fs" ] = "lua/path/win32/alien/fs.lua",
["path.win32.alien.types" ] = "lua/path/win32/alien/types.lua",
["path.win32.alien.utils" ] = "lua/path/win32/alien/utils.lua",
["path.win32.alien.wcs" ] = "lua/path/win32/alien/wcs.lua",
["path.win32.ffi.fs" ] = "lua/path/win32/ffi/fs.lua",
["path.win32.ffi.types" ] = "lua/path/win32/ffi/types.lua",
["path.win32.ffi.wcs" ] = "lua/path/win32/ffi/wcs.lua",
["path.win32.fs" ] = "lua/path/win32/fs.lua",
["path.win32.wcs" ] = "lua/path/win32/wcs.lua",
}
}
2 changes: 1 addition & 1 deletion rockspecs/lua-path-scm-0.rockspec
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ description = {
}

dependencies = {
"lua >= 5.1, < 5.5",
"lua >= 5.1, < 5.6",
-- "luafilesystem >= 1.4",
-- "alien >= 0.7.0", -- instead lfs on windows
}
Expand Down
8 changes: 5 additions & 3 deletions test/test.lua
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,8 @@ function test_findfile()
assert_nil(next(params))

params = clone(files)
for f in path.each("./1/2/3/*.*") do
for file in path.each("./1/2/3/*.*") do
local f = file
f = up(f)
assert_not_nil(params[f], "unexpected: " .. f)
params[f] = nil
Expand All @@ -377,7 +378,8 @@ function test_findfile()
assert_nil(next(params))

params = clone(files)
for f, sz in path.each("./1/2/3/*.*", "fz") do
for file, sz in path.each("./1/2/3/*.*", "fz") do
local f = file
f = up(f)
assert_not_nil(params[f], "unexpected: " .. f)
assert_equal(5, sz)
Expand Down Expand Up @@ -926,4 +928,4 @@ end

end

if not LUNIT_RUN then lunit.run() end
if not LUNIT_RUN then lunit.run() end
8 changes: 5 additions & 3 deletions test/test_each.lua
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ function test_findfile()
assert_nil(next(params))

params = clone(files)
for f in path_each("./1/2/3/*.*") do
for file in path_each("./1/2/3/*.*") do
local f = file
f = up(f)
assert_not_nil(params[f], "unexpected: " .. f)
params[f] = nil
Expand All @@ -142,7 +143,8 @@ function test_findfile()
assert_nil(next(params))

params = clone(files)
for f, sz in path_each("./1/2/3/*.*", "fz") do
for file, sz in path_each("./1/2/3/*.*", "fz") do
local f = file
f = up(f)
assert_not_nil(params[f], "unexpected: " .. f)
assert_equal(5, sz)
Expand Down Expand Up @@ -219,4 +221,4 @@ elseif not prequire"path.syscall.fs" then test = SKIP_CASE"syscall module not fo
})
end

if not LUNIT_RUN then lunit.run() end
if not LUNIT_RUN then lunit.run() end