Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unit testing #11

Merged
merged 52 commits into from
Dec 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
5ad8d6a
Let's try LuaUnit with GitHub workflow actions
Ismoh Dec 17, 2021
bdc2ade
permission denied. sudo might not work, cause of lua dependencies?
Ismoh Dec 17, 2021
13a3efa
is lua, luajit and luaunit working?
Ismoh Dec 17, 2021
01fe43a
is lua, luajit and luaunit working? 2
Ismoh Dec 17, 2021
82a251e
is lua, luajit and luaunit working? 3
Ismoh Dec 17, 2021
4d03e5b
Changed location of tests, cause don't want to mess aroung with lua p…
Ismoh Dec 17, 2021
a5a5f9e
Changed location of tests, cause don't want to mess aroung with lua p…
Ismoh Dec 17, 2021
928d619
Changed location of tests, cause don't want to mess aroung with lua p…
Ismoh Dec 17, 2021
dded8f2
Changed test
Ismoh Dec 17, 2021
9edc47b
Changed test 2
Ismoh Dec 17, 2021
51cb9fc
Test found the first issue!
Ismoh Dec 17, 2021
9f52476
Improved testing example
Ismoh Dec 17, 2021
7c244c9
Test found the first issue!
Ismoh Dec 17, 2021
33c70b9
Test found the first issue!
Ismoh Dec 17, 2021
aeb4c96
Test found the first issue!
Ismoh Dec 17, 2021
c64ca2f
Trying luacov again
Ismoh Dec 17, 2021
ef1b6fb
Can luarocks use luaJIT interpreter ?
Ismoh Dec 17, 2021
e9ffd62
Can luarocks use luaJIT interpreter ? 2
Ismoh Dec 17, 2021
c13ef89
Can luarocks use luaJIT interpreter ? 3
Ismoh Dec 17, 2021
9afdd7a
Can luarocks use luaJIT interpreter ? 4
Ismoh Dec 17, 2021
f16b8c6
Can luarocks use luaJIT interpreter ? 5
Ismoh Dec 17, 2021
d7ec543
luarocks works fine with luaJIT
Ismoh Dec 17, 2021
dac7e5c
Try luarocks interpreter for luacov
Ismoh Dec 17, 2021
d3a076d
Install lua separatly again?
Ismoh Dec 17, 2021
7723f96
Use lua51 installation to run luacov?
Ismoh Dec 17, 2021
4f568e8
Where is lua?
Ismoh Dec 17, 2021
c1644b3
Fixed wrong path
Ismoh Dec 17, 2021
f72225b
Testing luaJIT again
Ismoh Dec 17, 2021
24c19df
remove predixes?
Ismoh Dec 17, 2021
694a731
permissions
Ismoh Dec 17, 2021
3ca9d51
Use luarocks path command to set LUA_PATH and LUA_CPATH
Ismoh Dec 17, 2021
2e6ec9d
Removed unnecessary commands
Ismoh Dec 17, 2021
3d4e188
Fixed path
Ismoh Dec 17, 2021
e265a86
Find luarocks default config file
Ismoh Dec 17, 2021
9f7e7d8
Use --tree?
Ismoh Dec 17, 2021
e5bc577
Cleaning up github workflow actions
Ismoh Dec 17, 2021
f5c6514
Trying to create report with luacov
Ismoh Dec 17, 2021
a305196
Cleaning up github workflow actions
Ismoh Dec 17, 2021
7f22898
Fixing path
Ismoh Dec 17, 2021
fcba1ea
Fixing path?
Ismoh Dec 17, 2021
e3806ee
Fixing path?
Ismoh Dec 17, 2021
70a6a21
Fixing path?
Ismoh Dec 17, 2021
385cd49
Fixing paths
Ismoh Dec 17, 2021
9912665
Does codecov work?
Ismoh Dec 17, 2021
bdf6131
codecov adjustment
Ismoh Dec 17, 2021
1d9796f
Bdge
Ismoh Dec 17, 2021
935f604
luacov correct?
Ismoh Dec 17, 2021
88c8589
codecov path tor write report
Ismoh Dec 17, 2021
b5ff3d6
luacov on implementation files and not on testing files
Ismoh Dec 17, 2021
2ba296c
Correct luacov and codecov set up
Ismoh Dec 17, 2021
7dc8767
Testing if luacov and codecov is working as expected
Ismoh Dec 17, 2021
68c02bc
Get rid of annoying codecov warning
Ismoh Dec 17, 2021
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
8 changes: 0 additions & 8 deletions .github/workflows/adjust_package_paths.lua

