Refactor API testing workflow to include Docker startup and MongoDB user setup steps

This commit is contained in:
omri zaher 2025-08-11 11:53:22 +03:00
parent 7c7e60c22f
commit 9da7005a66

View file

@ -4,30 +4,40 @@ on:
pull_request: pull_request:
branches: branches:
- main - main
workflow_dispatch: # Allows manual triggering of the workflow workflow_dispatch:
jobs: jobs:
test: test:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
# Step 1: Checkout the code
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 uses: actions/checkout@v4
# Step 2: Set up Python
- name: Set up Python 3.12 - name: Set up Python 3.12
uses: actions/setup-python@v4 uses: actions/setup-python@v4
with: with:
python-version: "3.12" python-version: "3.12"
# Step 3: Install dependencies
- name: Install dependencies - name: Install dependencies
run: | run: |
python -m pip install --upgrade pip python -m pip install --upgrade pip
pip install -r requirements.txt pip install -r requirements.txt
# Step 4: Run API tests - name: App Startup with Docker
run: |
docker compose up -d
- name: Add test user to MongoDB
run: |
docker exec wekan-db mongosh wekan --eval '
db.users.insertOne({
username: "omriza5",
password: "123456",
email: "omriza5@gmail.com",
isAdmin: false
})
'
- name: Run API tests - name: Run API tests
env: env:
BASE_URL: ${{ secrets.WEKAN_URL }} # Example: Pass API base URL as a secret BASE_URL: ${{ secrets.WEKAN_URL }} # Example: Pass API base URL as a secret