Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 47 additions & 1 deletion .github/workflows/code-quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,50 @@ jobs:
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: docker-scan-results.sarif
category: docker-scout
category: docker-scout

unit-tests:
runs-on: ubuntu-latest
if: ${{ github.actor != 'dependabot[bot]' }}
timeout-minutes: 10
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Build app image
run: docker compose build

- name: Run tests
run: docker compose run --rm app-nextjs npm run test -- --coverage

- name: Save coverage report
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: website/coverage/lcov.info

sonarqube:
runs-on: ubuntu-latest
if: ${{ github.actor != 'dependabot[bot]' }}
needs: unit-tests
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Download coverage report
uses: actions/download-artifact@v4
with:
name: coverage-report

- name: SonarQube Scan
uses: sonarsource/sonarqube-scan-action@v5.0.0
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

- name: SonarQube Quality Gate check
uses: sonarsource/sonarqube-quality-gate-action@v1.1.0
timeout-minutes: 5
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
3 changes: 3 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ services:
volumes:
- ./website:/app
- /app/node_modules
- ./website/coverage:/app/coverage
depends_on:
- mongodb
restart: unless-stopped
Expand All @@ -25,6 +26,8 @@ services:
timeout: 5s
retries: 3
start_period: 15s
# Command to run tests: docker compose run --rm apostrophe npm run test
# Command to run tests with coverage: docker compose run --rm apostrophe npm run test -- --coverage

# MongoDB database
mongodb:
Expand Down
8 changes: 8 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
sonar.organization=speedandfunction
sonar.projectKey=speedandfunction_website
sonar.sources=website

sonar.javascript.lcov.reportPaths=lcov.info
sonar.coverage.exclusions=

sonar.exclusions=
Loading
Loading