From 11dbfccc94c744e4933520d15375503213e2d411 Mon Sep 17 00:00:00 2001 From: conghuhu Date: Thu, 11 Aug 2022 17:53:50 +0800 Subject: [PATCH 1/2] docs: add lua-mysql install example fix: fix CI clone error --- .github/workflows/test.yml | 2 +- README.md | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index dc8686c..c2a73cf 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -57,7 +57,7 @@ jobs: run: | sudo /etc/init.d/mysql start mysql -e 'CREATE DATABASE ${{ env.MYSQL_DB }};' -u${{ env.MYSQL_USER }} -p${{ env.MYSQL_PASSWORD }} - luarocks install casbin + luarocks install https://raw.githubusercontent.com/casbin/lua-casbin/master/casbin-1.41.1-1.rockspec sudo apt install sqlite3 libsqlite3-dev lua-sql-mysql libpq-dev luarocks install luasql-mysql MYSQL_INCDIR=/usr/include/mysql/ luarocks install luasql-postgres PGSQL_INCDIR=/usr/include/postgresql/ diff --git a/README.md b/README.md index a8561cc..28bd6c2 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,15 @@ First, install the corresponding driver of LuaSQL from LuaRocks based on the dat - For PostgreSQL, install luasql-postgres. - For SQLite3, install luasql-sqlite3. +Take installing luasql-mysql for example, others are similar: +- If there is no mysql locally, please install it locally. +- Run `whereis mysql` to find your mysql path, then cd into th path to find include path and lib path. + ```shell + [root@master ~]# whereis mysql + mysql: /usr/bin/mysql /usr/local/mysql + ``` +- Use mysql include path and lib path to install luasql-mysql. Run `luarocks install luasql-mysql MYSQL_INCDIR=/usr/local/mysql/include MYSQL_LIBDIR=/usr/local/mysql/lib` + Then install the casbin-adapter from LuaRocks by ```bash sudo luarocks install https://raw.githubusercontent.com/casbin-lua/luasql-adapter/master/casbin-adapter-1.0.0-1.rockspec From b4ad504ab158218538a0e1ba3fa0ab6ba4bb186a Mon Sep 17 00:00:00 2001 From: conghuhu Date: Mon, 15 Aug 2022 10:59:27 +0800 Subject: [PATCH 2/2] fix: fix CI install luasql error --- .github/workflows/test.yml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c2a73cf..9b13958 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -59,9 +59,17 @@ jobs: mysql -e 'CREATE DATABASE ${{ env.MYSQL_DB }};' -u${{ env.MYSQL_USER }} -p${{ env.MYSQL_PASSWORD }} luarocks install https://raw.githubusercontent.com/casbin/lua-casbin/master/casbin-1.41.1-1.rockspec sudo apt install sqlite3 libsqlite3-dev lua-sql-mysql libpq-dev - luarocks install luasql-mysql MYSQL_INCDIR=/usr/include/mysql/ - luarocks install luasql-postgres PGSQL_INCDIR=/usr/include/postgresql/ - luarocks install luasql-sqlite3 + # install luasql driver + sudo git clone https://github.com/lunarmodules/luasql.git + cd luasql/rockspec + sudo cp ./luasql-mysql-2.6.0-1.rockspec ../luasql-mysql-2.6.0-1.rockspec + sudo cp ./luasql-postgres-2.6.0-1.rockspec ../luasql-postgres-2.6.0-1.rockspec + sudo cp ./luasql-sqlite3-2.6.0-1.rockspec ../luasql-sqlite3-2.6.0-1.rockspec + cd .. + luarocks make luasql-mysql-2.6.0-1.rockspec MYSQL_INCDIR=/usr/include/mysql/ + luarocks make luasql-postgres-2.6.0-1.rockspec PGSQL_INCDIR=/usr/include/postgresql/ + luarocks make luasql-sqlite3-2.6.0-1.rockspec + cd .. luarocks install busted luarocks install busted-htest luarocks install luacov-coveralls