From e8667c823a944fe412d663c8005c021318725f74 Mon Sep 17 00:00:00 2001 From: Luiz Henrique Priotto Date: Tue, 20 Sep 2022 14:28:40 -0300 Subject: [PATCH] Create check-status.yml --- .github/workflows/check-status.yml | 55 ++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 .github/workflows/check-status.yml diff --git a/.github/workflows/check-status.yml b/.github/workflows/check-status.yml new file mode 100644 index 000000000..c4725c2e0 --- /dev/null +++ b/.github/workflows/check-status.yml @@ -0,0 +1,55 @@ +name: Check Status + +on: + + push: + branches: + - 'bug**' + - 'bugfix**' + - 'feature**' + - 'fix**' + - 'releases**' + - 'hotfix**' + + paths-ignore: + - ".github/workflows/**" + + workflow_dispatch: + +jobs: + + pytest: + + runs-on: self-hosted + steps: + + - uses: actions/checkout@v2 + + - name: Delete Container.. + run: if [ ! -z $(docker ps -q --filter "name=ptrf-db") ]; then docker rm -f ptrf-db; fi + + - name: Preparing Container... + #Criação do container de banco de dados e copia das variaveis que serão carregadas. + run: | + docker run -d --rm --cap-add SYS_TIME --name ptrf-db -p 5432 --network python-network -e TZ="America/Sao_Paulo" -e POSTGRES_DB=ptrf -e POSTGRES_PASSWORD=adminadmin -e POSTGRES_USER=postgres postgres:11-alpine + echo "copiando fontes..." + cp /srv/env/ptrf . + + - name: Running Python Tests + uses: luizhpriotto/action_images@python36-v1.0 + with: + command: | + echo "Conectando o container a rede python..." + docker network connect python-network $(hostname) + echo "Carregando as variaveis de ambiente..." + source ptrf + pip install --user pipenv -r requirements/local.txt + python manage.py collectstatic --noinput + echo "##### COVERAGE ####" + coverage run -m pytest + coverage xml + ls -ltra + + - name: Delete Container.. + if: ${{ ( failure() ) || ( success() ) }} + run: if [ ! -z $(docker ps -q --filter "name=ptrf-db") ]; then docker rm -f ptrf-db; fi