This file was deleted.

23 changes: 0 additions & 23 deletions .github/workflows/adjust_package_paths.sh

This file was deleted.

110 changes: 22 additions & 88 deletions .github/workflows/lua-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,113 +12,47 @@ jobs:
steps:
- uses: actions/checkout@main

- name: Install lua 5.1.5
- name: Install luaJIT 2.0.4
#if: ${{ false }} to disable a step
run: |
################ install lua manually: https://github.com/luarocks/luarocks/wiki/Installation-instructions-for-Unix
echo "> sudo apt install build-essential libreadline-dev unzip"
sudo apt install build-essential libreadline-dev unzip

echo "> curl -R -O http://www.lua.org/ftp/lua-5.1.5.tar.gz"
curl -R -O http://www.lua.org/ftp/lua-5.1.5.tar.gz

echo "> tar -zxf lua-5.1.5.tar.gz"
tar -zxf lua-5.1.5.tar.gz

echo "> cd lua-5.1.5"
cd lua-5.1.5

echo "> make linux test"
make linux test

echo "> make install INSTALL_TOP=${{ github.workspace }}/lua51"
make install INSTALL_TOP=${{ github.workspace }}/lua51
cd ${{ github.workspace }}/.building/LuaJIT-2.0.4
make PREFIX=${{ github.workspace }}/luajit
make install PREFIX=${{ github.workspace }}/luajit

echo "> ls -R ${{ github.workspace }}/lua51"
ls -R ${{ github.workspace }}/lua51
- name: Run LuaUnit 3.4
run: |
######## copy luaunit.lua to package directory, because I don't want to mess around with lua pathes again
cp ${{ github.workspace }}/.testing/luaunit.lua ${{ github.workspace }}/luajit/share/lua/5.1/
######## run all lua test files with one command: https://stackoverflow.com/a/10523492/3493998
sudo find ${{ github.workspace }}/.testing/tests -name "*.lua" -type f -exec ${{ github.workspace }}/luajit/bin/luajit {} -o text --verbose --failure --error \; > ${{ github.workspace }}/.testing/testresult.log
cat ${{ github.workspace }}/.testing/testresult.log

- name: Install luarocks 3.8.0
run: |
################ install lua rocks manually: https://github.com/luarocks/luarocks/wiki/Installation-instructions-for-Unix
echo "> wget https://luarocks.github.io/luarocks/releases/luarocks-3.8.0.tar.gz"
######## install lua rocks manually: https://github.com/luarocks/luarocks/wiki/Installation-instructions-for-Unix
wget https://luarocks.github.io/luarocks/releases/luarocks-3.8.0.tar.gz

echo "> tar zxpf luarocks-3.8.0.tar.gz"
tar zxpf luarocks-3.8.0.tar.gz

echo "> cd luarocks-3.8.0"
cd luarocks-3.8.0

echo "> ./configure --prefix=${{ github.workspace }}/luarocks --with-lua-include=${{ github.workspace }}/lua51/include --with-lua=${{ github.workspace }}/lua51"
./configure --prefix=${{ github.workspace }}/luarocks --with-lua-include=${{ github.workspace }}/lua51/include --with-lua=${{ github.workspace }}/lua51

echo "> make"
######## set luajit pathes to luarocks
./configure --prefix=${{ github.workspace }}/luarocks --with-lua=${{ github.workspace }}/luajit --with-lua-include=${{ github.workspace }}/luajit/include/luajit-2.0 --with-lua-lib=${{ github.workspace }}/luajit/lib
make

echo "> make install"
make install

echo "> ls -R ${{ github.workspace }}/luarocks"
ls -R ${{ github.workspace }}/luarocks

