Skip to content

Update Dockerfile.test #24

Update Dockerfile.test

Update Dockerfile.test #24

name: Backend Test with Coverage
on:
push:
branches: gargi-production
pull_request:
branches: gargi-production
jobs:
test:
runs-on: self-hosted
defaults:
run:
working-directory: ./backend # All commands run from here
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build test image
run: docker build -f tests/Dockerfile.test -t backend-test .
- name: Run tests with coverage
id: coverage
run: |
docker run --name test-container backend-test
# Copy coverage files to backend/ directory
docker cp test-container:/app/coverage.xml . || true
docker cp test-container:/app/htmlcov ./htmlcov || true
docker rm test-container
- name: Upload coverage report (XML)
uses: actions/upload-artifact@v3
with:
name: coverage-xml
path: backend/coverage.xml
if: always() && exists('backend/coverage.xml')

Check failure on line 40 in .github/workflows/coverage-workflow.yml

View workflow run for this annotation

GitHub Actions / Backend Test with Coverage

Invalid workflow file

The workflow is not valid. .github/workflows/coverage-workflow.yml (Line: 40, Col: 11): Unrecognized function: 'exists'. Located at position 13 within expression: always() && exists('backend/coverage.xml') .github/workflows/coverage-workflow.yml (Line: 47, Col: 11): Unrecognized function: 'exists'. Located at position 13 within expression: always() && exists('backend/htmlcov')
- name: Upload HTML coverage report
uses: actions/upload-artifact@v3
with:
name: coverage-html
path: backend/htmlcov/
if: always() && exists('backend/htmlcov')