test: add simple gitlab-ci file

This commit is contained in:
Girish Ramakrishnan
2024-09-20 16:19:03 +02:00
parent 76dc856dbf
commit c1c16ab54e
2 changed files with 25 additions and 1 deletions

24
.gitlab-ci.yml Normal file
View File

@@ -0,0 +1,24 @@
run_tests:
stage: test
image: cloudron/base:4.2.0@sha256:46da2fffb36353ef714f97ae8e962bd2c212ca091108d768ba473078319a47f4
services:
- name: mysql:8.0
alias: mysql
variables:
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: box
BOX_ENV: ci
DATABASE_URL: mysql://root:password@mysql/box
script:
- echo "Running tests..."
- mysql -hmysql -uroot -ppassword -e "ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'password';"
- mysql -hmysql -uroot -ppassword -e "CREATE DATABASE IF NOT EXISTS box"
- npm install
- node_modules/.bin/db-migrate up
- ln -s /usr/local/node-18.18.0/bin/node /usr/bin/node
- node_modules/.bin/mocha --no-timeouts --bail src/test/tokens-test.js
- echo "Done!"
stages:
- test

View File

@@ -6,7 +6,7 @@ readonly source_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
readonly sudo_scripts_dir="${source_dir}/src/scripts"
if [[ ! -f /usr/bin/node ]]; then
echo "node is not in root user's environment. '/usr/bin/env node' will not work"
echo "check-install: node is not in root user's environment. '/usr/bin/env node' will not work"
exit 1
fi