Skip to content

Made Frontend. (Still subject to changes) #47

Made Frontend. (Still subject to changes)

Made Frontend. (Still subject to changes) #47

Workflow file for this run

name: Monorepo Tests & SonarCloud
on:
push:
branches: [main, Development]
paths-ignore:
- '**.md'
- 'docs/**'
pull_request:
types: [opened, synchronize, reopened]
paths-ignore:
- '**.md'
- 'docs/**'
jobs:
test-and-analyze:
name: Run Tests & SonarCloud Analysis
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ['3.13']
steps:
- name: 🧾 Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: 🐍 Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: πŸ“¦ Install global test dependencies
run: |
python -m pip install --upgrade pip
pip install pytest pytest-cov coverage
- name: πŸ“ Install service dependencies
working-directory: ./backend/api
run: |
for service in */; do
if [ -f "${service}requirements.txt" ]; then
echo "Installing requirements for $service"
pip install -r "${service}requirements.txt"
fi
done
- name: πŸ§ͺ Run tests with coverage
working-directory: ./backend/api
run: |
SERVICES=$(find . -maxdepth 1 -type d -name "*_service" -exec basename {} \;)
COV_ARGS=""
for service in $SERVICES; do
COV_ARGS="$COV_ARGS --cov=$service"
done
pytest $COV_ARGS --cov-report=xml $(find . -type d -name "tests")
- name: πŸ“„ Move coverage report to root
run: mv ./backend/api/coverage.xml ./coverage.xml
- name: πŸ” SonarCloud Analysis
uses: SonarSource/sonarcloud-github-action@v2
with:
projectBaseDir: .
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}