*** Squashed 66 commits of trial and error *** #32
Workflow file for this run
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: Run Tests | |
# on: | |
# workflow_run: | |
# workflows: ["Format Check"] | |
# types: | |
# - completed | |
on: | |
pull_request: | |
types: [opened, reopened, edited, synchronize, ready_for_review] | |
jobs: | |
run-tests: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
- name: Wait for docker | |
run: | |
sleep 5 | |
- name: Build Docker image | |
run: docker build -t csharp-minitwit:latest ./csharp-minitwit | |
- name: Run Docker container | |
run: | | |
docker run -d --name csharp-minitwit -p 5000:8080 csharp-minitwit:latest | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.x' | |
- name: Install Python dependencies | |
run: | | |
cd ./csharp-minitwit/Tests | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Check Docker Logs | |
run: docker logs csharp-minitwit | |
- name: Check Public Endpoint | |
run: | | |
status_code=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:5000/public) | |
if [ "$status_code" -ne 200 ]; then | |
echo "Error: $status_code" | |
exit 1 | |
fi | |
- name: Run Python tests | |
run: | | |
cd ./csharp-minitwit/Tests | |
pytest minitwit_sim_api_test.py | |
pytest refactored_minitwit_tests.py | |
- name: Clean up | |
run: | | |
docker stop csharp-minitwit | |
docker rm csharp-minitwit |