CI/CD Pipeline and Automated Integration Tests #6
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: CI | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Build and start containers | |
| run: | | |
| cd mock-project | |
| docker compose up --build -d | |
| - name: Wait for API | |
| run: sleep 5 | |
| - name: Run unit tests | |
| run: | | |
| cd mock-project | |
| docker compose exec api pytest tests/ -v | |
| - name: Stop containers | |
| run: | | |
| cd mock-project | |
| docker compose down |