Fix issue #446: Add 'duration' selector on project request #257
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
- name: Run unit tests | |
run: | | |
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 |