Update run-pytests.yml #15
This file contains hidden or 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: pytests in Docker-compose Actions Workflow | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| pull_request: | |
| branches: [ "main" ] | |
| workflow_dispatch: | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Build the Docker images | |
| run: docker compose build | |
| - name: Create .env file | |
| run: | | |
| echo "STEX_REDIS=redis://redis:6379" >> .env | |
| echo "STEX_DBENGINE=mysql" >> .env | |
| echo "STEX_DBNAME=stexdb_v1" >> .env | |
| echo "STEX_DBUSER=idp" >> .env | |
| echo "STEX_DBPASSW=ChangeIt" >> .env | |
| echo "STEX_DBHOST=mysql" >> .env | |
| echo "STEX_DBPORT=3306" >> .env | |
| echo "STEX_SECRET_KEY=someth1ngNotTr1via!" >> .env | |
| - name: Start the Docker containers | |
| run: docker compose --profile testing up -d | |
| - name: Wait for app to start | |
| run: | | |
| for i in {1..40}; do | |
| curl -s idp:8000 && break | |
| echo "Waiting..." | |
| sleep 1 | |
| done | |
| - name: Test with pytest executed within testing client container | |
| run: docker exec stexaminer-client-1 bash -c "python test_idp.py" | |