- name: Install dependencies
run: |
echo "> luarocks install luacov"
${{ github.workspace }}/luarocks/bin/luarocks install luacov

echo "> luarocks install busted"
${{ github.workspace }}/luarocks/bin/luarocks install busted

echo "> luarocks install --server=https://luarocks.org/dev luaffi"
${{ github.workspace }}/luarocks/bin/luarocks install --server=https://luarocks.org/dev luaffi

#echo "> luarocks install luasystem" # https://githubmemory.com/repo/Olivine-Labs/busted/issues/650
#${{ github.workspace }}/luarocks/bin/luarocks install luasystem
######## Use --tree to define the installation path of the module, which is luajit/share/lua/5.1/ although only the 'root' directory is set
${{ github.workspace }}/luarocks/bin/luarocks --tree=${{ github.workspace }}/luajit install luacov

echo "> ls -R ${{ github.workspace }}/luarocks"
ls -R ${{ github.workspace }}/luarocks

- name: Install luaJIT 2.0.4
#if: ${{ false }} # https://code-maven.com/slides/github-ci/disable-step-in-github-action
run: |
echo "> cd ${{ github.workspace }}/.building/LuaJIT-2.0.4"
cd ${{ github.workspace }}/.building/LuaJIT-2.0.4

echo "> make PREFIX=${{ github.workspace }}/luajit"
make PREFIX=${{ github.workspace }}/luajit

echo "> make install PREFIX=${{ github.workspace }}/luajit"
make install PREFIX=${{ github.workspace }}/luajit

echo "> ls -R ${{ github.workspace }}/luajit"
ls -R ${{ github.workspace }}/luajit

- name: Generate coverage report with busted and luacov
- name: Generate coverage report with luacov
run: |
# Go back to workspace dir of runner, otherwise busted won't find spec dir oder *_spec files
echo "> cd ${{ github.workspace }}"
cd ${{ github.workspace }}

sudo chmod 744 ${{ github.workspace }}/.github/workflows/adjust_package_paths.sh
ls -lsa ${{ github.workspace }}/.github/workflows/
echo "> ${{ github.workspace }}/.github/workflows/adjust_package_paths.sh"
${{ github.workspace }}/.github/workflows/adjust_package_paths.sh

sudo chmod 744 ${{ github.workspace }}/.github/workflows/return_lua_path.sh
echo "LUA_PATH=$(${{ github.workspace }}/.github/workflows/return_lua_path.sh)" >> $GITHUB_ENV
sudo chmod 744 ${{ github.workspace }}/.github/workflows/return_lua_cpath.sh
echo "LUA_CPATH=$(${{ github.workspace }}/.github/workflows/return_lua_cpath.sh)" >> $GITHUB_ENV

echo "> ${{ github.workspace }}/luarocks/bin/busted --lua=${{ github.workspace }}/luajit/bin/luajit --lpath=${{ env.LUA_PATH }} --cpath=${{ env.LUA_CPATH }} -v -o utfTerminal"
${{ github.workspace }}/luarocks/bin/busted --lua=${{ github.workspace }}/luajit/bin/luajit --lpath=${{ env.LUA_PATH }} --cpath=${{ env.LUA_CPATH }} -v -o utfTerminal

echo "> luacov ./spec/luacov/.luacov"
${{ github.workspace }}/luarocks/bin/luacov ./spec/luacov/.luacov
sudo find ${{ github.workspace }}/.testing/tests -name "*.lua" -type f -exec ${{ github.workspace }}/luajit/bin/luajit -lluacov {} \;
${{ github.workspace }}/luajit/bin/luacov

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
with:
token: ${{ secrets.CODECOV_TOKEN }}
directory: ./spec/luacov/luacov.report.out
path_to_write_report: ./coverage/codecov_report.txt
directory: ${{ github.workspace }}
#path_to_write_report: ./codecov_report.txt https://github.com/codecov/codecov-action/issues/476
verbose: true

11 changes: 0 additions & 11 deletions .github/workflows/return_lua_cpath.sh

This file was deleted.

14 changes: 0 additions & 14 deletions .github/workflows/return_lua_path.sh

This file was deleted.

Loading