Skip to content

Extended tp registrations #297

Extended tp registrations

Extended tp registrations #297

Workflow file for this run

name: Unit tests and docker build
on: ["push", "pull_request"]
jobs:
build:
if: github.repository == 'genouest/genouestaccountmanager'
runs-on: self-hosted
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v4
with:
node-version: 18
- name: Run unit tests
run: |
npm install -g [email protected]
npm install -g mocha
echo "Path: ${GITHUB_WORKSPACE}"
cd $GITHUB_WORKSPACE && sudo rm -rf manager2/dist
cd $GITHUB_WORKSPACE && sudo rm -rf tests/home_dir tests/cron
mkdir -p manager2/dist
npm install
eslint routes
eslint core
sudo docker build -t osallou/my .
cd $GITHUB_WORKSPACE/cron && sudo docker build -f Dockerfile-cron -t osallou/mycron .
cd $GITHUB_WORKSPACE/tests && sudo docker-compose up -d
cd $GITHUB_WORKSPACE/tests && for i in {10..0}; do echo Try $i; sleep 30; sudo docker-compose logs my-app | grep "Server listening on port 3000"; if [ $? -eq 0 ] ; then echo Server is started; nb_done=$(sudo docker-compose exec -T my-app ls -l /opt/my/scripts/ | grep admin | grep 'update.done' | wc -l); if [ $nb_done -eq 2 ] ; then echo Admin user created; break; fi; fi; if [ $i -eq 0 ]; then echo Server does not start; exit 1; fi; done
cd $GITHUB_WORKSPACE && sudo docker ps && mocha -b -t 20000 --full-trace
cd $GITHUB_WORKSPACE/tests && sudo docker-compose logs my-app
- name: Cleanup
if: always()
run: |
cd $GITHUB_WORKSPACE/tests && sudo docker-compose down
cd $GITHUB_WORKSPACE && sudo rm -rf manager2/dist
cd $GITHUB_WORKSPACE && sudo rm -rf tests/home_dir tests/cron
sudo docker system prune -f
sudo docker volume prune -f